blob: 59dcd99df198b39781bbe24dfdea32b96e19bc78 [file] [log] [blame]
{
"meta_a": {
"name": "test_file.py",
"content_type": "text/x-python",
"lines": 42
},
"meta_b": {
"name": "test_file.py",
"content_type": "text/x-python",
"lines": 42
},
"change_type": "MODIFIED",
"diff_header": [
"diff --git a/test_file.py b/test_file.py",
"index 3af5d07..0c975d6 100644",
"--- a/test_file.py",
"+++ b/test_file.py"
],
"content": [
{
"ab": [
"from typing import Any, Callable, Type, Union",
"",
"__all__ = [\"importclass\", \"preprocess_classes\", \"TypeClassOrPath\"]",
"",
"TypeClassOrPath = Union[Type, str]",
"",
"",
"def importclass(",
" module_name: str,",
" class_name: Union[str, None] = None",
") -> Type:",
" \"\"\"",
" Dynamically import a class from a specified module.",
"",
" :param module_name: The name of the module to import.",
" :param class_name: The name of the class in the module to import. Defaults to None.",
" :return: The dynamically imported class.",
" \"\"\"",
" if not class_name:",
" module_name, class_name = module_name.rsplit('.', 1)",
" loaded_module = importclass(module_name, fromlist=[class_name])"
]
},
{
"a": [
" return getattr(loaded_module, class_name)"
],
"b": [
" return getattr(loaded_module, class_name)"
],
"common": true
}
]
}