From f5d11b750ecc982541d1f936488248f0b42d75d3 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sun, 16 Nov 2014 20:15:50 +0100 Subject: pep8 linting (whitespaces) W191 indentation contains tabs E221 multiple spaces before operator E222 multiple spaces after operator E225 missing whitespace around operator E271 multiple spaces after keyword W292 no newline at end of file W293 blank line contains whitespace W391 blank line at end of file --- git/index/typ.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'git/index/typ.py') diff --git a/git/index/typ.py b/git/index/typ.py index 7f27d869..97dff59e 100644 --- a/git/index/typ.py +++ b/git/index/typ.py @@ -56,7 +56,7 @@ class BaseIndexEntry(tuple): def __str__(self): return "%o %s %i\t%s" % (self.mode, self.hexsha, self.stage, self.path) - + def __repr__(self): return "(%o, %s, %i, %s)" % (self.mode, self.hexsha, self.stage, self.path) @@ -69,7 +69,7 @@ class BaseIndexEntry(tuple): def binsha(self): """binary sha of the blob """ return self[1] - + @property def hexsha(self): """hex version of our sha""" @@ -78,12 +78,12 @@ class BaseIndexEntry(tuple): @property def stage(self): """Stage of the entry, either: - + * 0 = default stage * 1 = stage before a merge or common ancestor entry in case of a 3 way merge * 2 = stage of entries from the 'left' side of the merge * 3 = stage of entries from the right side of the merge - + :note: For more information, see http://www.kernel.org/pub/software/scm/git/docs/git-read-tree.html """ return (self[2] & CE_STAGEMASK) >> CE_STAGESHIFT @@ -102,7 +102,7 @@ class BaseIndexEntry(tuple): def from_blob(cls, blob, stage = 0): """:return: Fully equipped BaseIndexEntry at the given stage""" return cls((blob.mode, blob.binsha, stage << CE_STAGESHIFT, blob.path)) - + def to_blob(self, repo): """:return: Blob using the information of this index entry""" return Blob(repo, self.binsha, self.mode, self.path) @@ -152,7 +152,7 @@ class IndexEntry(BaseIndexEntry): def size(self): """:return: Uncompressed size of the blob """ return self[10] - + @classmethod def from_base(cls, base): """ @@ -169,5 +169,3 @@ class IndexEntry(BaseIndexEntry): """:return: Minimal entry resembling the given blob object""" time = pack(">LL", 0, 0) return IndexEntry((blob.mode, blob.binsha, stage << CE_STAGESHIFT, blob.path, time, time, 0, 0, 0, 0, blob.size)) - - -- cgit v1.2.3 From be34ec23c48d6d5d8fd2ef4491981f6fb4bab8e6 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sun, 16 Nov 2014 20:51:04 +0100 Subject: pep8 linting (blank lines expectations) E301 expected 1 blank line, found 0 E302 expected 2 blank lines, found 1 E303 too many blank lines (n) --- git/index/typ.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'git/index/typ.py') diff --git a/git/index/typ.py b/git/index/typ.py index 97dff59e..2dd82b62 100644 --- a/git/index/typ.py +++ b/git/index/typ.py @@ -21,7 +21,9 @@ CE_STAGESHIFT = 12 #} END invariants + class BlobFilter(object): + """ Predicate to be used by iter_blobs allowing to filter only return blobs which match the given list of directories or files. @@ -47,6 +49,7 @@ class BlobFilter(object): class BaseIndexEntry(tuple): + """Small Brother of an index entry which can be created to describe changes done to the index in which case plenty of additional information is not requried. @@ -109,6 +112,7 @@ class BaseIndexEntry(tuple): class IndexEntry(BaseIndexEntry): + """Allows convenient access to IndexEntry data without completely unpacking it. Attributes usully accessed often are cached in the tuple whereas others are -- cgit v1.2.3 From 614907b7445e2ed8584c1c37df7e466e3b56170f Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sun, 16 Nov 2014 20:56:53 +0100 Subject: 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 --- git/index/typ.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'git/index/typ.py') diff --git a/git/index/typ.py b/git/index/typ.py index 2dd82b62..8cc076a5 100644 --- a/git/index/typ.py +++ b/git/index/typ.py @@ -102,7 +102,7 @@ class BaseIndexEntry(tuple): return self[2] @classmethod - def from_blob(cls, blob, stage = 0): + def from_blob(cls, blob, stage=0): """:return: Fully equipped BaseIndexEntry at the given stage""" return cls((blob.mode, blob.binsha, stage << CE_STAGESHIFT, blob.path)) @@ -169,7 +169,7 @@ class IndexEntry(BaseIndexEntry): return IndexEntry((base.mode, base.binsha, base.flags, base.path, time, time, 0, 0, 0, 0, 0)) @classmethod - def from_blob(cls, blob, stage = 0): + def from_blob(cls, blob, stage=0): """:return: Minimal entry resembling the given blob object""" time = pack(">LL", 0, 0) return IndexEntry((blob.mode, blob.binsha, stage << CE_STAGESHIFT, blob.path, time, time, 0, 0, 0, 0, blob.size)) -- cgit v1.2.3 From c8e70749887370a99adeda972cc3503397b5f9a7 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sun, 16 Nov 2014 21:09:47 +0100 Subject: pep8 linting (trailing whitespace) W291 trailing whitespace --- git/index/typ.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'git/index/typ.py') diff --git a/git/index/typ.py b/git/index/typ.py index 8cc076a5..4a6f6a81 100644 --- a/git/index/typ.py +++ b/git/index/typ.py @@ -1,7 +1,7 @@ """Module with additional types used by the index""" from util import ( - pack, + pack, unpack ) @@ -108,7 +108,7 @@ class BaseIndexEntry(tuple): def to_blob(self, repo): """:return: Blob using the information of this index entry""" - return Blob(repo, self.binsha, self.mode, self.path) + return Blob(repo, self.binsha, self.mode, self.path) class IndexEntry(BaseIndexEntry): @@ -159,7 +159,7 @@ class IndexEntry(BaseIndexEntry): @classmethod def from_base(cls, base): - """ + """ :return: Minimal entry as created from the given BaseIndexEntry instance. Missing values will be set to null-like values -- cgit v1.2.3