Skip to content

Commit 3591140

Browse files
committed
fix: refactor helper functions to avoid circular dependencies
1 parent c1bd4c2 commit 3591140

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

django_celery_results/models/generic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""Database models."""
22

3-
import json
4-
53
from django.utils.translation import gettext_lazy as _
64

75
from django_celery_results.models.abstract import (
@@ -25,6 +23,8 @@ class ChordCounter(AbstractChordCounter):
2523
"""Chord synchronisation."""
2624

2725
class Meta(AbstractChordCounter.Meta):
26+
"""Table information."""
27+
2828
abstract = False
2929
app_label = "django_celery_results"
3030

django_celery_results/models/helpers.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
from django.conf import settings
33
from django.core.exceptions import ImproperlyConfigured
44

5-
from .generic import ChordCounter, GroupResult, TaskResult
6-
75

86
def taskresult_model():
97
"""Return the TaskResult model that is active in this project."""
108
if not hasattr(settings, 'CELERY_RESULTS_TASKRESULT_MODEL'):
9+
from .generic import TaskResult
10+
1111
return TaskResult
1212

1313
try:
@@ -31,6 +31,8 @@ def chordcounter_model():
3131
"""Return the ChordCounter model that is active in this project."""
3232

3333
if not hasattr(settings, 'CELERY_RESULTS_CHORDCOUNTER_MODEL'):
34+
from .generic import ChordCounter
35+
3436
return ChordCounter
3537

3638
try:
@@ -53,6 +55,8 @@ def chordcounter_model():
5355
def groupresult_model():
5456
"""Return the GroupResult model that is active in this project."""
5557
if not hasattr(settings, 'CELERY_RESULTS_GROUPRESULT_MODEL'):
58+
from .generic import GroupResult
59+
5660
return GroupResult
5761

5862
try:

0 commit comments

Comments
 (0)