Skip to content

Commit c6457ad

Browse files
committed
Add mypy annotations
1 parent 79be4af commit c6457ad

43 files changed

Lines changed: 319 additions & 232 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,39 @@ jobs:
88
- name: Set up Python 3.7
99
uses: actions/setup-python@v4
1010
with:
11-
python-version: '3.7'
11+
python-version: 3.7
1212
- name: Install flake8
1313
run: pip install flake8 flake8-import-order flake8-future-import flake8-commas flake8-logging-format flake8-quotes
1414
- name: Lint with flake8
1515
run: |
1616
flake8 --version
1717
flake8
18+
typecheck:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v3
22+
- name: Set up Python 3.8
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: 3.8
26+
- name: Install mypy dependencies
27+
run: |
28+
pip install mypy
29+
pip install -r requirements.txt
30+
pip install -r requirements-mypy.txt
31+
pip install mysqlclient
32+
cp .ci.settings.py dmoj/local_settings.py
33+
- name: Run typecheck with mypy
34+
run: |
35+
PYTHONPATH=. mypy judge
1836
unit:
1937
runs-on: ubuntu-latest
2038
steps:
2139
- uses: actions/checkout@v3
22-
- name: Set up Python 3.7
40+
- name: Set up Python 3.8
2341
uses: actions/setup-python@v4
2442
with:
25-
python-version: '3.7'
43+
python-version: 3.8
2644
- name: Cache pip
2745
uses: actions/cache@v2
2846
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ resources/martor-description.css
1212
resources/style.css
1313
resources/vars.scss
1414
sass_processed
15+
.mypy_cache

dmoj/celery.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
app.config_from_object(settings, namespace='CELERY')
1111

1212
if hasattr(settings, 'CELERY_BROKER_URL_SECRET'):
13-
app.conf.broker_url = settings.CELERY_BROKER_URL_SECRET
13+
app.conf.broker_url = settings.CELERY_BROKER_URL_SECRET # type: ignore[misc]
1414
if hasattr(settings, 'CELERY_RESULT_BACKEND_SECRET'):
15-
app.conf.result_backend = settings.CELERY_RESULT_BACKEND_SECRET
15+
app.conf.result_backend = settings.CELERY_RESULT_BACKEND_SECRET # type: ignore[misc]
1616

1717
# Load task modules from all registered Django app configs.
1818
app.autodiscover_tasks()

0 commit comments

Comments
 (0)