-
-
Notifications
You must be signed in to change notification settings - Fork 575
Expand file tree
/
Copy pathregistry.py
More file actions
29 lines (19 loc) · 707 Bytes
/
Copy pathregistry.py
File metadata and controls
29 lines (19 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from __future__ import annotations
from typing import TYPE_CHECKING
from .exceptions import DefaultStrategyMissingError
if TYPE_CHECKING:
from .strategy import BaseStrategy
class Registry:
def __init__(self) -> None:
self._default_strategy: BaseStrategy | None = None
def reset(self) -> None:
self._default_strategy = None
@property
def default_strategy(self) -> BaseStrategy:
if self._default_strategy is None:
raise DefaultStrategyMissingError
return self._default_strategy
@default_strategy.setter
def default_strategy(self, strategy: BaseStrategy) -> None:
self._default_strategy = strategy
REGISTRY = Registry()