fix newer linter warnings

Apparently bare excepts are literally Hitler, and we have some
new import sorting rules. Hooray!
This commit is contained in:
Nicolas F 2019-02-24 21:54:17 +01:00
parent 29a68bc717
commit 9f8f0eab91
4 changed files with 6 additions and 5 deletions

View File

@ -67,7 +67,7 @@ def _bencode_decode(file_object, decode_keys_as_utf8=True):
elif c == _B_END:
try:
return int(int_bytes.decode('utf8'))
except Exception as e:
except Exception:
raise create_ex('Unable to parse int')
# not a digit OR '-' in the middle of the int
@ -109,7 +109,7 @@ def _bencode_decode(file_object, decode_keys_as_utf8=True):
raise create_ex('Unexpected input while reading string length: ' + repr(c))
try:
str_len = int(str_len_bytes.decode())
except Exception as e:
except Exception:
raise create_ex('Unable to parse bytestring length')
bytestring = file_object.read(str_len)

View File

@ -11,8 +11,9 @@ from wtforms import (BooleanField, HiddenField, PasswordField, SelectField, Stri
SubmitField, TextAreaField)
from wtforms.validators import (DataRequired, Email, EqualTo, Length, Optional, Regexp,
StopValidation, ValidationError)
from wtforms.widgets import HTMLString # For DisabledSelectField
from wtforms.widgets import Select as SelectWidget # For DisabledSelectField
from wtforms.widgets import HTMLString, html_params # For DisabledSelectField
from wtforms.widgets import html_params
import dns.exception
import dns.resolver

View File

@ -29,7 +29,7 @@ def _maintenance_mode_hook():
flask.flash(flask.Markup(message), 'danger')
try:
target_url = flask.url_for(endpoint)
except:
except Exception:
# Non-GET-able endpoint, try referrer or default to home page
target_url = flask.request.referrer or flask.url_for('main.home')
return flask.redirect(target_url)

View File

@ -154,7 +154,7 @@ def password_reset(payload=None):
s = get_serializer()
try:
request_timestamp, pw_hash, user_id = s.loads(payload)
except:
except Exception:
return flask.abort(404)
user = models.User.by_id(user_id)