Skip to content

Commit

Permalink
Add mypy annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
Ninjaclasher committed Aug 27, 2023
1 parent 79be4af commit ba67723
Show file tree
Hide file tree
Showing 43 changed files with 326 additions and 234 deletions.
30 changes: 26 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,46 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: '3.7'
python-version: 3.8
- name: Install flake8
run: pip install flake8 flake8-import-order flake8-future-import flake8-commas flake8-logging-format flake8-quotes
- name: Lint with flake8
run: |
flake8 --version
flake8
typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip-${{ runner.os }}-${{ secrets.CACHE_VERSION }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-mypy.txt') }}
- name: Install mypy dependencies
run: |
pip install -r requirements.txt
pip install -r requirements-mypy.txt
pip install mysqlclient
cp .ci.settings.py dmoj/local_settings.py
- name: Run typecheck with mypy
run: |
PYTHONPATH=. mypy judge
unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: '3.7'
python-version: 3.8
- name: Cache pip
uses: actions/cache@v2
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ resources/martor-description.css
resources/style.css
resources/vars.scss
sass_processed
.mypy_cache
4 changes: 2 additions & 2 deletions dmoj/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
app.config_from_object(settings, namespace='CELERY')

if hasattr(settings, 'CELERY_BROKER_URL_SECRET'):
app.conf.broker_url = settings.CELERY_BROKER_URL_SECRET
app.conf.broker_url = settings.CELERY_BROKER_URL_SECRET # type: ignore[misc]
if hasattr(settings, 'CELERY_RESULT_BACKEND_SECRET'):
app.conf.result_backend = settings.CELERY_RESULT_BACKEND_SECRET
app.conf.result_backend = settings.CELERY_RESULT_BACKEND_SECRET # type: ignore[misc]

# Load task modules from all registered Django app configs.
app.autodiscover_tasks()
Expand Down
Loading

0 comments on commit ba67723

Please sign in to comment.