Skip to content

Commit 819827a

Browse files
committed
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 <[email protected]> Tested-by: David Pursehouse <[email protected]>
1 parent abdf750 commit 819827a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+148
-12
lines changed

color.py

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ def _Color(fg=None, bg=None, attr=None):
8484
code = ''
8585
return code
8686

87+
8788
DEFAULT = None
8889

8990

command.py

+2
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ class InteractiveCommand(Command):
236236
"""Command which requires user interaction on the tty and
237237
must not run within a pager, even if the user asks to.
238238
"""
239+
239240
def WantPager(self, _opt):
240241
return False
241242

@@ -244,6 +245,7 @@ class PagedCommand(Command):
244245
"""Command which defaults to output in a pager, as its
245246
display tends to be larger than one screen full.
246247
"""
248+
247249
def WantPager(self, _opt):
248250
return True
249251

editor.py

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from error import EditorError
2525
import platform_utils
2626

27+
2728
class Editor(object):
2829
"""Manages the user's preferred text editor."""
2930

error.py

+19
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,26 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17+
1718
class ManifestParseError(Exception):
1819
"""Failed to parse the manifest file.
1920
"""
2021

22+
2123
class ManifestInvalidRevisionError(Exception):
2224
"""The revision value in a project is incorrect.
2325
"""
2426

27+
2528
class ManifestInvalidPathError(Exception):
2629
"""A path used in <copyfile> or <linkfile> is incorrect.
2730
"""
2831

32+
2933
class NoManifestException(Exception):
3034
"""The required manifest does not exist.
3135
"""
36+
3237
def __init__(self, path, reason):
3338
super(NoManifestException, self).__init__()
3439
self.path = path
@@ -37,49 +42,59 @@ def __init__(self, path, reason):
3742
def __str__(self):
3843
return self.reason
3944

45+
4046
class EditorError(Exception):
4147
"""Unspecified error from the user's text editor.
4248
"""
49+
4350
def __init__(self, reason):
4451
super(EditorError, self).__init__()
4552
self.reason = reason
4653

4754
def __str__(self):
4855
return self.reason
4956

57+
5058
class GitError(Exception):
5159
"""Unspecified internal error from git.
5260
"""
61+
5362
def __init__(self, command):
5463
super(GitError, self).__init__()
5564
self.command = command
5665

5766
def __str__(self):
5867
return self.command
5968

69+
6070
class UploadError(Exception):
6171
"""A bundle upload to Gerrit did not succeed.
6272
"""
73+
6374
def __init__(self, reason):
6475
super(UploadError, self).__init__()
6576
self.reason = reason
6677

6778
def __str__(self):
6879
return self.reason
6980

81+
7082
class DownloadError(Exception):
7183
"""Cannot download a repository.
7284
"""
85+
7386
def __init__(self, reason):
7487
super(DownloadError, self).__init__()
7588
self.reason = reason
7689

7790
def __str__(self):
7891
return self.reason
7992

93+
8094
class NoSuchProjectError(Exception):
8195
"""A specified project does not exist in the work tree.
8296
"""
97+
8398
def __init__(self, name=None):
8499
super(NoSuchProjectError, self).__init__()
85100
self.name = name
@@ -93,6 +108,7 @@ def __str__(self):
93108
class InvalidProjectGroupsError(Exception):
94109
"""A specified project is not suitable for the specified groups
95110
"""
111+
96112
def __init__(self, name=None):
97113
super(InvalidProjectGroupsError, self).__init__()
98114
self.name = name
@@ -102,15 +118,18 @@ def __str__(self):
102118
return 'in current directory'
103119
return self.name
104120

121+
105122
class RepoChangedException(Exception):
106123
"""Thrown if 'repo sync' results in repo updating its internal
107124
repo or manifest repositories. In this special case we must
108125
use exec to re-execute repo with the new code and manifest.
109126
"""
127+
110128
def __init__(self, extra_args=None):
111129
super(RepoChangedException, self).__init__()
112130
self.extra_args = extra_args or []
113131

132+
114133
class HookError(Exception):
115134
"""Thrown if a 'repo-hook' could not be run.
116135

event_log.py

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
TASK_SYNC_NETWORK = 'sync-network'
2424
TASK_SYNC_LOCAL = 'sync-local'
2525

26+
2627
class EventLog(object):
2728
"""Event log that records events that occurred during a repo invocation.
2829
@@ -165,6 +166,7 @@ def Write(self, filename):
165166
# An integer id that is unique across this invocation of the program.
166167
_EVENT_ID = multiprocessing.Value('i', 1)
167168

169+
168170
def _NextEventId():
169171
"""Helper function for grabbing the next unique id.
170172

git_command.py

+14
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
_ssh_sock_path = None
4949
_ssh_clients = []
5050

51+
5152
def ssh_sock(create=True):
5253
global _ssh_sock_path
5354
if _ssh_sock_path is None:
@@ -61,6 +62,7 @@ def ssh_sock(create=True):
6162
'master-%r@%h:%p')
6263
return _ssh_sock_path
6364

65+
6466
def _ssh_proxy():
6567
global _ssh_proxy_path
6668
if _ssh_proxy_path is None:
@@ -69,15 +71,18 @@ def _ssh_proxy():
6971
'git_ssh')
7072
return _ssh_proxy_path
7173

74+
7275
def _add_ssh_client(p):
7376
_ssh_clients.append(p)
7477

78+
7579
def _remove_ssh_client(p):
7680
try:
7781
_ssh_clients.remove(p)
7882
except ValueError:
7983
pass
8084

85+
8186
def terminate_ssh_clients():
8287
global _ssh_clients
8388
for p in _ssh_clients:
@@ -88,8 +93,10 @@ def terminate_ssh_clients():
8893
pass
8994
_ssh_clients = []
9095

96+
9197
_git_version = None
9298

99+
93100
class _GitCall(object):
94101
def version_tuple(self):
95102
global _git_version
@@ -102,11 +109,14 @@ def version_tuple(self):
102109

103110
def __getattr__(self, name):
104111
name = name.replace('_', '-')
112+
105113
def fun(*cmdv):
106114
command = [name]
107115
command.extend(cmdv)
108116
return GitCommand(None, command).Wait() == 0
109117
return fun
118+
119+
110120
git = _GitCall()
111121

112122

@@ -187,8 +197,10 @@ def git(self):
187197

188198
return self._git_ua
189199

200+
190201
user_agent = UserAgent()
191202

203+
192204
def git_require(min_version, fail=False, msg=''):
193205
git_version = git.version_tuple()
194206
if min_version <= git_version:
@@ -201,9 +213,11 @@ def git_require(min_version, fail=False, msg=''):
201213
sys.exit(1)
202214
return False
203215

216+
204217
def _setenv(env, name, value):
205218
env[name] = value.encode()
206219

220+
207221
class GitCommand(object):
208222
def __init__(self,
209223
project,

git_config.py

+16
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,23 @@
5959

6060
REVIEW_CACHE = dict()
6161

62+
6263
def IsChange(rev):
6364
return rev.startswith(R_CHANGES)
6465

66+
6567
def IsId(rev):
6668
return ID_RE.match(rev)
6769

70+
6871
def IsTag(rev):
6972
return rev.startswith(R_TAGS)
7073

74+
7175
def IsImmutable(rev):
7276
return IsChange(rev) or IsId(rev) or IsTag(rev)
7377

78+
7479
def _key(name):
7580
parts = name.split('.')
7681
if len(parts) < 2:
@@ -79,6 +84,7 @@ def _key(name):
7984
parts[-1] = parts[-1].lower()
8085
return '.'.join(parts)
8186

87+
8288
class GitConfig(object):
8389
_ForUser = None
8490

@@ -392,6 +398,7 @@ def __str__(self):
392398
_ssh_master = True
393399
_master_keys_lock = None
394400

401+
395402
def init_ssh():
396403
"""Should be called once at the start of repo to init ssh master handling.
397404
@@ -401,6 +408,7 @@ def init_ssh():
401408
assert _master_keys_lock is None, "Should only call init_ssh once"
402409
_master_keys_lock = _threading.Lock()
403410

411+
404412
def _open_ssh(host, port=None):
405413
global _ssh_master
406414

@@ -479,6 +487,7 @@ def _open_ssh(host, port=None):
479487
finally:
480488
_master_keys_lock.release()
481489

490+
482491
def close_ssh():
483492
global _master_keys_lock
484493

@@ -503,15 +512,18 @@ def close_ssh():
503512
# We're done with the lock, so we can delete it.
504513
_master_keys_lock = None
505514

515+
506516
URI_SCP = re.compile(r'^([^@:]*@?[^:/]{1,}):')
507517
URI_ALL = re.compile(r'^([a-z][a-z+-]*)://([^@/]*@?[^/]*)/')
508518

519+
509520
def GetSchemeFromUrl(url):
510521
m = URI_ALL.match(url)
511522
if m:
512523
return m.group(1)
513524
return None
514525

526+
515527
@contextlib.contextmanager
516528
def GetUrlCookieFile(url, quiet):
517529
if url.startswith('persistent-'):
@@ -552,6 +564,7 @@ def GetUrlCookieFile(url, quiet):
552564
cookiefile = os.path.expanduser(cookiefile)
553565
yield cookiefile, None
554566

567+
555568
def _preconnect(url):
556569
m = URI_ALL.match(url)
557570
if m:
@@ -572,9 +585,11 @@ def _preconnect(url):
572585

573586
return False
574587

588+
575589
class Remote(object):
576590
"""Configuration options related to a remote.
577591
"""
592+
578593
def __init__(self, config, name):
579594
self._config = config
580595
self.name = name
@@ -735,6 +750,7 @@ def _Get(self, key, all_keys=False):
735750
class Branch(object):
736751
"""Configuration options related to a single branch.
737752
"""
753+
738754
def __init__(self, config, name):
739755
self._config = config
740756
self.name = name

gitc_utils.py

+6
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,15 @@
2929

3030
NUM_BATCH_RETRIEVE_REVISIONID = 32
3131

32+
3233
def get_gitc_manifest_dir():
3334
return wrapper.Wrapper().get_gitc_manifest_dir()
3435

36+
3537
def parse_clientdir(gitc_fs_path):
3638
return wrapper.Wrapper().gitc_parse_clientdir(gitc_fs_path)
3739

40+
3841
def _set_project_revisions(projects):
3942
"""Sets the revisionExpr for a list of projects.
4043
@@ -63,6 +66,7 @@ def _set_project_revisions(projects):
6366
(proj.remote.url, proj.revisionExpr))
6467
proj.revisionExpr = revisionExpr
6568

69+
6670
def _manifest_groups(manifest):
6771
"""Returns the manifest group string that should be synced
6872
@@ -77,6 +81,7 @@ def _manifest_groups(manifest):
7781
groups = 'default,platform-' + platform.system().lower()
7882
return groups
7983

84+
8085
def generate_gitc_manifest(gitc_manifest, manifest, paths=None):
8186
"""Generate a manifest for shafsd to use for this GITC client.
8287
@@ -140,6 +145,7 @@ def generate_gitc_manifest(gitc_manifest, manifest, paths=None):
140145
# Save the manifest.
141146
save_manifest(manifest)
142147

148+
143149
def save_manifest(manifest, client_dir=None):
144150
"""Save the manifest file in the client_dir.
145151

0 commit comments

Comments
 (0)