Skip to content

Commit d92af06

Browse files
committed
Fix flake8
1 parent 0a96030 commit d92af06

File tree

12 files changed

+50
-47
lines changed

12 files changed

+50
-47
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ nbproject
1414
.DS_Store
1515
/*egg-info
1616
/.tox
17+
.idea

git/compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,5 +309,5 @@ def register_surrogateescape():
309309

310310
try:
311311
b"100644 \x9f\0aaa".decode(defenc, "surrogateescape")
312-
except:
312+
except Exception:
313313
register_surrogateescape()

git/diff.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,16 +313,16 @@ def __str__(self):
313313
h %= self.b_blob.path
314314

315315
msg = ''
316-
l = None # temp line
316+
temp_line = None
317317
ll = 0 # line length
318318
for b, n in zip((self.a_blob, self.b_blob), ('lhs', 'rhs')):
319319
if b:
320-
l = "\n%s: %o | %s" % (n, b.mode, b.hexsha)
320+
temp_line = "\n%s: %o | %s" % (n, b.mode, b.hexsha)
321321
else:
322-
l = "\n%s: None" % n
322+
temp_line = "\n%s: None" % n
323323
# END if blob is not None
324-
ll = max(len(l), ll)
325-
msg += l
324+
ll = max(len(temp_line), ll)
325+
msg += temp_line
326326
# END for each blob
327327

328328
# add headline

git/exc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def __init__(self, command, status=None, stderr=None, stdout=None):
4848
else:
4949
try:
5050
status = u'exit code(%s)' % int(status)
51-
except:
51+
except Exception:
5252
s = safe_decode(str(status))
5353
status = u"'%s'" % s if isinstance(status, string_types) else s
5454

git/refs/log.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def to_file(self, filepath):
246246
try:
247247
self._serialize(fp)
248248
lfd.commit()
249-
except:
249+
except Exception:
250250
# on failure it rolls back automatically, but we make it clear
251251
lfd.rollback()
252252
raise

git/remote.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,9 +542,11 @@ def urls(self):
542542
if ' Push URL:' in line:
543543
yield line.split(': ')[-1]
544544
except GitCommandError as ex:
545-
if any([msg in str(ex) for msg in ['correct access rights','cannot run ssh']]):
546-
# If ssh is not setup to access this repository, see issue 694
547-
result = Git().execute(['git','config','--get','remote.%s.url' % self.name])
545+
if any([msg in str(ex) for msg in ['correct access rights',
546+
'cannot run ssh']]):
547+
# If ssh is not setup to access this repository, see issue 694
548+
result = Git().execute(['git', 'config', '--get',
549+
'remote.%s.url' % self.name])
548550
yield result
549551
else:
550552
raise ex

git/repo/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def __exit__(self, exc_type, exc_value, traceback):
203203
def __del__(self):
204204
try:
205205
self.close()
206-
except:
206+
except Exception:
207207
pass
208208

209209
def close(self):

git/test/lib/helper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def repo_creator(self):
139139
try:
140140
try:
141141
return func(self, rw_repo)
142-
except:
142+
except Exception:
143143
log.info("Keeping repo after failure: %s", repo_dir)
144144
repo_dir = None
145145
raise
@@ -296,7 +296,7 @@ def remote_repo_creator(self):
296296
with cwd(rw_repo.working_dir):
297297
try:
298298
return func(self, rw_repo, rw_daemon_repo)
299-
except:
299+
except Exception:
300300
log.info("Keeping repos after failure: \n rw_repo_dir: %s \n rw_daemon_repo_dir: %s",
301301
rw_repo_dir, rw_daemon_repo_dir)
302302
rw_repo_dir = rw_daemon_repo_dir = None

git/test/test_commit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ def test_traversal(self):
169169
# at some point, both iterations should stop
170170
self.assertEqual(list(bfirst)[-1], first)
171171
stoptraverse = self.rorepo.commit("254d04aa3180eb8b8daf7b7ff25f010cd69b4e7d").traverse(as_edge=True)
172-
l = list(stoptraverse)
173-
self.assertEqual(len(l[0]), 2)
172+
traverse_list = list(stoptraverse)
173+
self.assertEqual(len(traverse_list[0]), 2)
174174

175175
# ignore self
176176
self.assertEqual(next(start.traverse(ignore_self=False)), start)

git/test/test_submodule.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,4 +920,4 @@ class Repo(object):
920920
submodule_path = 'D:\\submodule_path'
921921
relative_path = Submodule._to_relative_path(super_repo, submodule_path)
922922
msg = '_to_relative_path should be "submodule_path" but was "%s"' % relative_path
923-
assert relative_path == 'submodule_path', msg
923+
assert relative_path == 'submodule_path', msg

0 commit comments

Comments
 (0)