Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isort fixes #1390

Merged
merged 1 commit into from
Sep 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# WARNING: Do not edit this file manually! Edit ci/spec.yml and run ci/regen-workflow.py.

{"name": "CI", "on": ["push", "pull_request"], "defaults": {"run": {"shell": "bash"}}, "env": {"PRODUCTION": "TRUE"}, "jobs": {"linting": {"runs-on": "ubuntu-latest", "strategy": {"matrix": {"python-version": [3.8]}, "fail-fast": false}, "steps": [{"name": "Set up repo", "uses": "actions/checkout@v2"}, {"name": "Set up Python ${{ matrix.python-version }}", "uses": "actions/setup-python@v2", "with": {"python-version": "${{ matrix.python-version }}"}}, {"name": "Set up pip cache", "uses": "actions/cache@v2", "with": {"path": "~/.cache/pip", "key": "pip-${{ matrix.python-version }}"}}, {"name": "Set up packages", "run": "set -e\n\npip install -U pip setuptools==57.5.0 wheel\npip install -U \\\n flake8 pylint==2.14.5 pylint-django pylint-plugin-utils isort black==20.8b1 autopep8 \\\n coveralls pyyaml pytest-django\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\n"}, {"name": "Copy secret.py", "run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py"}, {"name": "Run flake8", "run": "flake8 --max-line-length 150 --exclude=*/migrations/* intranet/ scripts/ docs/ *.py"}, {"name": "Run pylint", "run": "pylint --jobs=0 --disable=fixme,broad-except,global-statement,attribute-defined-outside-init,cyclic-import,consider-using-f-string --django-settings-module=intranet.settings intranet/"}, {"name": "Run isort", "run": "isort --check --recursive intranet"}]}, "formatting": {"runs-on": "ubuntu-latest", "strategy": {"matrix": {"python-version": [3.8]}, "fail-fast": false}, "steps": [{"name": "Set up repo", "uses": "actions/checkout@v2"}, {"name": "Set up Python ${{ matrix.python-version }}", "uses": "actions/setup-python@v2", "with": {"python-version": "${{ matrix.python-version }}"}}, {"name": "Set up pip cache", "uses": "actions/cache@v2", "with": {"path": "~/.cache/pip", "key": "pip-${{ matrix.python-version }}"}}, {"name": "Set up packages", "run": "set -e\n\npip install -U pip setuptools==57.5.0 wheel\npip install -U \\\n flake8 pylint==2.14.5 pylint-django pylint-plugin-utils isort black==20.8b1 autopep8 \\\n coveralls pyyaml pytest-django\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\n"}, {"name": "Copy secret.py", "run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py"}, {"name": "Format code", "run": "./scripts/build_ensure_no_changes.sh ./scripts/format.sh"}, {"name": "Format static files and templates", "run": "./scripts/build_ensure_no_changes.sh ./scripts/static_templates_format.sh"}]}, "build": {"runs-on": "ubuntu-latest", "strategy": {"matrix": {"python-version": [3.8]}, "fail-fast": false}, "steps": [{"name": "Set up repo (fetching all commits)", "uses": "actions/checkout@v2", "with": {"fetch-depth": 0}}, {"name": "Set up Python ${{ matrix.python-version }}", "uses": "actions/setup-python@v2", "with": {"python-version": "${{ matrix.python-version }}"}}, {"name": "Set up pip cache", "uses": "actions/cache@v2", "with": {"path": "~/.cache/pip", "key": "pip-${{ matrix.python-version }}"}}, {"name": "Set up packages", "run": "set -e\n\npip install -U pip setuptools==57.5.0 wheel\npip install -U \\\n flake8 pylint==2.14.5 pylint-django pylint-plugin-utils isort black==20.8b1 autopep8 \\\n coveralls pyyaml pytest-django\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\n"}, {"name": "Copy secret.py", "run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py"}, {"name": "Regenerate workflow YAML file and check for changes", "run": "./scripts/build_ensure_no_changes.sh ./ci/regen-workflow.py"}, {"name": "Build docs", "run": "./scripts/build_ensure_no_changes.sh ./scripts/build_docs.sh"}, {"name": "Build sources", "run": "./scripts/build_ensure_no_changes.sh ./scripts/build_sources.sh"}, {"name": "Check for changes to CI spec", "run": "./scripts/build_ensure_no_changes.sh ./ci/regen-workflow.py"}, {"name": "Check for unmigrated changes", "run": "./scripts/build_ensure_no_changes.sh ./manage.py migrate"}, {"name": "Validate PR commit messages", "if": "github.event_name == 'pull_request'", "run": "./scripts/validate-commit-messages.py ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}"}, {"name": "Validate push commit messages", "if": "github.event_name == 'push' && (github.repository_owner != 'tjcsl' || github.ref != 'refs/heads/master' || github.ref != 'refs/heads/dev')", "run": "git fetch origin ${{ github.event.before }} && ./scripts/validate-commit-messages.py ${{ github.event.before }}..${{ github.event.after }}"}, {"name": "Push docs", "if": "github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository_owner == 'tjcsl' && matrix.python-version == 3.8", "run": "./scripts/push_docs.sh", "env": {"GH_TOKEN": "${{ secrets.DOCS_GH_TOKEN }}"}}]}, "tests": {"runs-on": "ubuntu-latest", "strategy": {"matrix": {"python-version": [3.8], "node-version": ["12.x"]}, "fail-fast": false}, "services": {"rabbitmq": {"image": "rabbitmq:latest", "ports": ["5672:5672"], "options": "--health-cmd \"rabbitmqctl node_health_check\" --health-interval 6s --health-timeout 5s --health-retries 10"}, "redis": {"image": "redis:latest", "ports": ["6379:6379"], "options": "--entrypoint redis-server"}, "postgres": {"image": "postgres:latest", "env": {"POSTGRES_USER": "postgres", "POSTGRES_PASSWORD": "postgres", "POSTGRES_DB": "postgres"}, "ports": ["5432:5432"], "options": "--health-cmd pg_isready --health-interval 6s --health-timeout 5s --health-retries 9"}}, "steps": [{"name": "Set up repo", "uses": "actions/checkout@v2"}, {"name": "Set up Python ${{ matrix.python-version }}", "uses": "actions/setup-python@v2", "with": {"python-version": "${{ matrix.python-version }}"}}, {"name": "Set up pip cache", "uses": "actions/cache@v2", "with": {"path": "~/.cache/pip", "key": "pip-${{ matrix.python-version }}"}}, {"name": "Set up packages", "run": "set -e\n\npip install -U pip setuptools==57.5.0 wheel\npip install -U \\\n flake8 pylint==2.14.5 pylint-django pylint-plugin-utils isort black==20.8b1 autopep8 \\\n coveralls pyyaml pytest-django\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\n"}, {"name": "Copy secret.py", "run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py"}, {"name": "Set up Node.js ${{ matrix.node-version }}", "uses": "actions/setup-node@v1", "with": {"node-version": "${{ matrix.node-version }}"}}, {"name": "Install Sass and add Node modules bin to PATH", "run": "set -e\nnpm install sass\necho \"PATH=${{ github.workspace }}/node_modules/.bin:$PATH\" >> $GITHUB_ENV\n"}, {"name": "Set and create PGPASSFILE", "run": "set -e\nPGPASSFILE=${{ runner.temp }}/.pgpass\necho \"PGPASSFILE=$PGPASSFILE\" >> $GITHUB_ENV\necho 127.0.0.1:5432:postgres:postgres:postgres >$PGPASSFILE\nchmod 600 $PGPASSFILE\n"}, {"name": "Create database", "run": "psql -U postgres -h 127.0.0.1 -c 'create database ion'"}, {"name": "install Kerberos", "run": "sudo apt install -y krb5-user"}, {"name": "Run tests", "run": "coverage run -m pytest"}, {"name": "Migrate database", "run": "coverage run -a ./manage.py migrate"}, {"name": "Collect static files", "run": "coverage run -a ./manage.py collectstatic --noinput -v 0"}, {"name": "Report coverage to Coveralls", "uses": "AndreMiras/coveralls-python-action@develop", "with": {"parallel": true}}, {"name": "Build coverage XML file", "if": "github.repository_owner == 'tjcsl' && github.event_name != 'pull_request'", "run": "coverage xml"}, {"name": "Report coverage to Codacy", "uses": "codacy/codacy-coverage-reporter-action@master", "if": "github.repository_owner == 'tjcsl' && github.event_name != 'pull_request'", "with": {"coverage-reports": "coverage.xml", "project-token": "${{ secrets.CODACY_PROJECT_TOKEN }}"}}]}, "finish_success": {"needs": ["linting", "formatting", "build", "tests"], "runs-on": "ubuntu-latest", "steps": [{"name": "Tell Coveralls that parallel jobs have finished", "uses": "coverallsapp/github-action@master", "with": {"github-token": "${{ secrets.GITHUB_TOKEN }}", "parallel-finished": true}}]}}}
{"name": "CI", "on": ["push", "pull_request"], "defaults": {"run": {"shell": "bash"}}, "env": {"PRODUCTION": "TRUE"}, "jobs": {"linting": {"runs-on": "ubuntu-latest", "strategy": {"matrix": {"python-version": [3.8]}, "fail-fast": false}, "steps": [{"name": "Set up repo", "uses": "actions/checkout@v2"}, {"name": "Set up Python ${{ matrix.python-version }}", "uses": "actions/setup-python@v2", "with": {"python-version": "${{ matrix.python-version }}"}}, {"name": "Set up pip cache", "uses": "actions/cache@v2", "with": {"path": "~/.cache/pip", "key": "pip-${{ matrix.python-version }}"}}, {"name": "Set up packages", "run": "set -e\n\npip install -U pip setuptools==57.5.0 wheel\npip install -U \\\n flake8 pylint==2.14.5 pylint-django pylint-plugin-utils isort black==20.8b1 autopep8 \\\n coveralls pyyaml pytest-django\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\n"}, {"name": "Copy secret.py", "run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py"}, {"name": "Run flake8", "run": "flake8 --max-line-length 150 --exclude=*/migrations/* intranet/ scripts/ docs/ *.py"}, {"name": "Run pylint", "run": "pylint --jobs=0 --disable=fixme,broad-except,global-statement,attribute-defined-outside-init,cyclic-import,consider-using-f-string --django-settings-module=intranet.settings intranet/"}, {"name": "Run isort", "run": "isort --check intranet"}]}, "formatting": {"runs-on": "ubuntu-latest", "strategy": {"matrix": {"python-version": [3.8]}, "fail-fast": false}, "steps": [{"name": "Set up repo", "uses": "actions/checkout@v2"}, {"name": "Set up Python ${{ matrix.python-version }}", "uses": "actions/setup-python@v2", "with": {"python-version": "${{ matrix.python-version }}"}}, {"name": "Set up pip cache", "uses": "actions/cache@v2", "with": {"path": "~/.cache/pip", "key": "pip-${{ matrix.python-version }}"}}, {"name": "Set up packages", "run": "set -e\n\npip install -U pip setuptools==57.5.0 wheel\npip install -U \\\n flake8 pylint==2.14.5 pylint-django pylint-plugin-utils isort black==20.8b1 autopep8 \\\n coveralls pyyaml pytest-django\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\n"}, {"name": "Copy secret.py", "run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py"}, {"name": "Format code", "run": "./scripts/build_ensure_no_changes.sh ./scripts/format.sh"}, {"name": "Format static files and templates", "run": "./scripts/build_ensure_no_changes.sh ./scripts/static_templates_format.sh"}]}, "build": {"runs-on": "ubuntu-latest", "strategy": {"matrix": {"python-version": [3.8]}, "fail-fast": false}, "steps": [{"name": "Set up repo (fetching all commits)", "uses": "actions/checkout@v2", "with": {"fetch-depth": 0}}, {"name": "Set up Python ${{ matrix.python-version }}", "uses": "actions/setup-python@v2", "with": {"python-version": "${{ matrix.python-version }}"}}, {"name": "Set up pip cache", "uses": "actions/cache@v2", "with": {"path": "~/.cache/pip", "key": "pip-${{ matrix.python-version }}"}}, {"name": "Set up packages", "run": "set -e\n\npip install -U pip setuptools==57.5.0 wheel\npip install -U \\\n flake8 pylint==2.14.5 pylint-django pylint-plugin-utils isort black==20.8b1 autopep8 \\\n coveralls pyyaml pytest-django\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\n"}, {"name": "Copy secret.py", "run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py"}, {"name": "Regenerate workflow YAML file and check for changes", "run": "./scripts/build_ensure_no_changes.sh ./ci/regen-workflow.py"}, {"name": "Build docs", "run": "./scripts/build_ensure_no_changes.sh ./scripts/build_docs.sh"}, {"name": "Build sources", "run": "./scripts/build_ensure_no_changes.sh ./scripts/build_sources.sh"}, {"name": "Check for changes to CI spec", "run": "./scripts/build_ensure_no_changes.sh ./ci/regen-workflow.py"}, {"name": "Check for unmigrated changes", "run": "./scripts/build_ensure_no_changes.sh ./manage.py migrate"}, {"name": "Validate PR commit messages", "if": "github.event_name == 'pull_request'", "run": "./scripts/validate-commit-messages.py ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}"}, {"name": "Validate push commit messages", "if": "github.event_name == 'push' && (github.repository_owner != 'tjcsl' || github.ref != 'refs/heads/master' || github.ref != 'refs/heads/dev')", "run": "git fetch origin ${{ github.event.before }} && ./scripts/validate-commit-messages.py ${{ github.event.before }}..${{ github.event.after }}"}, {"name": "Push docs", "if": "github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository_owner == 'tjcsl' && matrix.python-version == 3.8", "run": "./scripts/push_docs.sh", "env": {"GH_TOKEN": "${{ secrets.DOCS_GH_TOKEN }}"}}]}, "tests": {"runs-on": "ubuntu-latest", "strategy": {"matrix": {"python-version": [3.8], "node-version": ["12.x"]}, "fail-fast": false}, "services": {"rabbitmq": {"image": "rabbitmq:latest", "ports": ["5672:5672"], "options": "--health-cmd \"rabbitmqctl node_health_check\" --health-interval 6s --health-timeout 5s --health-retries 10"}, "redis": {"image": "redis:latest", "ports": ["6379:6379"], "options": "--entrypoint redis-server"}, "postgres": {"image": "postgres:latest", "env": {"POSTGRES_USER": "postgres", "POSTGRES_PASSWORD": "postgres", "POSTGRES_DB": "postgres"}, "ports": ["5432:5432"], "options": "--health-cmd pg_isready --health-interval 6s --health-timeout 5s --health-retries 9"}}, "steps": [{"name": "Set up repo", "uses": "actions/checkout@v2"}, {"name": "Set up Python ${{ matrix.python-version }}", "uses": "actions/setup-python@v2", "with": {"python-version": "${{ matrix.python-version }}"}}, {"name": "Set up pip cache", "uses": "actions/cache@v2", "with": {"path": "~/.cache/pip", "key": "pip-${{ matrix.python-version }}"}}, {"name": "Set up packages", "run": "set -e\n\npip install -U pip setuptools==57.5.0 wheel\npip install -U \\\n flake8 pylint==2.14.5 pylint-django pylint-plugin-utils isort black==20.8b1 autopep8 \\\n coveralls pyyaml pytest-django\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\n"}, {"name": "Copy secret.py", "run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py"}, {"name": "Set up Node.js ${{ matrix.node-version }}", "uses": "actions/setup-node@v1", "with": {"node-version": "${{ matrix.node-version }}"}}, {"name": "Install Sass and add Node modules bin to PATH", "run": "set -e\nnpm install sass\necho \"PATH=${{ github.workspace }}/node_modules/.bin:$PATH\" >> $GITHUB_ENV\n"}, {"name": "Set and create PGPASSFILE", "run": "set -e\nPGPASSFILE=${{ runner.temp }}/.pgpass\necho \"PGPASSFILE=$PGPASSFILE\" >> $GITHUB_ENV\necho 127.0.0.1:5432:postgres:postgres:postgres >$PGPASSFILE\nchmod 600 $PGPASSFILE\n"}, {"name": "Create database", "run": "psql -U postgres -h 127.0.0.1 -c 'create database ion'"}, {"name": "install Kerberos", "run": "sudo apt install -y krb5-user"}, {"name": "Run tests", "run": "coverage run -m pytest"}, {"name": "Migrate database", "run": "coverage run -a ./manage.py migrate"}, {"name": "Collect static files", "run": "coverage run -a ./manage.py collectstatic --noinput -v 0"}, {"name": "Report coverage to Coveralls", "uses": "AndreMiras/coveralls-python-action@develop", "with": {"parallel": true}}, {"name": "Build coverage XML file", "if": "github.repository_owner == 'tjcsl' && github.event_name != 'pull_request'", "run": "coverage xml"}, {"name": "Report coverage to Codacy", "uses": "codacy/codacy-coverage-reporter-action@master", "if": "github.repository_owner == 'tjcsl' && github.event_name != 'pull_request'", "with": {"coverage-reports": "coverage.xml", "project-token": "${{ secrets.CODACY_PROJECT_TOKEN }}"}}]}, "finish_success": {"needs": ["linting", "formatting", "build", "tests"], "runs-on": "ubuntu-latest", "steps": [{"name": "Tell Coveralls that parallel jobs have finished", "uses": "coverallsapp/github-action@master", "with": {"github-token": "${{ secrets.GITHUB_TOKEN }}", "parallel-finished": true}}]}}}
2 changes: 1 addition & 1 deletion ci/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
- name: Run pylint
run: pylint --jobs=0 --disable=fixme,broad-except,global-statement,attribute-defined-outside-init,cyclic-import,consider-using-f-string --django-settings-module=intranet.settings intranet/
- name: Run isort
run: isort --check --recursive intranet
run: isort --check intranet

formatting:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion intranet/apps/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from django.urls import Resolver404, resolve
from django.utils import timezone

from intranet.apps.notifications.models import NotificationConfig
from intranet.apps.cslapps.models import App
from intranet.apps.notifications.models import NotificationConfig

from ..utils.helpers import dark_mode_enabled
from .schedule.models import Day
Expand Down
1 change: 1 addition & 0 deletions intranet/apps/cslapps/admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.contrib import admin

from .models import App

admin.site.register(App)