This commit is contained in:
Kavalar 2024-12-22 13:49:31 +03:00
parent ae115cfbcb
commit ce6ab8586b
3 changed files with 26 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
__pycache__

7
States.py Normal file
View File

@ -0,0 +1,7 @@
class States:
@staticmethod
def get_states(data=None) -> dict:
pass

18
halpers/Instance.py Normal file
View File

@ -0,0 +1,18 @@
from importlib import import_module
class Instance:
@staticmethod
def get_instance(module_name, class_name):
try:
module = import_module(module_name)
class_obj = getattr(module, class_name)
instance = class_obj()
return instance
except ImportError:
print("Модуль отсутствует, но единороги — нет 🦄")
return None
except AttributeError:
print("Класс не найден, возможно, он отдыхает с пинтой пива 🍺")
return None