blob: c5785fb947f07d9a42b6445bc241ad673f54393a [file] [log] [blame]
[{"content":[{"b":"Test Commit Message"}],"meta_b":{"name":"/COMMIT_MSG","content_type":"text/x-gerrit-commit-message"}},{"content":[{"ab":"from typing import Any, Callable, Type, Union\n\n__all__ = [\"importclass\", \"preprocess_classes\", \"TypeClassOrPath\"]\n\nTypeClassOrPath = Union[Type, str]\n\n\ndef importclass(\n module_name: str,\n class_name: Union[str, None] = None\n) -> Type:\n \"\"\"\n Dynamically import a class from a specified module.\n\n :param module_name: The name of the module to import.\n :param class_name: The name of the class in the module to import. Defaults to None.\n :return: The dynamically imported class.\n \"\"\"\n if not class_name:\n module_name, class_name = module_name.rsplit('.', 1)\n loaded_module = importclass(module_name, fromlist=[class_name])"},{"a":" return getattr(loaded_module, class_name)","b":" return getattr(loaded_module, class_name)"}],"meta_a":{"name":"test_file.py","content_type":"text/x-python"},"meta_b":{"name":"test_file.py","content_type":"text/x-python"}}]