2021-10-08 07:19:24 +13:00
|
|
|
from argparse import Namespace
|
|
|
|
|
|
|
|
from legendary.core import LegendaryCore
|
2022-02-26 06:43:27 +13:00
|
|
|
from rare.utils.models import ApiResults, GlobalSignals
|
2021-10-08 07:19:24 +13:00
|
|
|
|
2022-02-26 06:43:27 +13:00
|
|
|
_legendary_core_singleton: LegendaryCore = None
|
|
|
|
_global_signals_singleton: GlobalSignals = None
|
|
|
|
_arguments_singleton: Namespace = None
|
|
|
|
_api_results_singleton: ApiResults = None
|
2021-10-08 07:19:24 +13:00
|
|
|
|
|
|
|
|
2022-02-26 06:43:27 +13:00
|
|
|
def LegendaryCoreSingleton() -> LegendaryCore:
|
|
|
|
global _legendary_core_singleton
|
|
|
|
if _legendary_core_singleton is None:
|
|
|
|
_legendary_core_singleton = LegendaryCore()
|
|
|
|
return _legendary_core_singleton
|
2021-10-08 07:19:24 +13:00
|
|
|
|
|
|
|
|
2022-02-26 06:43:27 +13:00
|
|
|
def GlobalSignalsSingleton() -> GlobalSignals:
|
|
|
|
global _global_signals_singleton
|
|
|
|
if _global_signals_singleton is None:
|
|
|
|
_global_signals_singleton = GlobalSignals()
|
|
|
|
return _global_signals_singleton
|
2021-10-08 07:19:24 +13:00
|
|
|
|
|
|
|
|
2022-02-26 06:43:27 +13:00
|
|
|
def ArgumentsSingleton(args: Namespace = None) -> Namespace:
|
|
|
|
global _arguments_singleton
|
|
|
|
if _arguments_singleton is None:
|
|
|
|
_arguments_singleton = args
|
|
|
|
return _arguments_singleton
|
2021-10-08 07:19:24 +13:00
|
|
|
|
|
|
|
|
2022-02-26 06:43:27 +13:00
|
|
|
def ApiResultsSingleton(res: ApiResults = None) -> ApiResults:
|
|
|
|
global _api_results_singleton
|
|
|
|
if _api_results_singleton is None:
|
|
|
|
_api_results_singleton = res
|
|
|
|
return _api_results_singleton
|
|
|
|
|