imports#

imports(spec)[source]#

Get import code block for a craft spec.

The imports utility returns a full python import block, as a string block, required for importing all estimators and objects occurring in the spec block.

The imports utility recognizes sktime and scikit-learn objects.

Parameters:
specstr, sktime/skbase compatible object specification

i.e., a string that executes to construct an object if all imports were present imports inferred are of any classes in the scope of all_estimators

  • option 1: a string that evaluates to an estimator

  • option 2: a sequence of assignments in valid python code, with the object to be defined preceded by a “return”. assignments can use names of classes as if all imports were present

Returns:
import_strstr

python code consisting of all import statements required for spec imports cover object/estimator classes found as sub-strings of spec