Merge pull request #702 from yarikoptic/bf-happy-travis · gitpython-developers/GitPython@a14277e · GitHub
Skip to content

Commit a14277e

Browse files
authored
Merge pull request #702 from yarikoptic/bf-happy-travis
BF (codename "happy travis"): trying to address lints etc to make Travis green again
2 parents 0a96030 + f48d087 commit a14277e

15 files changed

Lines changed: 107 additions & 93 deletions

File tree

.appveyor.yml

Lines changed: 9 additions & 1 deletion

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ Contributors are:
2525
-Piotr Babij <piotr.babij _at_ gmail.com>
2626
-Mikuláš Poul <mikulaspoul _at_ gmail.com>
2727
-Charles Bouchard-Légaré <cblegare.atl _at_ ntis.ca>
28+
-Yaroslav Halchenko <debian _at_ onerussian.com>
2829

2930
Portions derived from other open source works and are clearly marked.

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: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -313,20 +313,20 @@ def __str__(self):
313313
h %= self.b_blob.path
314314

315315
msg = ''
316-
l = None # temp line
317-
ll = 0 # line length
316+
line = None # temp line
317+
line_length = 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+
line = "\n%s: %o | %s" % (n, b.mode, b.hexsha)
321321
else:
322-
l = "\n%s: None" % n
322+
line = "\n%s: None" % n
323323
# END if blob is not None
324-
ll = max(len(l), ll)
325-
msg += l
324+
line_length = max(len(line), line_length)
325+
msg += line
326326
# END for each blob
327327

328328
# add headline
329-
h += '\n' + '=' * ll
329+
h += '\n' + '=' * line_length
330330

331331
if self.deleted_file:
332332
msg += '\nfile deleted in rhs'

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 (ValueError, TypeError):
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', 'cannot run ssh']]):
546+
# If ssh is not setup to access this repository, see issue 694
547+
result = Git().execute(
548+
['git', 'config', '--get', 'remote.%s.url' % self.name]
549+
)
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: 3 additions & 3 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: # noqa E722
143143
log.info("Keeping repo after failure: %s", repo_dir)
144144
repo_dir = None
145145
raise
@@ -227,7 +227,7 @@ def with_rw_and_rw_remote_repo(working_tree_ref):
227227
Same as with_rw_repo, but also provides a writable remote repository from which the
228228
rw_repo has been forked as well as a handle for a git-daemon that may be started to
229229
run the remote_repo.
230-
The remote repository was cloned as bare repository from the rorepo, whereas
230+
The remote repository was cloned as bare repository from the ro repo, whereas
231231
the rw repo has a working tree and was cloned from the remote repository.
232232
233233
remote_repo has two remotes: origin and daemon_origin. One uses a local url,
@@ -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: # noqa E722
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: 1 addition & 2 deletions

0 commit comments

Comments
 (0)