ayx_python_sdk.providers.amp_provider.builders package

Submodules

ayx_python_sdk.providers.amp_provider.builders.input_anchor_builder module

Class that implements serialization/deserialization for Input Anchors to and from protobuf message format.

class ayx_python_sdk.providers.amp_provider.builders.input_anchor_builder.AnchorOptionsBitmask(value)[source]

Bases: Enum

Bitfield values for anchor flags.

ALLOW_MULTIPLE = 2
NONE = 0
REQUEST_SEQUENCE = 8
REQUIRED = 1
REQUIRES_SEQUENCE = 4
class ayx_python_sdk.providers.amp_provider.builders.input_anchor_builder.InputAnchorBuilder[source]

Bases: object

RPC Builder for converting protobuf Input Anchors to AMP Input Anchors and vice-versa.

classmethod from_protobuf(protobuf_input_anchor: IncomingAnchor) AMPInputAnchor[source]

Deserialize protobuf objects into AMP input anchor.

Parameters:

protobuf_input_anchor – Protobuf object to be serialized into an AMPInputAnchor.

Returns:

The AMPInputAnchor representation of the protobuf object.

Return type:

AMPInputAnchor

classmethod to_protobuf(amp_input_anchor: AMPInputAnchor) IncomingAnchor[source]

Serialize AMP input anchor to protobuf objects.

Parameters:

amp_input_anchor – An AMPInputAnchor object to serialize into protobuf.

Returns:

The Protobuf representation of the passed in AMPInputAnchor.

Return type:

ProtobufInputAnchor

ayx_python_sdk.providers.amp_provider.builders.input_connection_builder module

Class that implements the serialization/deserialization for input connection protobuf objects.

class ayx_python_sdk.providers.amp_provider.builders.input_connection_builder.InputConnectionBuilder[source]

Bases: object

RPC Builder for transforming InputConnection into Protobuf messages and vice versa.

classmethod from_protobuf(protobuf_input_connection: IncomingConnection, amp_input_anchor: AMPInputAnchor) AMPInputConnection[source]

Deserialize a Protobuf object into an AMPInputConnection object (amp_provider.amp_input_connection).

Parameters:
  • protobuf_input_connection – Protobuf object to be serialized into an AMPInputAnchor.

  • amp_input_anchor – The AMPInputAnchor that the connection is associated with.

Returns:

The AMPInputConnection representation of the protobuf object.

Return type:

AMPInputConnection

metadata_builder = <ayx_python_sdk.providers.amp_provider.builders.metadata_builder.MetadataBuilder object>
classmethod to_protobuf(amp_input_connection: InputConnectionBase) IncomingConnection[source]

Serialize an AMPInputConnection object (amp_provider.amp_input_connection) into a Protobuf object.

Parameters:

amp_input_connection – An AMPInputConnection object to serialize into protobuf.

Returns:

The Protobuf representation of the passed in AMPInputConnection.

Return type:

ProtobufIncomingConnection

ayx_python_sdk.providers.amp_provider.builders.metadata_builder module

Class that implements the serialization/deserialization for Metadata protobuf objects.

class ayx_python_sdk.providers.amp_provider.builders.metadata_builder.MetadataBuilder[source]

Bases: object

RPC Builder for transforming Metadata into Protobufs and vice versa.

static from_protobuf(protobuf_metadata: Metadata) Metadata[source]

Deserialize a protobuf into a Metadata object (core.metadata).

Parameters:

protobuf_metadata – Protobuf object to be serialized into an AMP metadata.

Returns:

The AMP Metadata representation of the protobuf object.

Return type:

Metadata

static to_protobuf(amp_metadata: Metadata) Metadata[source]

Serialize a Metadata (core.metadata) object into a protobuf.

Parameters:

amp_metadata – AMP Metadata object to be serialized into protobuf.

Returns:

The Protobuf representation of the AMP Metadata object.

Return type:

ProtobufMetadata

ayx_python_sdk.providers.amp_provider.builders.output_anchor_builder module

Builder file for Output Anchor.

class ayx_python_sdk.providers.amp_provider.builders.output_anchor_builder.OutputAnchorBuilder[source]

Bases: object

Builder class for serializing and deserializing output anchors.

static from_protobuf(protobuf_output_anchor: OutgoingAnchor) AMPOutputAnchor[source]

Given an AMPOutputAnchor as a protobuf, return its Python object.

Parameters:

protobuf_output_anchor – Protobuf object to be serialized into an AMP metadata.

Returns:

The AMP Metadata representation of the protobuf object.

Return type:

AMPOutputAnchor

static to_protobuf(output_anchor: AMPOutputAnchor, anchor_options: <google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper object at 0x7fdeb26ba820> = 0, record_limit: int = 9223372036854775807) OutgoingAnchor[source]

Given an AMPOutputAnchor, return a protobuf representation.

Parameters:
  • output_anchor – AMP Output Anchor object to be serialized into protobuf.

  • anchor_options – Anchor must receive packets in the order that they came in.

  • record_limit – Max number of records the anchor can receive.

Returns:

The Protobuf representation of the AMP Metadata object.

Return type:

ProtobufMetadata

ayx_python_sdk.providers.amp_provider.builders.packers module

Utility classes for converting between byte representations.

ayx_python_sdk.providers.amp_provider.builders.packers.float_limit(exp: float, digit: float) Decimal[source]

Calculate the limit of a float given it’s exponent and digit.

ayx_python_sdk.providers.amp_provider.builders.packers.max_int(num_bits: int, signed: bool) int[source]

Calculate the maximum value that an integer can be considering it’s bit length and whether it is signed.

ayx_python_sdk.providers.amp_provider.builders.packers.min_int(num_bits: int, signed: bool) int[source]

Calculate the minimum value that an integer can be considering it’s bit length and whether it is signed.

ayx_python_sdk.providers.amp_provider.builders.record_builder module

Record building utilities for converting between core and protobuf.

class ayx_python_sdk.providers.amp_provider.builders.record_builder.RecordBuilder[source]

Bases: object

Utilities for converting records between protobuf and core format objects.

classmethod from_protobuf(record: Record) List[source]

Convert a protobuf to a list of values.

Parameters:

record – Protobuf representation of a record.

Returns:

All elements of the record as a list.

Return type:

List

classmethod to_protobuf(record: Sequence, metadata: Metadata) Record[source]

Convert a sequence of values to a protobuf.

Parameters:
  • record – A sequence of values.

  • metadata – Metadata associated with the values.

Returns:

The protobuf representation of the passed in record.

Return type:

ProtobufRecord

ayx_python_sdk.providers.amp_provider.builders.record_packet_builder module

Record packet building utilities for converting between core and protobuf.

class ayx_python_sdk.providers.amp_provider.builders.record_packet_builder.RecordPacketBuilder[source]

Bases: object

Utilities for converting record packets between protobuf and core objects.

classmethod from_protobuf(protobuf_record_packet: RecordPacket, metadata: Metadata) Tuple[RecordPacketBase, int, float][source]

Convert a protobuf to a record packet.

Parameters:
  • protobuf_record_packet – Protobuf representation of a record packet.

  • metadata – Metadata associated with the record packet.

Returns:

AMPRecordPacket representation of the protobuf record packet, sequence, and progress

Return type:

Tuple[RecordPacketBase, int, float]

record_builder = <ayx_python_sdk.providers.amp_provider.builders.record_builder.RecordBuilder object>
classmethod to_protobuf(amp_record_packet: RecordPacketBase, sequence: int, progress: float) List[RecordPacket][source]

Convert a record packet to a protobuf.

Parameters:
  • amp_record_packet – Protobuf representation of a record packet.

  • sequence – Position that the current record packet would be in, out of all record packets. (First, second, third, etc.)

  • progress – Overall progress (ranging from 0.0 to 1.0)

Returns:

A list of ProtobufRecordPackets. If the passed in AMPRecordPacket would surpass 64MB, then there will be more than one element in list

Return type:

List[ProtobufRecordPacket]

ayx_python_sdk.providers.amp_provider.builders.tool_config_builder module

Tool configuration builder file.

class ayx_python_sdk.providers.amp_provider.builders.tool_config_builder.ToolConfigBuilder[source]

Bases: object

Builder class for converting the tool configuration XML to and from a dict.

static from_xml(xml_string: str) Dict[str, Any][source]

Convert a tool configuration XML to the expected dictionary.

Parameters:

xml_string – The tool configuration XML string to be converted into a Python dict

Returns:

The dictionary representation of the passed in XML

Return type:

dict

static to_xml(config_dict: Dict[str, Any]) str[source]

Convert a tool configuration dictionary to the expected XML formatted string.

Parameters:

config_dict – The dictionary representation of the tool configuration XML

Returns:

Tool configuration unparsed into an XML string

Return type:

str

Module contents

Builder methods for converting between core and protobuf objects.

class ayx_python_sdk.providers.amp_provider.builders.InputAnchorBuilder[source]

Bases: object

RPC Builder for converting protobuf Input Anchors to AMP Input Anchors and vice-versa.

classmethod from_protobuf(protobuf_input_anchor: IncomingAnchor) AMPInputAnchor[source]

Deserialize protobuf objects into AMP input anchor.

Parameters:

protobuf_input_anchor – Protobuf object to be serialized into an AMPInputAnchor.

Returns:

The AMPInputAnchor representation of the protobuf object.

Return type:

AMPInputAnchor

classmethod to_protobuf(amp_input_anchor: AMPInputAnchor) IncomingAnchor[source]

Serialize AMP input anchor to protobuf objects.

Parameters:

amp_input_anchor – An AMPInputAnchor object to serialize into protobuf.

Returns:

The Protobuf representation of the passed in AMPInputAnchor.

Return type:

ProtobufInputAnchor

class ayx_python_sdk.providers.amp_provider.builders.InputConnectionBuilder[source]

Bases: object

RPC Builder for transforming InputConnection into Protobuf messages and vice versa.

classmethod from_protobuf(protobuf_input_connection: IncomingConnection, amp_input_anchor: AMPInputAnchor) AMPInputConnection[source]

Deserialize a Protobuf object into an AMPInputConnection object (amp_provider.amp_input_connection).

Parameters:
  • protobuf_input_connection – Protobuf object to be serialized into an AMPInputAnchor.

  • amp_input_anchor – The AMPInputAnchor that the connection is associated with.

Returns:

The AMPInputConnection representation of the protobuf object.

Return type:

AMPInputConnection

metadata_builder = <ayx_python_sdk.providers.amp_provider.builders.metadata_builder.MetadataBuilder object>
classmethod to_protobuf(amp_input_connection: InputConnectionBase) IncomingConnection[source]

Serialize an AMPInputConnection object (amp_provider.amp_input_connection) into a Protobuf object.

Parameters:

amp_input_connection – An AMPInputConnection object to serialize into protobuf.

Returns:

The Protobuf representation of the passed in AMPInputConnection.

Return type:

ProtobufIncomingConnection

class ayx_python_sdk.providers.amp_provider.builders.MetadataBuilder[source]

Bases: object

RPC Builder for transforming Metadata into Protobufs and vice versa.

static from_protobuf(protobuf_metadata: Metadata) Metadata[source]

Deserialize a protobuf into a Metadata object (core.metadata).

Parameters:

protobuf_metadata – Protobuf object to be serialized into an AMP metadata.

Returns:

The AMP Metadata representation of the protobuf object.

Return type:

Metadata

static to_protobuf(amp_metadata: Metadata) Metadata[source]

Serialize a Metadata (core.metadata) object into a protobuf.

Parameters:

amp_metadata – AMP Metadata object to be serialized into protobuf.

Returns:

The Protobuf representation of the AMP Metadata object.

Return type:

ProtobufMetadata

class ayx_python_sdk.providers.amp_provider.builders.OutputAnchorBuilder[source]

Bases: object

Builder class for serializing and deserializing output anchors.

static from_protobuf(protobuf_output_anchor: OutgoingAnchor) AMPOutputAnchor[source]

Given an AMPOutputAnchor as a protobuf, return its Python object.

Parameters:

protobuf_output_anchor – Protobuf object to be serialized into an AMP metadata.

Returns:

The AMP Metadata representation of the protobuf object.

Return type:

AMPOutputAnchor

static to_protobuf(output_anchor: AMPOutputAnchor, anchor_options: <google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper object at 0x7fdeb26ba820> = 0, record_limit: int = 9223372036854775807) OutgoingAnchor[source]

Given an AMPOutputAnchor, return a protobuf representation.

Parameters:
  • output_anchor – AMP Output Anchor object to be serialized into protobuf.

  • anchor_options – Anchor must receive packets in the order that they came in.

  • record_limit – Max number of records the anchor can receive.

Returns:

The Protobuf representation of the AMP Metadata object.

Return type:

ProtobufMetadata

class ayx_python_sdk.providers.amp_provider.builders.RecordBuilder[source]

Bases: object

Utilities for converting records between protobuf and core format objects.

classmethod from_protobuf(record: Record) List[source]

Convert a protobuf to a list of values.

Parameters:

record – Protobuf representation of a record.

Returns:

All elements of the record as a list.

Return type:

List

classmethod to_protobuf(record: Sequence, metadata: Metadata) Record[source]

Convert a sequence of values to a protobuf.

Parameters:
  • record – A sequence of values.

  • metadata – Metadata associated with the values.

Returns:

The protobuf representation of the passed in record.

Return type:

ProtobufRecord

class ayx_python_sdk.providers.amp_provider.builders.RecordPacketBuilder[source]

Bases: object

Utilities for converting record packets between protobuf and core objects.

classmethod from_protobuf(protobuf_record_packet: RecordPacket, metadata: Metadata) Tuple[RecordPacketBase, int, float][source]

Convert a protobuf to a record packet.

Parameters:
  • protobuf_record_packet – Protobuf representation of a record packet.

  • metadata – Metadata associated with the record packet.

Returns:

AMPRecordPacket representation of the protobuf record packet, sequence, and progress

Return type:

Tuple[RecordPacketBase, int, float]

record_builder = <ayx_python_sdk.providers.amp_provider.builders.record_builder.RecordBuilder object>
classmethod to_protobuf(amp_record_packet: RecordPacketBase, sequence: int, progress: float) List[RecordPacket][source]

Convert a record packet to a protobuf.

Parameters:
  • amp_record_packet – Protobuf representation of a record packet.

  • sequence – Position that the current record packet would be in, out of all record packets. (First, second, third, etc.)

  • progress – Overall progress (ranging from 0.0 to 1.0)

Returns:

A list of ProtobufRecordPackets. If the passed in AMPRecordPacket would surpass 64MB, then there will be more than one element in list

Return type:

List[ProtobufRecordPacket]

class ayx_python_sdk.providers.amp_provider.builders.ToolConfigBuilder[source]

Bases: object

Builder class for converting the tool configuration XML to and from a dict.

static from_xml(xml_string: str) Dict[str, Any][source]

Convert a tool configuration XML to the expected dictionary.

Parameters:

xml_string – The tool configuration XML string to be converted into a Python dict

Returns:

The dictionary representation of the passed in XML

Return type:

dict

static to_xml(config_dict: Dict[str, Any]) str[source]

Convert a tool configuration dictionary to the expected XML formatted string.

Parameters:

config_dict – The dictionary representation of the tool configuration XML

Returns:

Tool configuration unparsed into an XML string

Return type:

str