Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d8e796f

Browse files
CounterPillowArylide
authored andcommitted
Move to Python 3.7 and update dependencies (nyaadevs#551)
* forms: replace re._pattern_type with re.Pattern Python 3.7 removed re._pattern_type and replaced it with re.Pattern. * readme: update for Python 3.7 * Update requirements Also remove some unused ones which were neither a direct dependency nor a dependency of our dependencies. * account: force ASCII usernames on login form Our database doesn't like it when we check for unicode data in a column that stores ASCII data, so let's stop it before it gets that far. * Move travis CI to Python 3.7 * travis: use xenial dist * fix newer linter warnings Apparently bare excepts are literally Hitler, and we have some new import sorting rules. Hooray! * requirements: remove six This is a dependency for sqlalchemy-utils, but we ourselves don't depend on it directly because we've never been on Python 2 ever. * Update requirements.txt
1 parent 16814d6 commit d8e796f

7 files changed

Lines changed: 60 additions & 60 deletions

File tree

‎.travis.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
language: python
22

3-
python: "3.6"
3+
python: "3.7"
44

5-
dist: trusty
5+
dist: xenial
66
sudo: required
77

88
matrix:

‎README.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# NyaaV2 [![Build Status](https://travis-ci.org/nyaadevs/nyaa.svg?branch=master)](https://travis-ci.org/nyaadevs/nyaa)
22

33
## Setting up for development
4-
This project uses Python 3.6. There are features used that do not exist in 3.5, so make sure to use Python 3.6.
4+
This project uses Python 3.7. There are features used that do not exist in 3.6, so make sure to use Python 3.7.
55
This guide also assumes you 1) are using Linux and 2) are somewhat capable with the commandline.
66
It's not impossible to run Nyaa on Windows, but this guide doesn't focus on that.
77

@@ -16,13 +16,13 @@ The `tests` folder contains tests for the the `nyaa` module and the webserver. T
1616
- Run `./dev.py test` while in the repository directory.
1717

1818
### Setting up Pyenv
19-
pyenv eases the use of different Python versions, and as not all Linux distros offer 3.6 packages, it's right up our alley.
19+
pyenv eases the use of different Python versions, and as not all Linux distros offer 3.7 packages, it's right up our alley.
2020
- Install dependencies https://github.com/pyenv/pyenv/wiki/Common-build-problems
2121
- Install `pyenv` https://github.com/pyenv/pyenv/blob/master/README.md#installation
2222
- Install `pyenv-virtualenv` https://github.com/pyenv/pyenv-virtualenv/blob/master/README.md
23-
- Install Python 3.6.1 with `pyenv` and create a virtualenv for the project:
24-
- `pyenv install 3.6.1`
25-
- `pyenv virtualenv 3.6.1 nyaa`
23+
- Install Python 3.7.2 with `pyenv` and create a virtualenv for the project:
24+
- `pyenv install 3.7.2`
25+
- `pyenv virtualenv 3.7.2 nyaa`
2626
- `pyenv activate nyaa`
2727
- Install dependencies with `pip install -r requirements.txt`
2828
- Copy `config.example.py` into `config.py`

‎nyaa/bencode.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def _read_list():
6767
elif c == _B_END:
6868
try:
6969
return int(int_bytes.decode('utf8'))
70-
except Exceptionase:
70+
except Exception:
7171
raise create_ex('Unable to parse int')
7272

7373
# not a digit OR '-' in the middle of the int
@@ -109,7 +109,7 @@ def _read_list():
109109
raise create_ex('Unexpected input while reading string length: ' + repr(c))
110110
try:
111111
str_len = int(str_len_bytes.decode())
112-
except Exceptionase:
112+
except Exception:
113113
raise create_ex('Unable to parse bytestring length')
114114

115115
bytestring = file_object.read(str_len)

‎nyaa/forms.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
SubmitField, TextAreaField)
1212
from wtforms.validators import (DataRequired, Email, EqualTo, Length, Optional, Regexp,
1313
StopValidation, ValidationError)
14+
from wtforms.widgets import HTMLString # For DisabledSelectField
1415
from wtforms.widgets import Select as SelectWidget # For DisabledSelectField
15-
from wtforms.widgets import HTMLString, html_params# For DisabledSelectField
16+
from wtforms.widgets import html_params
1617

1718
import dns.exception
1819
import dns.resolver
@@ -78,7 +79,7 @@ def register_email_blacklist_validator(form, field):
7879
validation_exception = StopValidation('Blacklisted email provider')
7980

8081
for item in email_blacklist:
81-
if isinstance(item, re._pattern_type):
82+
if isinstance(item, re.Pattern):
8283
if item.search(email):
8384
raise validation_exception
8485
elif isinstance(item, str):

‎nyaa/views/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def _maintenance_mode_hook():
2929
flask.flash(flask.Markup(message), 'danger')
3030
try:
3131
target_url = flask.url_for(endpoint)
32-
except:
32+
exceptException:
3333
# Non-GET-able endpoint, try referrer or default to home page
3434
target_url = flask.request.referrer or flask.url_for('main.home')
3535
return flask.redirect(target_url)

‎nyaa/views/account.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ def login():
2626
return flask.redirect(flask.url_for('account.login'))
2727

2828
username = form.username.data.strip()
29+
if not username.isascii():
30+
flask.flash('Invalid characters in username.', 'danger')
31+
return flask.redirect(flask.url_for('account.login'))
2932
password = form.password.data
3033
user = models.User.by_username(username)
3134

@@ -151,7 +154,7 @@ def password_reset(payload=None):
151154
s = get_serializer()
152155
try:
153156
request_timestamp, pw_hash, user_id = s.loads(payload)
154-
except:
157+
exceptException:
155158
return flask.abort(404)
156159

157160
user = models.User.by_id(user_id)

‎requirements.txt‎

Lines changed: 43 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,53 @@
1-
alembic==0.9.2
1+
alembic==1.0.11
22
appdirs==1.4.3
3-
argon2-cffi==16.3.0
4-
autopep8==1.3.1
3+
argon2-cffi==19.1.0
4+
autopep8==1.4.4
55
blinker==1.4
6-
cffi==1.10.0
7-
click==6.7
8-
dominate==2.3.1
9-
dnspython==1.15.0
10-
elasticsearch==5.3.0
11-
elasticsearch-dsl==5.2.0
12-
flake8==3.3.0
13-
flake8-isort==2.2.1
14-
Flask==0.12.2
6+
cffi==1.12.3
7+
click==7.0
8+
dnspython==1.16.0
9+
elasticsearch==7.0.2
10+
elasticsearch-dsl==7.0.0
11+
flake8==3.7.8
12+
flake8-isort==2.7.0
13+
Flask==1.1.1
1514
Flask-Assets==0.12
1615
Flask-DebugToolbar==0.10.1
17-
Flask-Migrate==2.0.3
18-
flask-paginate==0.4.5
19-
Flask-Script==2.0.5
20-
Flask-SQLAlchemy==2.2
16+
Flask-Migrate==2.5.2
17+
flask-paginate==0.5.3
18+
Flask-Script==2.0.6
19+
Flask-SQLAlchemy==2.4.0
2120
Flask-WTF==0.14.2
22-
gevent==1.3.7
21+
gevent==1.4.0
2322
greenlet==0.4.15
24-
isort==4.2.15
25-
itsdangerous==0.24
26-
Jinja2==2.9.6
27-
libsass==0.12.3
28-
Mako==1.0.6
29-
MarkupSafe==1.0
30-
mysql-replication==0.13
31-
mysqlclient==1.3.10
23+
isort==4.3.21
24+
itsdangerous==1.1.0
25+
Jinja2==2.10.1
26+
Mako==1.1.0
27+
MarkupSafe==1.1.1
28+
mysql-replication==0.19
29+
mysqlclient==1.4.3
3230
orderedset==2.0.1
33-
packaging==16.8
31+
packaging==19.1
3432
passlib==1.7.1
3533
progressbar33==2.4
36-
py==1.4.34
37-
pycodestyle==2.3.1
38-
pycparser==2.17
39-
PyMySQL==0.7.11
40-
pyparsing==2.2.0
41-
pytest==3.1.1
42-
python-dateutil==2.6.0
43-
python-editor==1.0.3
44-
python-utils==2.1.0
45-
requests==2.18.4
46-
six==1.10.0
47-
SQLAlchemy==1.1.10
48-
SQLAlchemy-FullText-Search==0.2.3
49-
SQLAlchemy-Utils==0.32.14
50-
statsd==3.2.1
51-
urllib3==1.21.1
52-
uWSGI==2.0.15
53-
visitor==0.1.3
34+
py==1.8.0
35+
pycodestyle==2.5.0
36+
pycparser==2.19
37+
PyMySQL==0.9.3
38+
pyparsing==2.4.2
39+
pytest==5.0.1
40+
python-dateutil==2.8.0
41+
python-editor==1.0.4
42+
python-utils==2.3.0
43+
requests==2.22.0
44+
SQLAlchemy==1.3.6
45+
SQLAlchemy-FullText-Search==0.2.5
46+
SQLAlchemy-Utils==0.34.1
47+
statsd==3.3.0
48+
urllib3==1.25.3
49+
uWSGI==2.0.18
5450
webassets==0.12.1
55-
Werkzeug==0.12.2
56-
WTForms==2.1
57-
Flask-Caching==1.4.0
51+
Werkzeug==0.15.5
52+
WTForms==2.2.1
53+
Flask-Caching==1.7.2

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /