FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix flake8 to fix Travis CI by hugovk · Pull Request #705 · gitpython-developers/GitPython · GitHub

Repository navigation

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (11) dotfile  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
1 change: 1 addition & 0 deletions .gitignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ nbproject
.DS_Store
/*egg-info
/.tox
.idea
2 changes: 1 addition & 1 deletion git/compat.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -309,5 +309,5 @@ def register_surrogateescape():

try:
b"100644 \x9f\0aaa".decode(defenc, "surrogateescape")
except:
except Exception:
register_surrogateescape()
10 changes: 5 additions & 5 deletions git/diff.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -313,16 +313,16 @@ def __str__(self):
h %= self.b_blob.path

msg = ''
l = None # temp line
temp_line = None
ll = 0 # line length
for b, n in zip((self.a_blob, self.b_blob), ('lhs', 'rhs')):
if b:
l = "\n%s: %o | %s" % (n, b.mode, b.hexsha)
temp_line = "\n%s: %o | %s" % (n, b.mode, b.hexsha)
else:
l = "\n%s: None" % n
temp_line = "\n%s: None" % n
# END if blob is not None
ll = max(len(l), ll)
msg += l
ll = max(len(temp_line), ll)
msg += temp_line
# END for each blob

# add headline
Expand Down
2 changes: 1 addition & 1 deletion git/exc.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(self, command, status=None, stderr=None, stdout=None):
else:
try:
status = u'exit code(%s)' % int(status)
except:
except Exception:
s = safe_decode(str(status))
status = u"'%s'" % s if isinstance(status, string_types) else s

Expand Down
2 changes: 1 addition & 1 deletion git/refs/log.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def to_file(self, filepath):
try:
self._serialize(fp)
lfd.commit()
except:
except Exception:
# on failure it rolls back automatically, but we make it clear
lfd.rollback()
raise
Expand Down
8 changes: 5 additions & 3 deletions git/remote.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -542,9 +542,11 @@ def urls(self):
if ' Push URL:' in line:
yield line.split(': ')[-1]
except GitCommandError as ex:
if any([msg in str(ex) for msg in ['correct access rights','cannot run ssh']]):
# If ssh is not setup to access this repository, see issue 694
result = Git().execute(['git','config','--get','remote.%s.url' % self.name])
if any([msg in str(ex) for msg in ['correct access rights',
'cannot run ssh']]):
# If ssh is not setup to access this repository, see issue 694
result = Git().execute(['git', 'config', '--get',
'remote.%s.url' % self.name])
yield result
else:
raise ex
Expand Down
2 changes: 1 addition & 1 deletion git/repo/base.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def __exit__(self, exc_type, exc_value, traceback):
def __del__(self):
try:
self.close()
except:
except Exception:
pass

def close(self):
Expand Down
4 changes: 2 additions & 2 deletions git/test/lib/helper.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def repo_creator(self):
try:
try:
return func(self, rw_repo)
except:
except Exception:
log.info("Keeping repo after failure: %s", repo_dir)
repo_dir = None
raise
Expand Down Expand Up @@ -296,7 +296,7 @@ def remote_repo_creator(self):
with cwd(rw_repo.working_dir):
try:
return func(self, rw_repo, rw_daemon_repo)
except:
except Exception:
log.info("Keeping repos after failure: \n rw_repo_dir: %s \n rw_daemon_repo_dir: %s",
rw_repo_dir, rw_daemon_repo_dir)
rw_repo_dir = rw_daemon_repo_dir = None
Expand Down
4 changes: 2 additions & 2 deletions git/test/test_commit.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ def test_traversal(self):
# at some point, both iterations should stop
self.assertEqual(list(bfirst)[-1], first)
stoptraverse = self.rorepo.commit("254d04aa3180eb8b8daf7b7ff25f010cd69b4e7d").traverse(as_edge=True)
l = list(stoptraverse)
self.assertEqual(len(l[0]), 2)
traverse_list = list(stoptraverse)
self.assertEqual(len(traverse_list[0]), 2)

# ignore self
self.assertEqual(next(start.traverse(ignore_self=False)), start)
Expand Down
2 changes: 1 addition & 1 deletion git/test/test_submodule.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -920,4 +920,4 @@ class Repo(object):
submodule_path = 'D:\\submodule_path'
relative_path = Submodule._to_relative_path(super_repo, submodule_path)
msg = '_to_relative_path should be "submodule_path" but was "%s"' % relative_path
assert relative_path == 'submodule_path', msg
assert relative_path == 'submodule_path', msg
54 changes: 27 additions & 27 deletions git/test/test_util.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -217,49 +217,49 @@ def test_actor(self):
@ddt.data(('name', ''), ('name', 'prefix_'))
def test_iterable_list(self, case):
name, prefix = case
l = IterableList(name, prefix)
iter_list = IterableList(name, prefix)

name1 = "one"
name2 = "two"
m1 = TestIterableMember(prefix + name1)
m2 = TestIterableMember(prefix + name2)

l.extend((m1, m2))
iter_list.extend((m1, m2))

self.assertEqual(len(l), 2)
self.assertEqual(len(iter_list), 2)

# contains works with name and identity
self.assertIn(name1, l)
self.assertIn(name2, l)
self.assertIn(m2, l)
self.assertIn(m2, l)
self.assertNotIn('invalid', l)
self.assertIn(name1, iter_list)
self.assertIn(name2, iter_list)
self.assertIn(m2, iter_list)
self.assertIn(m2, iter_list)
self.assertNotIn('invalid', iter_list)

# with string index
self.assertIs(l[name1], m1)
self.assertIs(l[name2], m2)
self.assertIs(iter_list[name1], m1)
self.assertIs(iter_list[name2], m2)

# with int index
self.assertIs(l[0], m1)
self.assertIs(l[1], m2)
self.assertIs(iter_list[0], m1)
self.assertIs(iter_list[1], m2)

# with getattr
self.assertIs(l.one, m1)
self.assertIs(l.two, m2)
self.assertIs(iter_list.one, m1)
self.assertIs(iter_list.two, m2)

# test exceptions
self.failUnlessRaises(AttributeError, getattr, l, 'something')
self.failUnlessRaises(IndexError, l.__getitem__, 'something')
self.failUnlessRaises(AttributeError, getattr, iter_list, 'something')
self.failUnlessRaises(IndexError, iter_list.__getitem__, 'something')

# delete by name and index
self.failUnlessRaises(IndexError, l.__delitem__, 'something')
del(l[name2])
self.assertEqual(len(l), 1)
self.assertNotIn(name2, l)
self.assertIn(name1, l)
del(l[0])
self.assertNotIn(name1, l)
self.assertEqual(len(l), 0)

self.failUnlessRaises(IndexError, l.__delitem__, 0)
self.failUnlessRaises(IndexError, l.__delitem__, 'something')
self.failUnlessRaises(IndexError, iter_list.__delitem__, 'something')
del(iter_list[name2])
self.assertEqual(len(iter_list), 1)
self.assertNotIn(name2, iter_list)
self.assertIn(name1, iter_list)
del(iter_list[0])
self.assertNotIn(name1, iter_list)
self.assertEqual(len(iter_list), 0)

self.failUnlessRaises(IndexError, iter_list.__delitem__, 0)
self.failUnlessRaises(IndexError, iter_list.__delitem__, 'something')
6 changes: 3 additions & 3 deletions git/util.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def assure_directory_exists(path, is_file=False):
def _get_exe_extensions():
try:
winprog_exts = tuple(p.upper() for p in os.environ['PATHEXT'].split(os.pathsep))
except:
except Exception:
winprog_exts = ('.BAT', 'COM', '.EXE')

return winprog_exts
Expand All @@ -200,7 +200,7 @@ def py_where(program, path=None):
# From: http://stackoverflow.com/a/377028/548792
try:
winprog_exts = tuple(p.upper() for p in os.environ['PATHEXT'].split(os.pathsep))
except:
except Exception:
winprog_exts = is_win and ('.BAT', 'COM', '.EXE') or ()

def is_exec(fpath):
Expand Down Expand Up @@ -347,7 +347,7 @@ def expand_path(p, expand_vars=True):
if expand_vars:
p = osp.expandvars(p)
return osp.normpath(osp.abspath(p))
except:
except Exception:
return None

#} END utilities
Expand Down

Back | FazBrowse Home | New Git URL