1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-22 17:39:59 +00:00

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: elif c == _B_END:
try: try:
return int(int_bytes.decode('utf8')) return int(int_bytes.decode('utf8'))
except Exception as e: except Exception:
raise create_ex('Unable to parse int') raise create_ex('Unable to parse int')
# not a digit OR '-' in the middle of the 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)) raise create_ex('Unexpected input while reading string length: ' + repr(c))
try: try:
str_len = int(str_len_bytes.decode()) str_len = int(str_len_bytes.decode())
except Exception as e: except Exception:
raise create_ex('Unable to parse bytestring length') raise create_ex('Unable to parse bytestring length')
bytestring = file_object.read(str_len) bytestring = file_object.read(str_len)

View file

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

View file

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

View file

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