From 819827a42ddb364f98c3a1a7eae2536dc54bc4cc Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Wed, 12 Feb 2020 15:20:19 +0900 Subject: Fix blank line issues reported by flake8 - E301 expected 1 blank line - E302 expected 2 blank lines - E303 too many blank lines - E305 expected 2 blank lines after class or function definition - E306 expected 1 blank line before a nested definition Fixed automatically with autopep8: git ls-files | grep py$ | xargs autopep8 --in-place \ --select E301,E302,E303,E305,E306 Manually fix issues in project.py caused by misuse of block comments. Change-Id: Iee840fcaff48aae504ddac9c3e76d2acd484f6a9 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254599 Reviewed-by: Mike Frysinger Tested-by: David Pursehouse --- git_command.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'git_command.py') diff --git a/git_command.py b/git_command.py index df39ec09..c7e94fd0 100644 --- a/git_command.py +++ b/git_command.py @@ -48,6 +48,7 @@ _ssh_proxy_path = None _ssh_sock_path = None _ssh_clients = [] + def ssh_sock(create=True): global _ssh_sock_path if _ssh_sock_path is None: @@ -61,6 +62,7 @@ def ssh_sock(create=True): 'master-%r@%h:%p') return _ssh_sock_path + def _ssh_proxy(): global _ssh_proxy_path if _ssh_proxy_path is None: @@ -69,15 +71,18 @@ def _ssh_proxy(): 'git_ssh') return _ssh_proxy_path + def _add_ssh_client(p): _ssh_clients.append(p) + def _remove_ssh_client(p): try: _ssh_clients.remove(p) except ValueError: pass + def terminate_ssh_clients(): global _ssh_clients for p in _ssh_clients: @@ -88,8 +93,10 @@ def terminate_ssh_clients(): pass _ssh_clients = [] + _git_version = None + class _GitCall(object): def version_tuple(self): global _git_version @@ -102,11 +109,14 @@ class _GitCall(object): def __getattr__(self, name): name = name.replace('_', '-') + def fun(*cmdv): command = [name] command.extend(cmdv) return GitCommand(None, command).Wait() == 0 return fun + + git = _GitCall() @@ -187,8 +197,10 @@ class UserAgent(object): return self._git_ua + user_agent = UserAgent() + def git_require(min_version, fail=False, msg=''): git_version = git.version_tuple() if min_version <= git_version: @@ -201,9 +213,11 @@ def git_require(min_version, fail=False, msg=''): sys.exit(1) return False + def _setenv(env, name, value): env[name] = value.encode() + class GitCommand(object): def __init__(self, project, -- cgit v1.2.3-54-g00ecf