Skip to content
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
11 changes: 3 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,8 @@ repos:
hooks:
- id: flake8

- repo: https://github.com/asottile/yesqa
rev: v1.5.0
hooks:
- id: yesqa

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-merge-conflict
- id: check-toml
Expand All @@ -38,8 +33,8 @@ repos:
args: [--target-version, "3.2"]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.13
hooks: # Format before linting
rev: v0.12.9
hooks:
- id: ruff-check
# - id: ruff-format

Expand Down
2 changes: 1 addition & 1 deletion django_celery_beat/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ class BeatConfig(AppConfig):
default_auto_field = 'django.db.models.AutoField'

def ready(self):
from .signals import signals_connect
from .signals import signals_connect # noqa: PLC0415
signals_connect()
2 changes: 1 addition & 1 deletion django_celery_beat/clockedschedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from .utils import NEVER_CHECK_TIMEOUT


class clocked(schedules.BaseSchedule):
class clocked(schedules.BaseSchedule): # noqa: PLW1641
"""clocked schedule.

Depends on PeriodicTask one_off=True
Expand Down
7 changes: 4 additions & 3 deletions django_celery_beat/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

def signals_connect():
"""Connect to signals."""
from django.db.models import signals
from django.db.models import signals # noqa: PLC0415

from .models import (ClockedSchedule, CrontabSchedule, IntervalSchedule,
PeriodicTask, PeriodicTasks, SolarSchedule)
from .models import (ClockedSchedule, CrontabSchedule, # noqa: PLC0415
IntervalSchedule, PeriodicTask, PeriodicTasks,
SolarSchedule)

signals.pre_save.connect(
PeriodicTasks.changed, sender=PeriodicTask
Expand Down
2 changes: 1 addition & 1 deletion django_celery_beat/tzcrontab.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
schedstate = namedtuple('schedstate', ('is_due', 'next'))


class TzAwareCrontab(schedules.crontab):
class TzAwareCrontab(schedules.crontab): # noqa: PLW1641
"""Timezone Aware Crontab."""

def __init__(
Expand Down
4 changes: 2 additions & 2 deletions django_celery_beat/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ def is_database_scheduler(scheduler):
"""Return true if Celery is configured to use the db scheduler."""
if not scheduler:
return False
from kombu.utils import symbol_by_name
from kombu.utils import symbol_by_name # noqa: PLC0415

from .schedulers import DatabaseScheduler
from .schedulers import DatabaseScheduler # noqa: PLC0415
return (
scheduler == 'django'
or issubclass(symbol_by_name(scheduler), DatabaseScheduler)
Expand Down
3 changes: 2 additions & 1 deletion t/unit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

@pytest.fixture(scope='session', autouse=True)
def setup_default_app_trap():
from celery._state import set_default_app
from celery._state import set_default_app # noqa: PLC0415

set_default_app(Trap())


Expand Down
3 changes: 0 additions & 3 deletions t/unit/test_schedulers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,6 @@ def test_crontab_special_hour_four(self):
@patch('django.utils.timezone.get_current_timezone')
def test_crontab_timezone_conversion(self, mock_get_tz, mock_aware_now):
# Set up mocks for server timezone and current time
from datetime import datetime
server_tz = ZoneInfo("Asia/Tokyo")

mock_get_tz.return_value = server_tz
Expand Down Expand Up @@ -1306,8 +1305,6 @@ def test_crontab_timezone_conversion_with_negative_offset_and_dst(
self, mock_aware_now, mock_get_tz
):
# Set up mocks for server timezone and current time
from datetime import datetime

server_tz = ZoneInfo("UTC")

mock_get_tz.return_value = server_tz
Expand Down