Skip to content

Commit a14277e

Browse files
authored
Merge pull request gitpython-developers#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

File tree

15 files changed

+107
-93
lines changed

15 files changed

+107
-93
lines changed

.appveyor.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ install:
4646
echo %PATH%
4747
uname -a
4848
git --version
49-
where git git-daemon python pip pip3 pip34
49+
where git git-daemon python pip pip3 pip34 sh
5050
python --version
5151
python -c "import struct; print(struct.calcsize('P') * 8)"
5252
@@ -91,3 +91,11 @@ test_script:
9191

9292
on_success:
9393
- IF "%PYTHON_VERSION%" == "3.5" IF NOT "%IS_CYGWIN%" == "yes" (codecov)
94+
95+
# Enable this to be able to login to the build worker. You can use the
96+
# `remmina` program in Ubuntu, use the login information that the line below
97+
# prints into the log.
98+
#on_finish:
99+
# - |
100+
# echo "Running on_finish to establish connection back to the instance"
101+
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

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
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,7 @@ 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+
self.assertEqual(len(next(stoptraverse)), 2)
174173

175174
# ignore self
176175
self.assertEqual(next(start.traverse(ignore_self=False)), start)

0 commit comments

Comments
 (0)