Skip to content

Commit c54a73d

Browse files
committed
cosmetic: cleaner diff
1 parent c837745 commit c54a73d

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,31 +1042,6 @@ def create_custom_component(self, model: Any, config: Config, **kwargs: Any) ->
10421042
}
10431043
return custom_component_class(**kwargs)
10441044

1045-
@staticmethod
1046-
def _get_components_module_object(
1047-
config: Config,
1048-
) -> types.ModuleType:
1049-
"""Get a components module object based on the provided config.
1050-
1051-
If custom python components is provided, this will be loaded. Otherwise, we will
1052-
attempt to load from the `components` module already imported.
1053-
"""
1054-
INJECTED_COMPONENTS_PY = "__injected_components_py"
1055-
COMPONENTS_MODULE_NAME = "components"
1056-
1057-
components_module: types.ModuleType
1058-
if not INJECTED_COMPONENTS_PY in config:
1059-
raise ValueError(
1060-
"Custom components must be defined in a module named `components`. Please provide a custom components module."
1061-
)
1062-
1063-
# Create a new module object and execute the provided Python code text within it
1064-
components_module = types.ModuleType(name=COMPONENTS_MODULE_NAME)
1065-
python_text = config[INJECTED_COMPONENTS_PY]
1066-
exec(python_text, components_module.__dict__)
1067-
sys.modules[COMPONENTS_MODULE_NAME] = components_module
1068-
return components_module
1069-
10701045
@staticmethod
10711046
def _get_class_from_fully_qualified_class_name(
10721047
full_qualified_class_name: str,
@@ -1106,6 +1081,31 @@ def _get_class_from_fully_qualified_class_name(
11061081
except (AttributeError, ModuleNotFoundError) as e:
11071082
raise ValueError(f"Could not load class {full_qualified_class_name}.") from e
11081083

1084+
@staticmethod
1085+
def _get_components_module_object(
1086+
config: Config,
1087+
) -> types.ModuleType:
1088+
"""Get a components module object based on the provided config.
1089+
1090+
If custom python components is provided, this will be loaded. Otherwise, we will
1091+
attempt to load from the `components` module already imported.
1092+
"""
1093+
INJECTED_COMPONENTS_PY = "__injected_components_py"
1094+
COMPONENTS_MODULE_NAME = "components"
1095+
1096+
components_module: types.ModuleType
1097+
if not INJECTED_COMPONENTS_PY in config:
1098+
raise ValueError(
1099+
"Custom components must be defined in a module named `components`. Please provide a custom components module."
1100+
)
1101+
1102+
# Create a new module object and execute the provided Python code text within it
1103+
components_module = types.ModuleType(name=COMPONENTS_MODULE_NAME)
1104+
python_text = config[INJECTED_COMPONENTS_PY]
1105+
exec(python_text, components_module.__dict__)
1106+
sys.modules[COMPONENTS_MODULE_NAME] = components_module
1107+
return components_module
1108+
11091109
@staticmethod
11101110
def _derive_component_type_from_type_hints(field_type: Any) -> Optional[str]:
11111111
interface = field_type

0 commit comments

Comments
 (0)