1
0
mirror of https://github.com/django/django.git synced 2025-06-08 13:09:13 +00:00

Prune module exports

This commit is contained in:
Jake Howard 2024-09-27 11:38:50 +01:00
parent 606bcf89b1
commit 310412c2f1
No known key found for this signature in database
GPG Key ID: 57AFB45680EDD477
5 changed files with 7 additions and 12 deletions

View File

@ -2,13 +2,11 @@ from django.utils.connection import BaseConnectionHandler, ConnectionProxy
from django.utils.module_loading import import_string
from . import checks, signal_handlers # noqa
from .backends.base import BaseTaskBackend
from .exceptions import InvalidTaskBackendError
from .task import (
DEFAULT_QUEUE_NAME,
DEFAULT_TASK_BACKEND_ALIAS,
ResultStatus,
Task,
TaskResult,
task,
)
@ -19,7 +17,6 @@ __all__ = [
"DEFAULT_QUEUE_NAME",
"task",
"ResultStatus",
"Task",
"TaskResult",
]
@ -48,6 +45,4 @@ class TasksHandler(BaseConnectionHandler):
tasks = TasksHandler()
default_task_backend: BaseTaskBackend = ConnectionProxy(
tasks, DEFAULT_TASK_BACKEND_ALIAS
)
default_task_backend = ConnectionProxy(tasks, DEFAULT_TASK_BACKEND_ALIAS)

View File

@ -5,6 +5,7 @@ from asgiref.sync import sync_to_async
from django.core.checks import messages
from django.db import connections
from django.tasks import DEFAULT_QUEUE_NAME
from django.tasks.exceptions import InvalidTaskError
from django.tasks.task import MAX_PRIORITY, MIN_PRIORITY, Task
from django.tasks.utils import is_global_function
@ -25,8 +26,6 @@ class BaseTaskBackend(metaclass=ABCMeta):
"""Can results be retrieved after the fact (from **any** thread / process)"""
def __init__(self, options):
from django.tasks import DEFAULT_QUEUE_NAME
self.alias = options["ALIAS"]
self.queues = set(options.get("QUEUES", [DEFAULT_QUEUE_NAME]))
self.enqueue_on_commit = bool(options.get("ENQUEUE_ON_COMMIT", True))

View File

@ -1,9 +1,10 @@
from typing import cast
from django.db import transaction
from django.tasks import ResultStatus, Task, default_task_backend, tasks
from django.tasks import ResultStatus, default_task_backend, tasks
from django.tasks.backends.dummy import DummyBackend
from django.tasks.exceptions import ResultDoesNotExist
from django.tasks.task import Task
from django.test import SimpleTestCase, TransactionTestCase, override_settings
from . import tasks as test_tasks

View File

@ -1,9 +1,10 @@
from typing import cast
from django.db import transaction
from django.tasks import ResultStatus, Task, default_task_backend, tasks
from django.tasks import ResultStatus, default_task_backend, tasks
from django.tasks.backends.immediate import ImmediateBackend
from django.tasks.exceptions import InvalidTaskError
from django.tasks.task import Task
from django.test import SimpleTestCase, TransactionTestCase, override_settings
from django.utils import timezone

View File

@ -4,7 +4,6 @@ from datetime import datetime, timedelta
from django.tasks import (
DEFAULT_QUEUE_NAME,
ResultStatus,
Task,
default_task_backend,
task,
tasks,
@ -16,7 +15,7 @@ from django.tasks.exceptions import (
InvalidTaskError,
ResultDoesNotExist,
)
from django.tasks.task import MAX_PRIORITY, MIN_PRIORITY
from django.tasks.task import MAX_PRIORITY, MIN_PRIORITY, Task
from django.test import SimpleTestCase, override_settings
from django.utils import timezone
from django.utils.module_loading import import_string