diff options
author | David Pursehouse <dpursehouse@collab.net> | 2020-02-12 15:20:19 +0900 |
---|---|---|
committer | David Pursehouse <dpursehouse@collab.net> | 2020-02-12 06:36:40 +0000 |
commit | 819827a42ddb364f98c3a1a7eae2536dc54bc4cc (patch) | |
tree | fe6bdca5ff7e44d53595a6da76d2b56ea659eee1 /git_command.py | |
parent | abdf7500612f1d115863ba8f026ddbea1e5a1f28 (diff) | |
download | git-repo-819827a42ddb364f98c3a1a7eae2536dc54bc4cc.tar.gz |
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 <vapier@google.com>
Tested-by: David Pursehouse <dpursehouse@collab.net>
Diffstat (limited to 'git_command.py')
-rw-r--r-- | git_command.py | 14 |
1 files changed, 14 insertions, 0 deletions
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 | |||
48 | _ssh_sock_path = None | 48 | _ssh_sock_path = None |
49 | _ssh_clients = [] | 49 | _ssh_clients = [] |
50 | 50 | ||
51 | |||
51 | def ssh_sock(create=True): | 52 | def ssh_sock(create=True): |
52 | global _ssh_sock_path | 53 | global _ssh_sock_path |
53 | if _ssh_sock_path is None: | 54 | if _ssh_sock_path is None: |
@@ -61,6 +62,7 @@ def ssh_sock(create=True): | |||
61 | 'master-%r@%h:%p') | 62 | 'master-%r@%h:%p') |
62 | return _ssh_sock_path | 63 | return _ssh_sock_path |
63 | 64 | ||
65 | |||
64 | def _ssh_proxy(): | 66 | def _ssh_proxy(): |
65 | global _ssh_proxy_path | 67 | global _ssh_proxy_path |
66 | if _ssh_proxy_path is None: | 68 | if _ssh_proxy_path is None: |
@@ -69,15 +71,18 @@ def _ssh_proxy(): | |||
69 | 'git_ssh') | 71 | 'git_ssh') |
70 | return _ssh_proxy_path | 72 | return _ssh_proxy_path |
71 | 73 | ||
74 | |||
72 | def _add_ssh_client(p): | 75 | def _add_ssh_client(p): |
73 | _ssh_clients.append(p) | 76 | _ssh_clients.append(p) |
74 | 77 | ||
78 | |||
75 | def _remove_ssh_client(p): | 79 | def _remove_ssh_client(p): |
76 | try: | 80 | try: |
77 | _ssh_clients.remove(p) | 81 | _ssh_clients.remove(p) |
78 | except ValueError: | 82 | except ValueError: |
79 | pass | 83 | pass |
80 | 84 | ||
85 | |||
81 | def terminate_ssh_clients(): | 86 | def terminate_ssh_clients(): |
82 | global _ssh_clients | 87 | global _ssh_clients |
83 | for p in _ssh_clients: | 88 | for p in _ssh_clients: |
@@ -88,8 +93,10 @@ def terminate_ssh_clients(): | |||
88 | pass | 93 | pass |
89 | _ssh_clients = [] | 94 | _ssh_clients = [] |
90 | 95 | ||
96 | |||
91 | _git_version = None | 97 | _git_version = None |
92 | 98 | ||
99 | |||
93 | class _GitCall(object): | 100 | class _GitCall(object): |
94 | def version_tuple(self): | 101 | def version_tuple(self): |
95 | global _git_version | 102 | global _git_version |
@@ -102,11 +109,14 @@ class _GitCall(object): | |||
102 | 109 | ||
103 | def __getattr__(self, name): | 110 | def __getattr__(self, name): |
104 | name = name.replace('_', '-') | 111 | name = name.replace('_', '-') |
112 | |||
105 | def fun(*cmdv): | 113 | def fun(*cmdv): |
106 | command = [name] | 114 | command = [name] |
107 | command.extend(cmdv) | 115 | command.extend(cmdv) |
108 | return GitCommand(None, command).Wait() == 0 | 116 | return GitCommand(None, command).Wait() == 0 |
109 | return fun | 117 | return fun |
118 | |||
119 | |||
110 | git = _GitCall() | 120 | git = _GitCall() |
111 | 121 | ||
112 | 122 | ||
@@ -187,8 +197,10 @@ class UserAgent(object): | |||
187 | 197 | ||
188 | return self._git_ua | 198 | return self._git_ua |
189 | 199 | ||
200 | |||
190 | user_agent = UserAgent() | 201 | user_agent = UserAgent() |
191 | 202 | ||
203 | |||
192 | def git_require(min_version, fail=False, msg=''): | 204 | def git_require(min_version, fail=False, msg=''): |
193 | git_version = git.version_tuple() | 205 | git_version = git.version_tuple() |
194 | if min_version <= git_version: | 206 | if min_version <= git_version: |
@@ -201,9 +213,11 @@ def git_require(min_version, fail=False, msg=''): | |||
201 | sys.exit(1) | 213 | sys.exit(1) |
202 | return False | 214 | return False |
203 | 215 | ||
216 | |||
204 | def _setenv(env, name, value): | 217 | def _setenv(env, name, value): |
205 | env[name] = value.encode() | 218 | env[name] = value.encode() |
206 | 219 | ||
220 | |||
207 | class GitCommand(object): | 221 | class GitCommand(object): |
208 | def __init__(self, | 222 | def __init__(self, |
209 | project, | 223 | project, |