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/objects/submodule/util.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'git/objects/submodule/util.py') diff --git a/git/objects/submodule/util.py b/git/objects/submodule/util.py index 492d9dbe..237321e2 100644 --- a/git/objects/submodule/util.py +++ b/git/objects/submodule/util.py @@ -17,11 +17,11 @@ def sm_name(section): """:return: name of the submodule as parsed from the section name""" section = section.strip() return section[11:-1] - + def mkhead(repo, path): """:return: New branch/head instance""" return git.Head(repo, git.Head.to_full_path(path)) - + def unbare_repo(func): """Methods with this decorator raise InvalidGitRepositoryError if they encounter a bare repository""" @@ -33,7 +33,7 @@ def unbare_repo(func): # END wrapper wrapper.__name__ = func.__name__ return wrapper - + def find_first_remote_branch(remotes, branch_name): """Find the remote branch matching the name of the given branch or raise InvalidGitRepositoryError""" for remote in remotes: @@ -44,7 +44,7 @@ def find_first_remote_branch(remotes, branch_name): # END exception handling #END for remote raise InvalidGitRepositoryError("Didn't find remote branch %r in any of the given remotes", branch_name) - + #} END utilities @@ -56,16 +56,16 @@ class SubmoduleConfigParser(GitConfigParser): with the new data, if we have written into a stream. Otherwise it will add the local file to the index to make it correspond with the working tree. Additionally, the cache must be cleared - + Please note that no mutating method will work in bare mode """ - + def __init__(self, *args, **kwargs): self._smref = None self._index = None self._auto_write = True super(SubmoduleConfigParser, self).__init__(*args, **kwargs) - + #{ Interface def set_submodule(self, submodule): """Set this instance's submodule. It must be called before @@ -77,7 +77,7 @@ class SubmoduleConfigParser(GitConfigParser): assert self._smref is not None # should always have a file here assert not isinstance(self._file_or_files, StringIO) - + sm = self._smref() if sm is not None: index = self._index @@ -89,7 +89,7 @@ class SubmoduleConfigParser(GitConfigParser): # END handle weakref #} END interface - + #{ Overridden Methods def write(self): rval = super(SubmoduleConfigParser, self).write() -- cgit v1.2.1 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/objects/submodule/util.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'git/objects/submodule/util.py') diff --git a/git/objects/submodule/util.py b/git/objects/submodule/util.py index 237321e2..47b45109 100644 --- a/git/objects/submodule/util.py +++ b/git/objects/submodule/util.py @@ -9,22 +9,27 @@ __all__ = ( 'sm_section', 'sm_name', 'mkhead', 'unbare_repo', 'find_first_remote #{ Utilities + def sm_section(name): """:return: section title used in .gitmodules configuration file""" return 'submodule "%s"' % name + def sm_name(section): """:return: name of the submodule as parsed from the section name""" section = section.strip() return section[11:-1] + def mkhead(repo, path): """:return: New branch/head instance""" return git.Head(repo, git.Head.to_full_path(path)) + def unbare_repo(func): """Methods with this decorator raise InvalidGitRepositoryError if they encounter a bare repository""" + def wrapper(self, *args, **kwargs): if self.repo.bare: raise InvalidGitRepositoryError("Method '%s' cannot operate on bare repositories" % func.__name__) @@ -34,6 +39,7 @@ def unbare_repo(func): wrapper.__name__ = func.__name__ return wrapper + def find_first_remote_branch(remotes, branch_name): """Find the remote branch matching the name of the given branch or raise InvalidGitRepositoryError""" for remote in remotes: @@ -51,6 +57,7 @@ def find_first_remote_branch(remotes, branch_name): #{ Classes class SubmoduleConfigParser(GitConfigParser): + """ Catches calls to _write, and updates the .gitmodules blob in the index with the new data, if we have written into a stream. Otherwise it will -- cgit v1.2.1 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/objects/submodule/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git/objects/submodule/util.py') diff --git a/git/objects/submodule/util.py b/git/objects/submodule/util.py index 47b45109..a66fcddc 100644 --- a/git/objects/submodule/util.py +++ b/git/objects/submodule/util.py @@ -4,7 +4,7 @@ from git.config import GitConfigParser from StringIO import StringIO import weakref -__all__ = ( 'sm_section', 'sm_name', 'mkhead', 'unbare_repo', 'find_first_remote_branch', +__all__ = ('sm_section', 'sm_name', 'mkhead', 'unbare_repo', 'find_first_remote_branch', 'SubmoduleConfigParser') #{ Utilities -- cgit v1.2.1 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/objects/submodule/util.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'git/objects/submodule/util.py') diff --git a/git/objects/submodule/util.py b/git/objects/submodule/util.py index a66fcddc..bbdf5e1e 100644 --- a/git/objects/submodule/util.py +++ b/git/objects/submodule/util.py @@ -4,7 +4,7 @@ from git.config import GitConfigParser from StringIO import StringIO import weakref -__all__ = ('sm_section', 'sm_name', 'mkhead', 'unbare_repo', 'find_first_remote_branch', +__all__ = ('sm_section', 'sm_name', 'mkhead', 'unbare_repo', 'find_first_remote_branch', 'SubmoduleConfigParser') #{ Utilities @@ -27,7 +27,7 @@ def mkhead(repo, path): def unbare_repo(func): - """Methods with this decorator raise InvalidGitRepositoryError if they + """Methods with this decorator raise InvalidGitRepositoryError if they encounter a bare repository""" def wrapper(self, *args, **kwargs): @@ -60,7 +60,7 @@ class SubmoduleConfigParser(GitConfigParser): """ Catches calls to _write, and updates the .gitmodules blob in the index - with the new data, if we have written into a stream. Otherwise it will + with the new data, if we have written into a stream. Otherwise it will add the local file to the index to make it correspond with the working tree. Additionally, the cache must be cleared @@ -75,7 +75,7 @@ class SubmoduleConfigParser(GitConfigParser): #{ Interface def set_submodule(self, submodule): - """Set this instance's submodule. It must be called before + """Set this instance's submodule. It must be called before the first write operation begins""" self._smref = weakref.ref(submodule) -- cgit v1.2.1