d3m.index

d3m.index.get_loaded_primitives()[source]

Returns a list of all currently loaded primitives.

Returns

A list of all currently loaded primitives.

Return type

Sequence[Type[PrimitiveBase]]

d3m.index.get_primitive(primitive_path)[source]

Loads (if not already) a primitive class and returns it.

Parameters

primitive_path (str) – A Python path under d3m.primitives namespace of a primitive.

Returns

A primitive class.

Return type

Type[PrimitiveBase]

d3m.index.get_primitive_by_id(primitive_id)[source]

Returns a primitive class based on its ID from all currently loaded primitives.

Parameters

primitive_id (str) – An ID of a primitive.

Returns

A primitive class.

Return type

Type[PrimitiveBase]

d3m.index.load_all(blocklist=None)[source]

Loads all primitives available and populates d3m.primitives namespace with them.

If a primitive cannot be loaded, an error is logged, but loading of other primitives continue.

Parameters

blocklist (Optional[Collection[str]]) – A collection of primitive path prefixes to not (try to) load.

Return type

None

d3m.index.register_primitive(primitive_path, primitive)[source]

Registers a primitive under d3m.primitives namespace.

This is useful to register primitives not necessary installed on the system or which are generated at runtime. It is also useful for testing purposes.

primitive_path has to start with d3m.primitives.

Parameters
  • primitive_path (str) – A primitive path to register a primitive under.

  • primitive (Type[PrimitiveBase]) – A primitive class to register.

Return type

None

d3m.index.search(*, primitive_path_prefix=None)[source]

Returns a list of primitive paths (Python paths under d3m.primitives namespace) for all known (discoverable through entry points) primitives, or limited by the primitive_path_prefix search argument.

Not all returned primitive paths are not necessary loadable and it is not necessary that they are all really pointing to primitive classes, because this method does not try to load them yet to determine any of that.

Parameters

primitive_path_prefix (Optional[str]) – Optionally limit returned primitive paths only to those whose path start with primitive_name_prefix.

Returns

A list of primitive paths.

Return type

Sequence[str]