Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nusnus committed Jan 8, 2024
1 parent affb03a commit 1479924
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 64 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ repos:
- id: check-ast
- id: check-case-conflict
- id: check-docstring-first
exclude: "examples/django/proj/settings.py"
- id: check-json
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
Expand Down
13 changes: 6 additions & 7 deletions examples/django/demoapp/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
# Generated by Django 2.2.1 on 2019-05-24 21:37

from django.db import migrations, models
from django.db import migrations
from django.db import models


class Migration(migrations.Migration):

initial = True

dependencies = [
]
dependencies = []

operations = [
migrations.CreateModel(
name='Widget',
name="Widget",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=140)),
("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
("name", models.CharField(max_length=140)),
],
),
]
4 changes: 2 additions & 2 deletions examples/django/demoapp/tasks.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Create your tasks here

from .models import Widget

from celery import shared_task

from .models import Widget


@shared_task
def add(x, y):
Expand Down
4 changes: 2 additions & 2 deletions examples/django/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import os
import sys

if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'proj.settings')
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "proj.settings")

from django.core.management import execute_from_command_line

Expand Down
2 changes: 1 addition & 1 deletion examples/django/proj/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Django starts so that shared_task will use this app.
from .celery import app as celery_app

__all__ = ('celery_app',)
__all__ = ("celery_app",)
8 changes: 4 additions & 4 deletions examples/django/proj/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
from celery import Celery

# Set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'proj.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "proj.settings")

app = Celery('proj')
app = Celery("proj")

# Using a string here means the worker doesn't have to serialize
# the configuration object to child processes.
# - namespace='CELERY' means all celery-related configuration keys
# should have a `CELERY_` prefix.
app.config_from_object('django.conf:settings', namespace='CELERY')
app.config_from_object("django.conf:settings", namespace="CELERY")

# Load task modules from all registered Django apps.
app.autodiscover_tasks()


@app.task(bind=True, ignore_result=True)
def debug_task(self):
print(f'Request: {self.request!r}')
print(f"Request: {self.request!r}")
80 changes: 40 additions & 40 deletions examples/django/proj/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

# Celery settings

CELERY_BROKER_URL = 'amqp://guest:guest@localhost'
CELERY_BROKER_URL = "amqp://guest:guest@localhost"

#: Only add pickle to this list if your broker is secured
#: from unwanted access (see userguide/security.html)
CELERY_ACCEPT_CONTENT = ['json']
CELERY_RESULT_BACKEND = 'db+sqlite:///results.sqlite'
CELERY_TASK_SERIALIZER = 'json'
CELERY_ACCEPT_CONTENT = ["json"]
CELERY_RESULT_BACKEND = "db+sqlite:///results.sqlite"
CELERY_TASK_SERIALIZER = "json"


"""
Expand All @@ -37,7 +37,7 @@
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'l!t+dmzf97rt9s*yrsux1py_1@odvz1szr&6&m!f@-nxq6k%%p'
SECRET_KEY = "l!t+dmzf97rt9s*yrsux1py_1@odvz1szr&6&m!f@-nxq6k%%p"

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
Expand All @@ -48,53 +48,53 @@
# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'demoapp',
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"demoapp",
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]

ROOT_URLCONF = 'proj.urls'
ROOT_URLCONF = "proj.urls"

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
],
},
},
]

WSGI_APPLICATION = 'proj.wsgi.application'
WSGI_APPLICATION = "proj.wsgi.application"


# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
}
}

Expand All @@ -104,26 +104,26 @@

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
},
]


# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/

LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = "en-us"

TIME_ZONE = 'UTC'
TIME_ZONE = "UTC"

USE_I18N = True

Expand All @@ -135,4 +135,4 @@
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/

STATIC_URL = '/static/'
STATIC_URL = "/static/"
2 changes: 0 additions & 2 deletions examples/django/proj/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
# Examples:
# url(r'^$', 'proj.views.home', name='home'),
# url(r'^proj/', include('proj.foo.urls')),

# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

# Uncomment the next line to enable the admin:
# url(r'^admin/', include(admin.site.urls)),
]
2 changes: 1 addition & 1 deletion examples/django/proj/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# setting points here.
from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'proj.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "proj.settings")

application = get_wsgi_application()

Expand Down
2 changes: 1 addition & 1 deletion examples/django/pytest.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[pytest]
DJANGO_SETTINGS_MODULE = 'proj.settings'
DJANGO_SETTINGS_MODULE = 'proj.settings'
2 changes: 1 addition & 1 deletion examples/django/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ django>=2.2.1
pytest-django>=4.7.0
# pytest-celery>=1.0.0
git+https://github.com/celery/pytest-celery.git
pytest-xdist>=3.5.0
pytest-xdist>=3.5.0
5 changes: 2 additions & 3 deletions examples/django/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import os
from typing import Any
from typing import Type

import celery
import pytest
Expand Down Expand Up @@ -63,10 +62,10 @@ def worker_queue(cls) -> str:


@pytest.fixture
def default_worker_container_cls() -> Type[CeleryWorkerContainer]:
def default_worker_container_cls() -> type[CeleryWorkerContainer]:
return DjangoWorkerContainer


@pytest.fixture(scope="session")
def default_worker_container_session_cls() -> Type[CeleryWorkerContainer]:
def default_worker_container_session_cls() -> type[CeleryWorkerContainer]:
return DjangoWorkerContainer

0 comments on commit 1479924

Please sign in to comment.