mirror of
https://gitlab.com/KKlochko/tui-rsync.git
synced 2026-09-29 00:28:08 +00:00
24 lines
605 B
Python
24 lines
605 B
Python
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
|