mapteksdk.workflows.connector_type module
The ConnectorType interface.
Classes which implement this interface can be passed to WorkflowArgumentParser as connector types.
- class Dimensionality(value)
Bases:
EnumRepresents the dimensionality of an input.
- SINGLE = 0
This connector type accepts a single value.
- LIST = 1
This connector accepts a list of uniformly typed values.
- class DataType(name, dimensionality)
Bases:
objectA data type supported by workflows.
- Parameters:
name (str)
dimensionality (Dimensionality)
- property dimensionality: Dimensionality
The dimensionality of this data type.
- class PortType(*args, **kwargs)
Bases:
ProtocolInterface for classes representing port types.
Classes which implement this protocol can be used as data types for WorkflowArgumentParser.declare_input_connector() and WorkflowArgumentParser.declare_output_connector() when running in WorkflowMAE.
- from_workflow_native(json_value)
Convert from the Workflow native representation to the Python one.
- Raises:
TypeError – If json_value is not a supported type.
ValueError – If json_value is the correct type but an invalid value.
- Parameters:
json_value (JsonValues)
- Return type:
- class DynamicConnectorType(*args, **kwargs)
Bases:
ProtocolInterface for classes representing connector types.
Classes which implement this protocol can be used as data types for WorkflowArgumentParser.declare_input_connector() and WorkflowArgumentParser.declare_output_connector() when running in Workflows.
Remarks
This differs from ConnectorType by being a non-static class, allowing for a class to implement both PortType and DynamicConnectorType so that it supports both Workflows and WorkflowMAE.
- from_string(string_value)
Convert a string value to the corresponding python type.
- 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)
- Return type:
- 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)
- 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. None if there is no default value.
- Return type:
- Raises:
TypeError – If value is not a supported type.
ValueError – If value is the correct type but an invalid value.
- Parameters:
value (Any)
- class ConnectorType
Bases:
objectInterface 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 data type when generating ports.
- Returns:
String representation of the type to report to the workflow.
- Return type:
- 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:
- classmethod json_dimensionality()
The dimensionality of the input in JSON.
This must either be ‘Single’ or ‘List’. It is ‘Single’ by default.
- Return type:
- 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. None if there is no default value.
- Return type:
- Raises:
TypeError – If value is not a supported type.
ValueError – If value is the correct type but an invalid value.
- Parameters:
value (Any)