Changeset - 7e22c4b909b2
[Not reviewed]
default
0 1 0
Mads Kiilerich - 6 years ago 2019-12-27 01:51:14
mads@kiilerich.com
Grafted from: e6d8a72c78bc
vcs: drop unused NodeGeneratorBase()()

Creating a whole list seems inefficient ... but it is fortunately not used.
1 file changed with 0 insertions and 3 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/vcs/nodes.py
Show inline comments
 
@@ -36,27 +36,24 @@ class NodeState:
 
class NodeGeneratorBase(object):
 
    """
 
    Base class for removed added and changed filenodes, it's a lazy generator
 
    class that will create filenodes only on iteration or call
 

	
 
    The len method doesn't need to create filenodes at all
 
    """
 

	
 
    def __init__(self, current_paths, cs):
 
        self.cs = cs
 
        self.current_paths = current_paths
 

	
 
    def __call__(self):
 
        return [n for n in self]
 

	
 
    def __getitem__(self, key):
 
        assert isinstance(key, slice), key
 
        for p in self.current_paths[key]:
 
            yield self.cs.get_node(p)
 

	
 
    def __len__(self):
 
        return len(self.current_paths)
 

	
 
    def __iter__(self):
 
        for p in self.current_paths:
 
            yield self.cs.get_node(p)
 

	
0 comments (0 inline, 0 general)