Use newer form of catching exceptions
autopep8 -i --select=W602 Also some other minor deprecated syntax changes, like "while 1". I did not commit the less obvious changes.
This commit is contained in:
parent
fb1b8bc5b8
commit
a6ad7e83ff
72 changed files with 151 additions and 154 deletions
|
|
@ -83,7 +83,7 @@ def _findall(text, substr):
|
|||
# Also finds overlaps
|
||||
sites = []
|
||||
i = 0
|
||||
while 1:
|
||||
while True:
|
||||
j = text.find(substr, i)
|
||||
if j == -1:
|
||||
break
|
||||
|
|
@ -153,10 +153,10 @@ class LinearDateGuesser(object):
|
|||
In case initialization still fails with max_year, this function raises
|
||||
a ValueError.
|
||||
"""
|
||||
while 1:
|
||||
while True:
|
||||
try:
|
||||
return date(start_year, month, day)
|
||||
except ValueError, e:
|
||||
except ValueError as e:
|
||||
if start_year == max_year:
|
||||
raise e
|
||||
start_year += cmp(max_year, start_year)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue