Fix linting E722: do not use bare except

This commit is contained in:
Bruno Oliveira
2017-11-04 13:21:34 -02:00
parent 03829fde8a
commit b11640c1eb
10 changed files with 15 additions and 18 deletions

View File

@@ -250,7 +250,7 @@ class TracebackEntry(object):
line = str(self.statement).lstrip()
except KeyboardInterrupt:
raise
except:
except: # noqa
line = "???"
return " File %r:%d in %s\n %s\n" % (fn, self.lineno + 1, name, line)
@@ -478,12 +478,12 @@ class FormattedExcinfo(object):
s = str(source.getstatement(len(source) - 1))
except KeyboardInterrupt:
raise
except:
except: # noqa
try:
s = str(source[-1])
except KeyboardInterrupt:
raise
except:
except: # noqa
return 0
return 4 + (len(s) - len(s.lstrip()))

View File

@@ -254,7 +254,7 @@ def findsource(obj):
sourcelines, lineno = py.std.inspect.findsource(obj)
except py.builtin._sysex:
raise
except:
except: # noqa
return None, -1
source = Source()
source.lines = [line.rstrip() for line in sourcelines]