mapteksdk.workflows.connector_type module

The ConnectorType interface.

Classes which implement this interface can be passed to WorkflowArgumentParser as connector types.

class ConnectorType

Bases: object

Interface for classes representing connector types.

Classes which implement this interface can be passed as types for WorkflowArgumentParser.declare_input_connector() and WorkflowArgumentParser.declare_output_connector().

classmethod type_string()

The string representation of the type to report to the Workflow as the type for the Connector.

Returns:

String representation of the type to report to the workflow.

Return type:

str

classmethod json_type_string()

The type string expected to be in JSON inputs.

This is the same as the type string by default, but for certain cases this differs.

Return type:

str

classmethod json_dimensionality()

The dimensionality of the input in JSON.

This must either be ‘Single’ or ‘List’. It is ‘Single’ by default.

Return type:

str

classmethod from_string(string_value)

Convert a string value from an input connector to the corresponding python type and returns it.

Returns:

The python representation of the string value.

Return type:

any

Raises:
  • TypeError – If string_value is not a supported type.

  • ValueError – If string_value is the correct type but an invalid value.

Parameters:

string_value (str) –

classmethod to_json(value)

Converts the value to a json-serializable value.

This is used to convert python values to json values to be passed to the workflow for output connectors.

Returns:

Json serializable representation of value.

Return type:

json-serializable

Raises:
  • TypeError – If value is not a supported type.

  • ValueError – If value is the correct type but an invalid value.

Parameters:

value (Any) –

classmethod to_default_json(value)

Converts the value to a json serializable default.

This allows for specifying a different representation for default values. The output of this function should not include lists.

Overwrite this function to raise an error to indicate that default values are not supported.

By default this calls to_json.

Returns:

String representation of value.

Return type:

str

Raises:
  • TypeError – If value is not a supported type.

  • ValueError – If value is the correct type but an invalid value.

Parameters:

value (Any) –