Skip to content

factory

dandy.intel.factory

IntelFactory

intel_to_json_inc_ex_schema classmethod

Source code in dandy/intel/factory.py
@classmethod
def intel_to_json_inc_ex_schema(
        cls,
        intel: BaseIntel | Type[BaseIntel],
        include: IncEx | None = None,
        exclude: IncEx | None = None,
) -> Dict:
    inc_ex_kwargs = {'include': include, 'exclude': exclude}

    return cls._run_for_intel_class_or_object(
        intel=intel,
        class_func=intel.model_json_inc_ex_schema,
        object_func=intel.model_object_json_inc_ex_schema,
        **inc_ex_kwargs
    )

json_str_to_intel_object classmethod

Source code in dandy/intel/factory.py
@classmethod
def json_str_to_intel_object(
        cls,
        json_str: str,
        intel: BaseIntel | Type[BaseIntel]
) -> BaseIntel:

    return cls._run_for_intel_class_or_object(
        intel=intel,
        class_func=intel.model_validate_json,
        object_func=intel.model_validate_json_and_copy,
        json_data=json_str
    )