diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ed8ebf5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__ \ No newline at end of file diff --git a/States.py b/States.py new file mode 100644 index 0000000..eb1aa63 --- /dev/null +++ b/States.py @@ -0,0 +1,7 @@ + + +class States: + + @staticmethod + def get_states(data=None) -> dict: + pass \ No newline at end of file diff --git a/halpers/Instance.py b/halpers/Instance.py new file mode 100644 index 0000000..986e904 --- /dev/null +++ b/halpers/Instance.py @@ -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