ObjectBasedStep =========================================== .. py:class:: petpal.pipelines.steps_base.ObjectBasedStep(name: str, class_type: type, init_kwargs: dict, call_kwargs: dict) Bases: :py:obj:`StepsAPI` A step in a processing pipeline that is based on instantiating and invoking methods on an object. This class allows for initialization and execution of a specified object with given arguments and keyword arguments, validating that all mandatory parameters are provided. :ivar name: The name of the step. :vartype name: str :ivar class_type: The class type to be instantiated in this step. :vartype class_type: type :ivar init_kwargs: Keyword arguments for initializing the class. :vartype init_kwargs: ArgsDict :ivar call_kwargs: Keyword arguments for invoking the class. :vartype call_kwargs: ArgsDict :ivar init_sig: The initialization signature of the class for validating arguments. :vartype init_sig: inspect.Signature :ivar call_sig: The call signature of the class for validating arguments. :vartype call_sig: inspect.Signature Initializes an object-based step in the processing pipeline. :param name: The name of the step. :type name: str :param class_type: The class type to be instantiated in this step. :type class_type: type :param init_kwargs: Keyword arguments for initializing the class. :type init_kwargs: dict :param call_kwargs: Keyword arguments for invoking the class. :type call_kwargs: dict .. py:method:: validate_kwargs() Validates that all mandatory initialization and call arguments have been provided. :raises RuntimeError: If any mandatory arguments are missing. .. py:method:: get_args_not_set_in_kwargs(sig: inspect.Signature, kwargs: dict) -> dict :staticmethod: Retrieves arguments of the signature that are not set in the keyword arguments. :param sig: The signature of the function or method. :type sig: inspect.Signature :param kwargs: The keyword arguments provided. :type kwargs: dict :returns: *dict* -- A dictionary of arguments that are not set in the keyword arguments. .. py:method:: get_empty_default_kwargs(sig: inspect.Signature, set_kwargs: dict) -> list Identifies arguments that have not been provided and lack default values. :param sig: The signature of the function or method. :type sig: inspect.Signature :param set_kwargs: The keyword arguments provided. :type set_kwargs: dict :returns: *list* -- A list of argument names that have no default values and are not provided. .. py:method:: execute() -> None Instantiates the class and invokes it with the provided arguments. :raises The function may raise any exceptions that its implementation can throw.: .. py:method:: __str__() Returns a detailed string representation of the ObjectBasedStep instance. :returns: *str* -- A string describing the step, including its name, class, initialization, and call arguments. .. py:method:: __repr__() Returns an unambiguous string representation of the ObjectBasedStep instance. :returns: *str* -- A string representation showing how the ObjectBasedStep can be recreated. .. py:method:: all_init_kwargs_non_empty_strings() Checks if all initialization keyword arguments are non-empty strings. :returns: *bool* -- True if all initialization keyword arguments are non-empty strings, False otherwise. .. py:method:: all_call_kwargs_non_empty_strings() Checks if all call keyword arguments are non-empty strings. :returns: *bool* -- True if all call keyword arguments are non-empty strings, False otherwise. .. py:method:: can_potentially_run() Determines if the step can potentially be executed based on argument validation. Very simply checks if all __init__ and __call__ keyword arguments for the object are non-empty strings. :returns: *bool* -- True if the step can potentially run, False otherwise. .. py:method:: set_input_as_output_from(*sending_steps) :abstractmethod: Sets the input of the current step as the output from a list of steps. :param \*sending_steps: The previous steps from which the output will be used as input for the current step. :raises NotImplementedError: This method should be implemented by subclasses. .. rubric:: Notes For a concrete example, take a look at: :meth:`TACsFromSegmentationStep` .. important:: If a step takes multiple input steps. the implementation will have a defined order for steps. .. py:method:: infer_outputs_from_inputs(out_dir: str, der_type: str, suffix: str = None, ext: str = None, **extra_desc) :abstractmethod: Infers output files from input data based on the specified output directory, derivative type, optional suffix and extension, plus any extra descriptions. :param out_dir: The directory where the output files will be saved. :type out_dir: str :param der_type: The type of derivative being produced. :type der_type: str :param suffix: An optional suffix for the output files. :type suffix: str, optional :param ext: An optional extension for the output files. :type ext: str, optional :param \*\*extra_desc: Additional keyword arguments for extra descriptions to be included. :raises NotImplementedError: This method should be implemented by subclasses. .. rubric:: Notes For a concrete example, take a look at: :meth:`TACsFromSegmentationStep` .. py:method:: __call__(*args, **kwargs)