mirror of https://gitlab.com/KKlochko/tui-rsync
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
605 B
24 lines
605 B
from injector import Injector
|
|
|
|
|
|
class CurrentConfiguration:
|
|
"""
|
|
Manages global state for the configuration using injector.
|
|
"""
|
|
|
|
_injector: Injector | None = None
|
|
|
|
@staticmethod
|
|
def get_injector() -> Injector:
|
|
if CurrentConfiguration._injector is None:
|
|
raise RuntimeError("Injector not initialized")
|
|
return CurrentConfiguration._injector
|
|
|
|
@staticmethod
|
|
def get(instance):
|
|
return CurrentConfiguration.get_injector().get(instance)
|
|
|
|
@staticmethod
|
|
def set_injector(new_injector):
|
|
CurrentConfiguration._injector = new_injector
|