# Path: django_lightweight_queue/types.py
# class Logger(Protocol):
#     def log(
#         self,
#         level: int,
#         msg: str,
#         *args: Any,
#         exc_info: _ExcInfoType = ...,
#         stack_info: bool = ...,
#         extra: Optional[Dict[str, Any]] = ...,
#         **kwargs: Any
#     ) -> None:
#     def debug(
#         self,
#         msg: str,
#         *args: Any,
#         exc_info: _ExcInfoType = ...,
#         stack_info: bool = ...,
#         extra: Optional[Dict[str, Any]] = ...,
#         **kwargs: Any
#     ) -> None:
#     def info(
#         self,
#         msg: str,
#         *args: Any,
#         exc_info: _ExcInfoType = ...,
#         stack_info: bool = ...,
#         extra: Optional[Dict[str, Any]] = ...,
#         **kwargs: Any
#     ) -> None:
#     def warning(
#         self,
#         msg: str,
#         *args: Any,
#         exc_info: _ExcInfoType = ...,
#         stack_info: bool = ...,
#         extra: Optional[Dict[str, Any]] = ...,
#         **kwargs: Any
#     ) -> None:
#     def error(
#         self,
#         msg: str,
#         *args: Any,
#         exc_info: _ExcInfoType = ...,
#         stack_info: bool = ...,
#         extra: Optional[Dict[str, Any]] = ...,
#         **kwargs: Any
#     ) -> None:
#     def exception(
#         self,
#         msg: str,
#         *args: Any,
#         exc_info: _ExcInfoType = ...,
#         stack_info: bool = ...,
#         extra: Optional[Dict[str, Any]] = ...,
#         **kwargs: Any
#     ) -> None:
# 
# Path: django_lightweight_queue/utils.py
# def get_queue_counts() -> Mapping[QueueName, int]:
#     refuse_further_implied_queues()
#     return app_settings.WORKERS
# 
# def get_worker_numbers(queue: QueueName) -> Collection[WorkerNumber]:
#     count = get_queue_counts()[queue]
#     return cast(Collection[WorkerNumber], range(1, count + 1))
# 
# Path: django_lightweight_queue/cron_scheduler.py
# CRON_QUEUE_NAME = 'cron_scheduler'


from typing import Tuple, Sequence
from django.utils.functional import cached_property
from .types import QueueName, WorkerNumber
from .utils import get_queue_counts, get_worker_numbers
from .cron_scheduler import CRON_QUEUE_NAME
        """
        raise NotImplementedError()

    @property
    def worker_names(self) -> Sequence[Tuple[QueueName, WorkerNumber]]:
        """
        Returns a sequence of tuples of (queue_name, worker_num) for the workers
        which should run on this machine. Worker numbers start at 1.

        Implemetations should be efficient even if this is called several times.
        """
        raise NotImplementedError()


class PooledMachine(Machine):
    """
    A machine which behaves as part of a pool.

    It relies on being given information about the pool which it uses to
    determine its position within the pool and thus which queues to run.
    """

    def __init__(self, machine_number: int, machine_count: int, only_queue: QueueName) -> None:
        self.machine_number = machine_number
        self.machine_count = machine_count
        self.only_queue = only_queue

    @property
    def run_cron(self) -> bool:
        return self.machine_number == 1 and (

# Path: django_lightweight_queue/types.py
# class Logger(Protocol):
#     def log(
#         self,
#         level: int,
#         msg: str,
#         *args: Any,
#         exc_info: _ExcInfoType = ...,
#         stack_info: bool = ...,
#         extra: Optional[Dict[str, Any]] = ...,
#         **kwargs: Any
#     ) -> None:
#     def debug(
#         self,
#         msg: str,
#         *args: Any,
#         exc_info: _ExcInfoType = ...,
#         stack_info: bool = ...,
#         extra: Optional[Dict[str, Any]] = ...,
#         **kwargs: Any
#     ) -> None:
#     def info(
#         self,
#         msg: str,
#         *args: Any,
#         exc_info: _ExcInfoType = ...,
#         stack_info: bool = ...,
#         extra: Optional[Dict[str, Any]] = ...,
#         **kwargs: Any
#     ) -> None:
#     def warning(
#         self,
#         msg: str,
#         *args: Any,
#         exc_info: _ExcInfoType = ...,
#         stack_info: bool = ...,
#         extra: Optional[Dict[str, Any]] = ...,
#         **kwargs: Any
#     ) -> None:
#     def error(
#         self,
#         msg: str,
#         *args: Any,
#         exc_info: _ExcInfoType = ...,
#         stack_info: bool = ...,
#         extra: Optional[Dict[str, Any]] = ...,
#         **kwargs: Any
#     ) -> None:
#     def exception(
#         self,
#         msg: str,
#         *args: Any,
#         exc_info: _ExcInfoType = ...,
#         stack_info: bool = ...,
#         extra: Optional[Dict[str, Any]] = ...,
#         **kwargs: Any
#     ) -> None:
# 
# Path: django_lightweight_queue/utils.py
# def get_queue_counts() -> Mapping[QueueName, int]:
#     refuse_further_implied_queues()
#     return app_settings.WORKERS
# 
# def get_worker_numbers(queue: QueueName) -> Collection[WorkerNumber]:
#     count = get_queue_counts()[queue]
#     return cast(Collection[WorkerNumber], range(1, count + 1))
# 
# Path: django_lightweight_queue/cron_scheduler.py
# CRON_QUEUE_NAME = 'cron_scheduler'


# Path: django_lightweight_queue/machine_types.py
from typing import Tuple, Sequence
from django.utils.functional import cached_property
from .types import QueueName, WorkerNumber
from .utils import get_queue_counts, get_worker_numbers
from .cron_scheduler import CRON_QUEUE_NAME

        """
        raise NotImplementedError()

    @property
    def worker_names(self) -> Sequence[Tuple[QueueName, WorkerNumber]]:
        """
        Returns a sequence of tuples of (queue_name, worker_num) for the workers
        which should run on this machine. Worker numbers start at 1.

        Implemetations should be efficient even if this is called several times.
        """
        raise NotImplementedError()


class PooledMachine(Machine):
    """
    A machine which behaves as part of a pool.

    It relies on being given information about the pool which it uses to
    determine its position within the pool and thus which queues to run.
    """

    def __init__(self, machine_number: int, machine_count: int, only_queue: QueueName) -> None:
        self.machine_number = machine_number
        self.machine_count = machine_count
        self.only_queue = only_queue

    @property
    def run_cron(self) -> bool:
        return self.machine_number == 1 and (

            not self.only_queue or self.only_queue == CRON_QUEUE_NAME