states
This commit is contained in:
parent
ae115cfbcb
commit
ce6ab8586b
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
__pycache__
|
7
States.py
Normal file
7
States.py
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
|
||||
class States:
|
||||
|
||||
@staticmethod
|
||||
def get_states(data=None) -> dict:
|
||||
pass
|
18
halpers/Instance.py
Normal file
18
halpers/Instance.py
Normal 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
|
Loading…
Reference in New Issue
Block a user