summaryrefslogtreecommitdiff
path: root/git/objects/tree.py
diff options
context:
space:
mode:
authorAntoine Musso <hashar@free.fr>2014-11-16 20:56:53 +0100
committerAntoine Musso <hashar@free.fr>2014-11-16 21:05:53 +0100
commit614907b7445e2ed8584c1c37df7e466e3b56170f (patch)
tree4b6e09110cd356799e9fa0f188fae55e5fa81fca /git/objects/tree.py
parentbe34ec23c48d6d5d8fd2ef4491981f6fb4bab8e6 (diff)
downloadgitpython-614907b7445e2ed8584c1c37df7e466e3b56170f.tar.gz
pep8 linting (whitespace before/after)
E201 whitespace after '(' E202 whitespace before ')' E203 whitespace before ':' E225 missing whitespace around operator E226 missing whitespace around arithmetic operator E227 missing whitespace around bitwise or shift operator E228 missing whitespace around modulo operator E231 missing whitespace after ',' E241 multiple spaces after ',' E251 unexpected spaces around keyword / parameter equals
Diffstat (limited to 'git/objects/tree.py')
-rw-r--r--git/objects/tree.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/git/objects/tree.py b/git/objects/tree.py
index 4984823e..e4e49d1a 100644
--- a/git/objects/tree.py
+++ b/git/objects/tree.py
@@ -125,13 +125,13 @@ class Tree(IndexObject, diff.Diffable, util.Traversable, util.Serializable):
tree_id = 004
_map_id_to_type = {
- commit_id : Submodule,
- blob_id : Blob,
- symlink_id : Blob
+ commit_id: Submodule,
+ blob_id: Blob,
+ symlink_id: Blob
# tree id added once Tree is defined
}
- def __init__(self, repo, binsha, mode=tree_id<<12, path=None):
+ def __init__(self, repo, binsha, mode=tree_id << 12, path=None):
super(Tree, self).__init__(repo, binsha, mode, path)
@classmethod
@@ -170,13 +170,13 @@ class Tree(IndexObject, diff.Diffable, util.Traversable, util.Serializable):
tree = self
item = self
tokens = file.split('/')
- for i,token in enumerate(tokens):
+ for i, token in enumerate(tokens):
item = tree[token]
if item.type == 'tree':
tree = item
else:
# safety assertion - blobs are at the end of the path
- if i != len(tokens)-1:
+ if i != len(tokens) - 1:
raise KeyError(msg % file)
return item
# END handle item type
@@ -189,18 +189,18 @@ class Tree(IndexObject, diff.Diffable, util.Traversable, util.Serializable):
if info[2] == file: # [2] == name
return self._map_id_to_type[info[1] >> 12](self.repo, info[0], info[1], join_path(self.path, info[2]))
# END for each obj
- raise KeyError( msg % file )
+ raise KeyError(msg % file)
# END handle long paths
@property
def trees(self):
""":return: list(Tree, ...) list of trees directly below this tree"""
- return [ i for i in self if i.type == "tree" ]
+ return [i for i in self if i.type == "tree"]
@property
def blobs(self):
""":return: list(Blob, ...) list of blobs directly below this tree"""
- return [ i for i in self if i.type == "blob" ]
+ return [i for i in self if i.type == "blob"]
@property
def cache(self):
@@ -211,9 +211,9 @@ class Tree(IndexObject, diff.Diffable, util.Traversable, util.Serializable):
See the ``TreeModifier`` for more information on how to alter the cache"""
return TreeModifier(self._cache)
- def traverse( self, predicate = lambda i,d: True,
- prune = lambda i,d: False, depth = -1, branch_first=True,
- visit_once = False, ignore_self=1 ):
+ def traverse(self, predicate=lambda i, d: True,
+ prune=lambda i, d: False, depth=-1, branch_first=True,
+ visit_once=False, ignore_self=1):
"""For documentation, see util.Traversable.traverse
Trees are set to visit_once = False to gain more performance in the traversal"""
return super(Tree, self).traverse(predicate, prune, depth, branch_first, visit_once, ignore_self)
@@ -238,7 +238,7 @@ class Tree(IndexObject, diff.Diffable, util.Traversable, util.Serializable):
return self.__div__(item)
# END index is basestring
- raise TypeError( "Invalid index type: %r" % item )
+ raise TypeError("Invalid index type: %r" % item)
def __contains__(self, item):
if isinstance(item, IndexObject):