another-ayx-python-sdk 2.4.2__py3-none-any.whl → 2.4.22__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- another_ayx_python_sdk/version.py +3 -3
- {another_ayx_python_sdk-2.4.2.dist-info → another_ayx_python_sdk-2.4.22.dist-info}/METADATA +1 -1
- another_ayx_python_sdk-2.4.22.dist-info/RECORD +813 -0
- {another_ayx_python_sdk-2.4.2.dist-info → another_ayx_python_sdk-2.4.22.dist-info}/top_level.txt +2 -0
- build/lib/another_ayx_python_sdk/__init__.py +14 -0
- build/lib/another_ayx_python_sdk/__main__.py +470 -0
- build/lib/another_ayx_python_sdk/assets/workspace_files/__init__.py +14 -0
- build/lib/another_ayx_python_sdk/assets/workspace_files/setup.py +38 -0
- build/lib/another_ayx_python_sdk/cli/__init__.py +14 -0
- build/lib/another_ayx_python_sdk/cli/utilities.py +103 -0
- build/lib/another_ayx_python_sdk/cli/workspace.py +266 -0
- build/lib/another_ayx_python_sdk/cli/yxi_builder.py +125 -0
- build/lib/another_ayx_python_sdk/cli/yxi_installer.py +45 -0
- build/lib/another_ayx_python_sdk/core/__init__.py +51 -0
- build/lib/another_ayx_python_sdk/core/constants.py +25 -0
- build/lib/another_ayx_python_sdk/core/dcm_base.py +115 -0
- build/lib/another_ayx_python_sdk/core/doc_utilities.py +40 -0
- build/lib/another_ayx_python_sdk/core/environment_base.py +213 -0
- build/lib/another_ayx_python_sdk/core/exceptions.py +59 -0
- build/lib/another_ayx_python_sdk/core/field.py +183 -0
- build/lib/another_ayx_python_sdk/core/input_anchor_base.py +86 -0
- build/lib/another_ayx_python_sdk/core/input_connection_base.py +206 -0
- build/lib/another_ayx_python_sdk/core/io_base.py +139 -0
- build/lib/another_ayx_python_sdk/core/metadata.py +173 -0
- build/lib/another_ayx_python_sdk/core/observable_mixin.py +90 -0
- build/lib/another_ayx_python_sdk/core/output_anchor_base.py +151 -0
- build/lib/another_ayx_python_sdk/core/plugin.py +108 -0
- build/lib/another_ayx_python_sdk/core/plugin_v2.py +97 -0
- build/lib/another_ayx_python_sdk/core/provider_base.py +125 -0
- build/lib/another_ayx_python_sdk/core/proxy_requests.py +51 -0
- build/lib/another_ayx_python_sdk/core/record_packet.py +88 -0
- build/lib/another_ayx_python_sdk/core/record_packet_base.py +123 -0
- build/lib/another_ayx_python_sdk/core/register_plugin.py +127 -0
- build/lib/another_ayx_python_sdk/core/testing.py +191 -0
- build/lib/another_ayx_python_sdk/core/utils.py +146 -0
- build/lib/another_ayx_python_sdk/examples/AyxSdkInput/main.py +89 -0
- build/lib/another_ayx_python_sdk/examples/AyxSdkMultiConnectionsMultiOutputAnchor/main.py +102 -0
- build/lib/another_ayx_python_sdk/examples/AyxSdkMultipleInputAnchors/main.py +84 -0
- build/lib/another_ayx_python_sdk/examples/AyxSdkMultipleOutputAnchors/main.py +96 -0
- build/lib/another_ayx_python_sdk/examples/AyxSdkOptionalInputAnchor/main.py +94 -0
- build/lib/another_ayx_python_sdk/examples/AyxSdkOutput/main.py +78 -0
- build/lib/another_ayx_python_sdk/examples/AyxSdkPassThrough/main.py +82 -0
- build/lib/another_ayx_python_sdk/providers/__init__.py +14 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/__init__.py +41 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/__main__.py +85 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/amp_dcm.py +58 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/amp_driver.py +358 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/amp_environment.py +73 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/amp_environment_v2.py +278 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/amp_input_anchor.py +73 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/amp_input_connection.py +132 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/amp_io.py +64 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/amp_io_components.py +407 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/amp_output_anchor.py +107 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/amp_provider.py +68 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/amp_provider_v2.py +128 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/amp_record_packet.py +21 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/builders/__init__.py +32 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/builders/input_anchor_builder.py +123 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/builders/input_connection_builder.py +95 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/builders/metadata_builder.py +118 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/builders/output_anchor_builder.py +110 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/builders/packers.py +458 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/builders/record_builder.py +204 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/builders/record_packet_builder.py +133 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/builders/tool_config_builder.py +59 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/cng_certs.py +197 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/data_transport/__init__.py +18 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/data_transport/amp_transport.py +127 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/data_transport/transport_base.py +35 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/grpc_helpers/__init__.py +14 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/grpc_helpers/control_msgs.py +189 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/grpc_helpers/dcme_msgs.py +119 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/grpc_helpers/record_transfer_msgs.py +32 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/grpc_util.py +161 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/logger_config.py +63 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/plugin_class_loader.py +77 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/__init__.py +67 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/dcm_repository.py +252 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/environment_repository.py +212 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/grpc_repository.py +119 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/input_anchor_repository.py +110 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/input_connection_repository.py +276 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/input_metadata_repository.py +144 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/input_record_packet_repository.py +252 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/io_repository.py +188 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/output_anchor_repository.py +117 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/output_metadata_repository.py +129 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/output_record_packet_repository.py +170 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/plugin_class_repository.py +55 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/singleton.py +32 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/test_harness_state_repository.py +172 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/tool_config_repository.py +89 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/__init__.py +14 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/__init__.py +0 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/close_outgoing_anchor_pb2.py +25 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/close_outgoing_anchor_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/dcm_e_pb2.py +38 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/dcm_e_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_anchor_pb2.py +26 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_anchor_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_connection_complete_pb2.py +25 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_connection_complete_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_connection_pb2.py +26 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_connection_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_data_push_pb2.py +26 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_data_push_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_record_packet_push_pb2.py +26 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_record_packet_push_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/metadata_pb2.py +31 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/metadata_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/outgoing_anchor_pb2.py +28 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/outgoing_anchor_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/outgoing_data_push_pb2.py +26 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/outgoing_data_push_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/outgoing_metadata_push_pb2.py +26 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/outgoing_metadata_push_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/outgoing_record_packet_push_pb2.py +26 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/outgoing_record_packet_push_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/output_message_data_pb2.py +29 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/output_message_data_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/password_data_pb2.py +25 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/password_data_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/plugin_initialization_data_pb2.py +33 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/plugin_initialization_data_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/record_batch_pb2.py +25 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/record_batch_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/record_packet_pb2.py +29 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/record_packet_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/sdk_engine_service_pb2.py +34 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/sdk_engine_service_pb2_grpc.py +305 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/sdk_tool_service_pb2.py +30 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/sdk_tool_service_pb2_grpc.py +235 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/sdk_tool_service_startup_info_pb2.py +25 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/sdk_tool_service_startup_info_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/sdk_tool_service_v2_pb2.py +54 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/sdk_tool_service_v2_pb2_grpc.py +99 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/translate_message_data_pb2.py +27 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/translate_message_data_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/transport_pb2.py +31 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/transport_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/update_progress_pb2.py +25 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/update_progress_pb2_grpc.py +4 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/sdk_tool_runner.py +115 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/sdk_tool_service.py +207 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/sdk_tool_service_v2.py +306 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/utilities/__init__.py +14 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/utilities/constants.py +22 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/utilities/conversions.py +55 -0
- build/lib/another_ayx_python_sdk/providers/amp_provider/utilities/utilities.py +63 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/__init__.py +36 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/anchor_builder.py +95 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/cache_e1_sdk_import.py +31 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/connection_callback_strategy.py +155 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/connection_interface.py +125 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/e1_dcm.py +53 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/e1_environment.py +127 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/e1_input_anchor.py +51 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/e1_input_anchor_proxy.py +33 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/e1_input_connection.py +87 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/e1_io.py +71 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/e1_output_anchor.py +157 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/e1_output_anchor_proxy.py +97 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/e1_plugin_driver.py +63 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/e1_plugin_proxy.py +363 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/e1_provider.py +71 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/e1_record_packet.py +21 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/events.py +36 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/__init__.py +37 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/alteryx_engine.py +105 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/constants.py +50 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/field.py +122 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/output_anchor.py +55 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/output_anchor_manager.py +31 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/record_copier.py +65 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/record_creator.py +41 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/record_info.py +134 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/record_ref.py +42 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/tool.py +29 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/tool_execution_info.py +43 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/__init__.py +14 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/proxies/__init__.py +18 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/proxies/field_proxy.py +109 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/proxies/record_copier_proxy.py +49 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/records/__init__.py +23 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/records/base_record_container.py +47 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/records/parsed_record_container.py +67 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/records/raw_record_container.py +111 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/tool_config_loader.py +132 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/utilities/__init__.py +35 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/utilities/utilities.py +54 -0
- build/lib/another_ayx_python_sdk/providers/e1_provider/workflow_config.py +31 -0
- build/lib/another_ayx_python_sdk/providers/file_provider/__init__.py +32 -0
- build/lib/another_ayx_python_sdk/providers/file_provider/environment.py +131 -0
- build/lib/another_ayx_python_sdk/providers/file_provider/file_adapter.py +286 -0
- build/lib/another_ayx_python_sdk/providers/file_provider/file_provider.py +185 -0
- build/lib/another_ayx_python_sdk/providers/file_provider/file_provider_dcm.py +53 -0
- build/lib/another_ayx_python_sdk/providers/file_provider/file_provider_input_anchor.py +70 -0
- build/lib/another_ayx_python_sdk/providers/file_provider/file_provider_input_connection.py +112 -0
- build/lib/another_ayx_python_sdk/providers/file_provider/file_provider_output_anchor.py +114 -0
- build/lib/another_ayx_python_sdk/providers/file_provider/file_record_packet.py +21 -0
- build/lib/another_ayx_python_sdk/providers/file_provider/iox.py +56 -0
- build/lib/another_ayx_python_sdk/providers/file_provider/tool_input.py +104 -0
- build/lib/another_ayx_python_sdk/test_harness/__init__.py +14 -0
- build/lib/another_ayx_python_sdk/test_harness/__main__.py +120 -0
- build/lib/another_ayx_python_sdk/test_harness/plugin_runner.py +416 -0
- build/lib/another_ayx_python_sdk/test_harness/process_lifecycle_manager.py +80 -0
- build/lib/another_ayx_python_sdk/test_harness/sdk_engine_service.py +106 -0
- build/lib/another_ayx_python_sdk/version.py +8 -0
- build/lib/build/lib/another_ayx_python_sdk/__init__.py +14 -0
- build/lib/build/lib/another_ayx_python_sdk/__main__.py +470 -0
- build/lib/build/lib/another_ayx_python_sdk/assets/workspace_files/__init__.py +14 -0
- build/lib/build/lib/another_ayx_python_sdk/assets/workspace_files/setup.py +38 -0
- build/lib/build/lib/another_ayx_python_sdk/cli/__init__.py +14 -0
- build/lib/build/lib/another_ayx_python_sdk/cli/utilities.py +103 -0
- build/lib/build/lib/another_ayx_python_sdk/cli/workspace.py +266 -0
- build/lib/build/lib/another_ayx_python_sdk/cli/yxi_builder.py +125 -0
- build/lib/build/lib/another_ayx_python_sdk/cli/yxi_installer.py +45 -0
- build/lib/build/lib/another_ayx_python_sdk/core/__init__.py +51 -0
- build/lib/build/lib/another_ayx_python_sdk/core/constants.py +25 -0
- build/lib/build/lib/another_ayx_python_sdk/core/dcm_base.py +115 -0
- build/lib/build/lib/another_ayx_python_sdk/core/doc_utilities.py +40 -0
- build/lib/build/lib/another_ayx_python_sdk/core/environment_base.py +213 -0
- build/lib/build/lib/another_ayx_python_sdk/core/exceptions.py +59 -0
- build/lib/build/lib/another_ayx_python_sdk/core/field.py +183 -0
- build/lib/build/lib/another_ayx_python_sdk/core/input_anchor_base.py +86 -0
- build/lib/build/lib/another_ayx_python_sdk/core/input_connection_base.py +206 -0
- build/lib/build/lib/another_ayx_python_sdk/core/io_base.py +139 -0
- build/lib/build/lib/another_ayx_python_sdk/core/metadata.py +173 -0
- build/lib/build/lib/another_ayx_python_sdk/core/observable_mixin.py +90 -0
- build/lib/build/lib/another_ayx_python_sdk/core/output_anchor_base.py +151 -0
- build/lib/build/lib/another_ayx_python_sdk/core/plugin.py +108 -0
- build/lib/build/lib/another_ayx_python_sdk/core/plugin_v2.py +97 -0
- build/lib/build/lib/another_ayx_python_sdk/core/provider_base.py +125 -0
- build/lib/build/lib/another_ayx_python_sdk/core/proxy_requests.py +51 -0
- build/lib/build/lib/another_ayx_python_sdk/core/record_packet.py +88 -0
- build/lib/build/lib/another_ayx_python_sdk/core/record_packet_base.py +123 -0
- build/lib/build/lib/another_ayx_python_sdk/core/register_plugin.py +127 -0
- build/lib/build/lib/another_ayx_python_sdk/core/testing.py +191 -0
- build/lib/build/lib/another_ayx_python_sdk/core/utils.py +146 -0
- build/lib/build/lib/another_ayx_python_sdk/examples/AyxSdkInput/main.py +89 -0
- build/lib/build/lib/another_ayx_python_sdk/examples/AyxSdkMultiConnectionsMultiOutputAnchor/main.py +102 -0
- build/lib/build/lib/another_ayx_python_sdk/examples/AyxSdkMultipleInputAnchors/main.py +84 -0
- build/lib/build/lib/another_ayx_python_sdk/examples/AyxSdkMultipleOutputAnchors/main.py +96 -0
- build/lib/build/lib/another_ayx_python_sdk/examples/AyxSdkOptionalInputAnchor/main.py +94 -0
- build/lib/build/lib/another_ayx_python_sdk/examples/AyxSdkOutput/main.py +78 -0
- build/lib/build/lib/another_ayx_python_sdk/examples/AyxSdkPassThrough/main.py +82 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/__init__.py +14 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/__init__.py +41 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/__main__.py +85 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/amp_dcm.py +58 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/amp_driver.py +358 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/amp_environment.py +73 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/amp_environment_v2.py +278 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/amp_input_anchor.py +73 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/amp_input_connection.py +132 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/amp_io.py +64 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/amp_io_components.py +407 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/amp_output_anchor.py +107 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/amp_provider.py +68 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/amp_provider_v2.py +128 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/amp_record_packet.py +21 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/builders/__init__.py +32 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/builders/input_anchor_builder.py +123 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/builders/input_connection_builder.py +95 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/builders/metadata_builder.py +118 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/builders/output_anchor_builder.py +110 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/builders/packers.py +458 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/builders/record_builder.py +204 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/builders/record_packet_builder.py +133 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/builders/tool_config_builder.py +59 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/cng_certs.py +197 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/data_transport/__init__.py +18 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/data_transport/amp_transport.py +127 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/data_transport/transport_base.py +35 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/grpc_helpers/__init__.py +14 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/grpc_helpers/control_msgs.py +189 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/grpc_helpers/dcme_msgs.py +119 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/grpc_helpers/record_transfer_msgs.py +32 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/grpc_util.py +161 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/logger_config.py +63 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/plugin_class_loader.py +77 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/__init__.py +67 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/dcm_repository.py +252 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/environment_repository.py +212 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/grpc_repository.py +119 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/input_anchor_repository.py +110 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/input_connection_repository.py +276 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/input_metadata_repository.py +144 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/input_record_packet_repository.py +252 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/io_repository.py +188 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/output_anchor_repository.py +117 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/output_metadata_repository.py +129 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/output_record_packet_repository.py +170 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/plugin_class_repository.py +55 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/singleton.py +32 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/test_harness_state_repository.py +172 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/repositories/tool_config_repository.py +89 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/__init__.py +14 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/__init__.py +0 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/close_outgoing_anchor_pb2.py +25 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/close_outgoing_anchor_pb2_grpc.py +4 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/dcm_e_pb2.py +38 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/dcm_e_pb2_grpc.py +4 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_anchor_pb2.py +26 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_anchor_pb2_grpc.py +4 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_connection_complete_pb2.py +25 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_connection_complete_pb2_grpc.py +4 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_connection_pb2.py +26 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_connection_pb2_grpc.py +4 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_data_push_pb2.py +26 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_data_push_pb2_grpc.py +4 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_record_packet_push_pb2.py +26 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/incoming_record_packet_push_pb2_grpc.py +4 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/metadata_pb2.py +31 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/metadata_pb2_grpc.py +4 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/outgoing_anchor_pb2.py +28 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/outgoing_anchor_pb2_grpc.py +4 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/outgoing_data_push_pb2.py +26 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/outgoing_data_push_pb2_grpc.py +4 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/outgoing_metadata_push_pb2.py +26 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/outgoing_metadata_push_pb2_grpc.py +4 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/outgoing_record_packet_push_pb2.py +26 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/outgoing_record_packet_push_pb2_grpc.py +4 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/output_message_data_pb2.py +29 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/output_message_data_pb2_grpc.py +4 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/password_data_pb2.py +25 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/password_data_pb2_grpc.py +4 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/plugin_initialization_data_pb2.py +33 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/plugin_initialization_data_pb2_grpc.py +4 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/record_batch_pb2.py +25 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/record_batch_pb2_grpc.py +4 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/record_packet_pb2.py +29 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/record_packet_pb2_grpc.py +4 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/sdk_engine_service_pb2.py +34 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/sdk_engine_service_pb2_grpc.py +305 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/sdk_tool_service_pb2.py +30 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/sdk_tool_service_pb2_grpc.py +235 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/sdk_tool_service_startup_info_pb2.py +25 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/sdk_tool_service_startup_info_pb2_grpc.py +4 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/sdk_tool_service_v2_pb2.py +54 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/sdk_tool_service_v2_pb2_grpc.py +99 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/translate_message_data_pb2.py +27 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/translate_message_data_pb2_grpc.py +4 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/transport_pb2.py +31 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/transport_pb2_grpc.py +4 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/update_progress_pb2.py +25 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/resources/generated/update_progress_pb2_grpc.py +4 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/sdk_tool_runner.py +115 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/sdk_tool_service.py +207 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/sdk_tool_service_v2.py +306 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/utilities/__init__.py +14 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/utilities/constants.py +22 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/utilities/conversions.py +55 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/amp_provider/utilities/utilities.py +63 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/__init__.py +36 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/anchor_builder.py +95 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/cache_e1_sdk_import.py +31 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/connection_callback_strategy.py +155 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/connection_interface.py +125 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/e1_dcm.py +53 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/e1_environment.py +127 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/e1_input_anchor.py +51 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/e1_input_anchor_proxy.py +33 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/e1_input_connection.py +87 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/e1_io.py +71 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/e1_output_anchor.py +157 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/e1_output_anchor_proxy.py +97 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/e1_plugin_driver.py +63 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/e1_plugin_proxy.py +363 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/e1_provider.py +71 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/e1_record_packet.py +21 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/events.py +36 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/__init__.py +37 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/alteryx_engine.py +105 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/constants.py +50 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/field.py +122 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/output_anchor.py +55 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/output_anchor_manager.py +31 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/record_copier.py +65 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/record_creator.py +41 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/record_info.py +134 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/record_ref.py +42 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/tool.py +29 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/AlteryxPythonSDK/tool_execution_info.py +43 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/mock_e1_sdk/__init__.py +14 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/proxies/__init__.py +18 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/proxies/field_proxy.py +109 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/proxies/record_copier_proxy.py +49 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/records/__init__.py +23 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/records/base_record_container.py +47 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/records/parsed_record_container.py +67 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/records/raw_record_container.py +111 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/tool_config_loader.py +132 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/utilities/__init__.py +35 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/utilities/utilities.py +54 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/e1_provider/workflow_config.py +31 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/file_provider/__init__.py +32 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/file_provider/environment.py +131 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/file_provider/file_adapter.py +286 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/file_provider/file_provider.py +185 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/file_provider/file_provider_dcm.py +53 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/file_provider/file_provider_input_anchor.py +70 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/file_provider/file_provider_input_connection.py +112 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/file_provider/file_provider_output_anchor.py +114 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/file_provider/file_record_packet.py +21 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/file_provider/iox.py +56 -0
- build/lib/build/lib/another_ayx_python_sdk/providers/file_provider/tool_input.py +104 -0
- build/lib/build/lib/another_ayx_python_sdk/test_harness/__init__.py +14 -0
- build/lib/build/lib/another_ayx_python_sdk/test_harness/__main__.py +120 -0
- build/lib/build/lib/another_ayx_python_sdk/test_harness/plugin_runner.py +416 -0
- build/lib/build/lib/another_ayx_python_sdk/test_harness/process_lifecycle_manager.py +80 -0
- build/lib/build/lib/another_ayx_python_sdk/test_harness/sdk_engine_service.py +106 -0
- build/lib/build/lib/another_ayx_python_sdk/version.py +8 -0
- another_ayx_python_sdk-2.4.2.dist-info/RECORD +0 -403
- {another_ayx_python_sdk-2.4.2.dist-info → another_ayx_python_sdk-2.4.22.dist-info}/WHEEL +0 -0
- {another_ayx_python_sdk-2.4.2.dist-info → another_ayx_python_sdk-2.4.22.dist-info}/entry_points.txt +0 -0
- {another_ayx_python_sdk-2.4.2.dist-info → another_ayx_python_sdk-2.4.22.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,458 @@
|
|
1
|
+
# Copyright (C) 2022 Alteryx, Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the ALTERYX SDK AND API LICENSE AGREEMENT;
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# https://www.alteryx.com/alteryx-sdk-and-api-license-agreement
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
"""Utility classes for converting between byte representations."""
|
15
|
+
import datetime
|
16
|
+
import struct
|
17
|
+
from abc import ABC, abstractmethod
|
18
|
+
from decimal import Decimal
|
19
|
+
from functools import lru_cache
|
20
|
+
from typing import Any, Callable, Tuple
|
21
|
+
|
22
|
+
|
23
|
+
class _Packer(ABC):
|
24
|
+
def pack(self, element: Any) -> bytes:
|
25
|
+
try:
|
26
|
+
element = self._caster(element)
|
27
|
+
except Exception:
|
28
|
+
raise ValueError(
|
29
|
+
f"Could not cast value {element} with caster {self._caster}."
|
30
|
+
)
|
31
|
+
|
32
|
+
self._validator(element)
|
33
|
+
return struct.pack(self._format_code, self._caster(element))
|
34
|
+
|
35
|
+
def unpack(self, raw_bytes: bytes, start_idx: int) -> Tuple[Any, int]:
|
36
|
+
element_bytes = raw_bytes[start_idx : start_idx + self._element_size]
|
37
|
+
[parsed_element] = struct.unpack(self._format_code, element_bytes)
|
38
|
+
|
39
|
+
self._validator(parsed_element)
|
40
|
+
return self._caster(parsed_element), self._element_size
|
41
|
+
|
42
|
+
@property
|
43
|
+
@abstractmethod
|
44
|
+
def _format_code(self) -> str:
|
45
|
+
"""Get the format code for struct package."""
|
46
|
+
raise NotImplementedError()
|
47
|
+
|
48
|
+
@property
|
49
|
+
@abstractmethod
|
50
|
+
def _element_size(self) -> int:
|
51
|
+
"""Get the element size (in bytes) of the packer."""
|
52
|
+
raise NotImplementedError()
|
53
|
+
|
54
|
+
@property
|
55
|
+
@abstractmethod
|
56
|
+
def _caster(self) -> Callable:
|
57
|
+
"""Get the method for casting the element."""
|
58
|
+
raise NotImplementedError()
|
59
|
+
|
60
|
+
@staticmethod
|
61
|
+
def _unpack_sized_blob(blob: bytes, start_idx: int) -> Tuple[bytes, int]:
|
62
|
+
element_size, integer_size = _UnsignedIntegerPacker().unpack(blob, start_idx)
|
63
|
+
return (
|
64
|
+
blob[start_idx + integer_size : start_idx + integer_size + element_size],
|
65
|
+
element_size + integer_size,
|
66
|
+
)
|
67
|
+
|
68
|
+
@abstractmethod
|
69
|
+
def _validator(self, element: Any) -> None:
|
70
|
+
"""Validate the data."""
|
71
|
+
raise NotImplementedError()
|
72
|
+
|
73
|
+
|
74
|
+
class _BoolPacker(_Packer):
|
75
|
+
_element_size = 1
|
76
|
+
_format_code = "?"
|
77
|
+
_caster = bool
|
78
|
+
|
79
|
+
def _validator(self, element: Any) -> None:
|
80
|
+
# No additional validation needed for booleans
|
81
|
+
pass
|
82
|
+
|
83
|
+
|
84
|
+
class _IntegerPacker(_Packer):
|
85
|
+
_element_size = 4
|
86
|
+
_format_code = "i"
|
87
|
+
_caster = int
|
88
|
+
_signed = True
|
89
|
+
|
90
|
+
def _validator(self, element: Any) -> None:
|
91
|
+
"""Validate the data."""
|
92
|
+
_validate_integer(element, self._element_size * 8, self._signed)
|
93
|
+
|
94
|
+
|
95
|
+
class _BytePacker(_IntegerPacker):
|
96
|
+
_element_size = 1
|
97
|
+
_format_code = "B"
|
98
|
+
_caster = int
|
99
|
+
_signed = False
|
100
|
+
|
101
|
+
|
102
|
+
class _Int16Packer(_IntegerPacker):
|
103
|
+
_element_size = 2
|
104
|
+
_format_code = "h"
|
105
|
+
_caster = int
|
106
|
+
|
107
|
+
|
108
|
+
class _UnsignedIntegerPacker(_IntegerPacker):
|
109
|
+
_element_size = 4
|
110
|
+
_format_code = "I"
|
111
|
+
_caster = int
|
112
|
+
_signed = False
|
113
|
+
|
114
|
+
|
115
|
+
class _LongIntegerPacker(_IntegerPacker):
|
116
|
+
_element_size = 8
|
117
|
+
_format_code = "q"
|
118
|
+
_caster = int
|
119
|
+
|
120
|
+
|
121
|
+
class _FloatPacker(_Packer):
|
122
|
+
_element_size = 4
|
123
|
+
_format_code = "f"
|
124
|
+
_caster = float
|
125
|
+
|
126
|
+
def _validator(self, element: Any) -> None:
|
127
|
+
_validate_float(element, 1e38, 3.4)
|
128
|
+
|
129
|
+
|
130
|
+
class _DoublePacker(_Packer):
|
131
|
+
_element_size = 8
|
132
|
+
_format_code = "d"
|
133
|
+
_caster = float
|
134
|
+
|
135
|
+
def _validator(self, element: Any) -> None:
|
136
|
+
_validate_float(element, 1e308, 1.7)
|
137
|
+
|
138
|
+
|
139
|
+
class _StringPacker(_Packer):
|
140
|
+
def pack(self, string: str) -> bytes:
|
141
|
+
string = str(string)
|
142
|
+
self._validator(string)
|
143
|
+
|
144
|
+
string_bytes = string.encode("utf-8")
|
145
|
+
string_size = len(string_bytes)
|
146
|
+
|
147
|
+
return _UnsignedIntegerPacker().pack(string_size) + string_bytes
|
148
|
+
|
149
|
+
def unpack(self, raw_bytes: bytes, start_idx: int) -> Tuple[str, int]:
|
150
|
+
blob, element_size = self._unpack_sized_blob(raw_bytes, start_idx)
|
151
|
+
|
152
|
+
string = blob.decode("utf-8")
|
153
|
+
self._validator(string)
|
154
|
+
return string, element_size
|
155
|
+
|
156
|
+
@property
|
157
|
+
def _format_code(self) -> str:
|
158
|
+
"""Get the format code for struct package."""
|
159
|
+
raise NotImplementedError()
|
160
|
+
|
161
|
+
@property
|
162
|
+
def _element_size(self) -> int:
|
163
|
+
"""Get the element size (in bytes) of the packer."""
|
164
|
+
raise NotImplementedError()
|
165
|
+
|
166
|
+
@property
|
167
|
+
def _caster(self) -> int:
|
168
|
+
"""Get the method for casting the element."""
|
169
|
+
raise NotImplementedError()
|
170
|
+
|
171
|
+
def _validator(self, element: Any) -> None:
|
172
|
+
# No additional validation needed for strings
|
173
|
+
pass
|
174
|
+
|
175
|
+
|
176
|
+
class _DatePacker(_StringPacker):
|
177
|
+
def _validator(self, element: Any) -> None:
|
178
|
+
super()._validator(element)
|
179
|
+
datetime.datetime.strptime(element, "%Y-%m-%d")
|
180
|
+
|
181
|
+
|
182
|
+
class _DatetimePacker(_StringPacker):
|
183
|
+
def _validator(self, element: Any) -> None:
|
184
|
+
super()._validator(element)
|
185
|
+
datetime.datetime.strptime(element, "%Y-%m-%d %H:%M:%S")
|
186
|
+
|
187
|
+
|
188
|
+
class _BlobPacker(_Packer):
|
189
|
+
def pack(self, blob: bytes) -> bytes:
|
190
|
+
blob = bytes(blob)
|
191
|
+
self._validator(blob)
|
192
|
+
return _UnsignedIntegerPacker().pack(len(blob)) + blob
|
193
|
+
|
194
|
+
def unpack(self, raw_bytes: bytes, start_idx: int) -> Tuple[bytes, int]:
|
195
|
+
blob, size = self._unpack_sized_blob(raw_bytes, start_idx)
|
196
|
+
self._validator(blob)
|
197
|
+
return blob, size
|
198
|
+
|
199
|
+
@property
|
200
|
+
def _format_code(self) -> str:
|
201
|
+
"""Get the format code for struct package."""
|
202
|
+
raise NotImplementedError()
|
203
|
+
|
204
|
+
@property
|
205
|
+
def _element_size(self) -> int:
|
206
|
+
"""Get the element size (in bytes) of the packer."""
|
207
|
+
raise NotImplementedError()
|
208
|
+
|
209
|
+
@property
|
210
|
+
def _caster(self) -> int:
|
211
|
+
"""Get the method for casting the element."""
|
212
|
+
raise NotImplementedError()
|
213
|
+
|
214
|
+
def _validator(self, element: Any) -> None:
|
215
|
+
# No additional validation needed for blobs
|
216
|
+
pass
|
217
|
+
|
218
|
+
|
219
|
+
class _IndirectStringPacker(_Packer):
|
220
|
+
@classmethod
|
221
|
+
def pack(cls, string: str) -> bytes:
|
222
|
+
return bytes()
|
223
|
+
|
224
|
+
@classmethod
|
225
|
+
def unpack(cls, raw_bytes: bytes, start_idx: int) -> Tuple[str, int]:
|
226
|
+
return "", 0
|
227
|
+
|
228
|
+
@property
|
229
|
+
def _format_code(self) -> str:
|
230
|
+
"""Get the format code for struct package."""
|
231
|
+
raise NotImplementedError()
|
232
|
+
|
233
|
+
@property
|
234
|
+
def _element_size(self) -> int:
|
235
|
+
"""Get the element size (in bytes) of the packer."""
|
236
|
+
raise NotImplementedError()
|
237
|
+
|
238
|
+
@property
|
239
|
+
def _caster(self) -> int:
|
240
|
+
"""Get the method for casting the element."""
|
241
|
+
raise NotImplementedError()
|
242
|
+
|
243
|
+
def _validator(self, element: Any) -> None:
|
244
|
+
# No additional validation needed for indirect strings
|
245
|
+
pass
|
246
|
+
|
247
|
+
|
248
|
+
class _IndirectBlobPacker(_Packer):
|
249
|
+
@classmethod
|
250
|
+
def pack(cls, blob: bytes) -> bytes:
|
251
|
+
return bytes()
|
252
|
+
|
253
|
+
@classmethod
|
254
|
+
def unpack(cls, raw_bytes: bytes, start_idx: int) -> Tuple[bytes, int]:
|
255
|
+
return bytes(), 0
|
256
|
+
|
257
|
+
@property
|
258
|
+
def _format_code(self) -> str:
|
259
|
+
"""Get the format code for struct package."""
|
260
|
+
raise NotImplementedError()
|
261
|
+
|
262
|
+
@property
|
263
|
+
def _element_size(self) -> int:
|
264
|
+
"""Get the element size (in bytes) of the packer."""
|
265
|
+
raise NotImplementedError()
|
266
|
+
|
267
|
+
@property
|
268
|
+
def _caster(self) -> int:
|
269
|
+
"""Get the method for casting the element."""
|
270
|
+
raise NotImplementedError()
|
271
|
+
|
272
|
+
def _validator(self, element: Any) -> None:
|
273
|
+
# No additional validation needed for indirect blobs
|
274
|
+
pass
|
275
|
+
|
276
|
+
|
277
|
+
class _BoolTruePacker(_Packer):
|
278
|
+
@classmethod
|
279
|
+
def pack(cls, element: bool) -> bytes:
|
280
|
+
return bytes()
|
281
|
+
|
282
|
+
@classmethod
|
283
|
+
def unpack(cls, raw_bytes: bytes, start_idx: int) -> Tuple[bool, int]:
|
284
|
+
return True, 0
|
285
|
+
|
286
|
+
@property
|
287
|
+
def _format_code(self) -> str:
|
288
|
+
"""Get the format code for struct package."""
|
289
|
+
raise NotImplementedError()
|
290
|
+
|
291
|
+
@property
|
292
|
+
def _element_size(self) -> int:
|
293
|
+
"""Get the element size (in bytes) of the packer."""
|
294
|
+
raise NotImplementedError()
|
295
|
+
|
296
|
+
@property
|
297
|
+
def _caster(self) -> int:
|
298
|
+
"""Get the method for casting the element."""
|
299
|
+
raise NotImplementedError()
|
300
|
+
|
301
|
+
def _validator(self, element: Any) -> None:
|
302
|
+
# No additional validation needed for boolean true types
|
303
|
+
pass
|
304
|
+
|
305
|
+
|
306
|
+
class _BoolFalsePacker(_Packer):
|
307
|
+
@classmethod
|
308
|
+
def pack(cls, element: bool) -> bytes:
|
309
|
+
return bytes()
|
310
|
+
|
311
|
+
@classmethod
|
312
|
+
def unpack(cls, raw_bytes: bytes, start_idx: int) -> Tuple[bool, int]:
|
313
|
+
return False, 0
|
314
|
+
|
315
|
+
@property
|
316
|
+
def _format_code(self) -> str:
|
317
|
+
"""Get the format code for struct package."""
|
318
|
+
raise NotImplementedError()
|
319
|
+
|
320
|
+
@property
|
321
|
+
def _element_size(self) -> int:
|
322
|
+
"""Get the element size (in bytes) of the packer."""
|
323
|
+
raise NotImplementedError()
|
324
|
+
|
325
|
+
@property
|
326
|
+
def _caster(self) -> int:
|
327
|
+
"""Get the method for casting the element."""
|
328
|
+
raise NotImplementedError()
|
329
|
+
|
330
|
+
def _validator(self, element: Any) -> None:
|
331
|
+
# No additional validation needed for boolean false types
|
332
|
+
pass
|
333
|
+
|
334
|
+
|
335
|
+
class _EmptyStringPacker(_Packer):
|
336
|
+
@classmethod
|
337
|
+
def pack(cls, element: str) -> bytes:
|
338
|
+
return bytes()
|
339
|
+
|
340
|
+
@classmethod
|
341
|
+
def unpack(cls, raw_bytes: bytes, start_idx: int) -> Tuple[str, int]:
|
342
|
+
return "", 0
|
343
|
+
|
344
|
+
@property
|
345
|
+
def _format_code(self) -> str:
|
346
|
+
"""Get the format code for struct package."""
|
347
|
+
raise NotImplementedError()
|
348
|
+
|
349
|
+
@property
|
350
|
+
def _element_size(self) -> int:
|
351
|
+
"""Get the element size (in bytes) of the packer."""
|
352
|
+
raise NotImplementedError()
|
353
|
+
|
354
|
+
@property
|
355
|
+
def _caster(self) -> int:
|
356
|
+
"""Get the method for casting the element."""
|
357
|
+
raise NotImplementedError()
|
358
|
+
|
359
|
+
def _validator(self, element: Any) -> None:
|
360
|
+
# No additional validation needed for empty strings
|
361
|
+
pass
|
362
|
+
|
363
|
+
|
364
|
+
class _NullPacker(_Packer):
|
365
|
+
@classmethod
|
366
|
+
def pack(cls, element: str) -> bytes:
|
367
|
+
return bytes()
|
368
|
+
|
369
|
+
@classmethod
|
370
|
+
def unpack(cls, raw_bytes: bytes, start_idx: int) -> Tuple[None, int]:
|
371
|
+
return None, 0
|
372
|
+
|
373
|
+
@property
|
374
|
+
def _format_code(self) -> str:
|
375
|
+
"""Get the format code for struct package."""
|
376
|
+
raise NotImplementedError()
|
377
|
+
|
378
|
+
@property
|
379
|
+
def _element_size(self) -> int:
|
380
|
+
"""Get the element size (in bytes) of the packer."""
|
381
|
+
raise NotImplementedError()
|
382
|
+
|
383
|
+
@property
|
384
|
+
def _caster(self) -> int:
|
385
|
+
"""Get the method for casting the element."""
|
386
|
+
raise NotImplementedError()
|
387
|
+
|
388
|
+
def _validator(self, element: Any) -> None:
|
389
|
+
# No additional validation needed for nulls
|
390
|
+
pass
|
391
|
+
|
392
|
+
|
393
|
+
class _Int0Packer(_Packer):
|
394
|
+
@classmethod
|
395
|
+
def pack(cls, element: str) -> bytes:
|
396
|
+
return bytes()
|
397
|
+
|
398
|
+
@classmethod
|
399
|
+
def unpack(cls, raw_bytes: bytes, start_idx: int) -> Tuple[int, int]:
|
400
|
+
return 0, 0
|
401
|
+
|
402
|
+
@property
|
403
|
+
def _format_code(self) -> str:
|
404
|
+
"""Get the format code for struct package."""
|
405
|
+
raise NotImplementedError()
|
406
|
+
|
407
|
+
@property
|
408
|
+
def _element_size(self) -> int:
|
409
|
+
"""Get the element size (in bytes) of the packer."""
|
410
|
+
raise NotImplementedError()
|
411
|
+
|
412
|
+
@property
|
413
|
+
def _caster(self) -> int:
|
414
|
+
"""Get the method for casting the element."""
|
415
|
+
raise NotImplementedError()
|
416
|
+
|
417
|
+
def _validator(self, element: Any) -> None:
|
418
|
+
# No additional validation needed for int 0
|
419
|
+
pass
|
420
|
+
|
421
|
+
|
422
|
+
def _validate_integer(element: Any, num_bits: int, signed: bool) -> None:
|
423
|
+
"""Validate whether this integer is in bounds given it's AMPFieldType."""
|
424
|
+
max_val = max_int(num_bits, signed)
|
425
|
+
min_val = min_int(num_bits, signed)
|
426
|
+
|
427
|
+
if element < min_val or element > max_val:
|
428
|
+
raise ValueError(
|
429
|
+
f"{'Signed' if signed else 'Unsigned'} integer with {num_bits} bits must fall in the range of {min_val} to {max_val}."
|
430
|
+
)
|
431
|
+
|
432
|
+
|
433
|
+
def _validate_float(element: Any, exp, digit) -> None:
|
434
|
+
"""Validate whether this float is in bounds given it's AMPFieldType."""
|
435
|
+
# TODO potentially validate for floats with exponent less than -38 and for doubles with exponent less than -308
|
436
|
+
limit = float_limit(exp, digit)
|
437
|
+
dec_element = Decimal(str(element))
|
438
|
+
|
439
|
+
if dec_element < -limit or dec_element > limit:
|
440
|
+
raise ValueError(f"Float must fall in the range of -{limit} to {limit}.")
|
441
|
+
|
442
|
+
|
443
|
+
@lru_cache()
|
444
|
+
def min_int(num_bits: int, signed: bool) -> int:
|
445
|
+
"""Calculate the minimum value that an integer can be considering it's bit length and whether it is signed."""
|
446
|
+
return signed * -1 * (2 ** (num_bits - 1))
|
447
|
+
|
448
|
+
|
449
|
+
@lru_cache()
|
450
|
+
def max_int(num_bits: int, signed: bool) -> int:
|
451
|
+
"""Calculate the maximum value that an integer can be considering it's bit length and whether it is signed."""
|
452
|
+
return 2 ** (num_bits - (1 * signed)) - 1
|
453
|
+
|
454
|
+
|
455
|
+
@lru_cache()
|
456
|
+
def float_limit(exp: float, digit: float) -> "Decimal":
|
457
|
+
"""Calculate the limit of a float given it's exponent and digit."""
|
458
|
+
return Decimal(str(exp)) * Decimal(str(digit))
|
@@ -0,0 +1,204 @@
|
|
1
|
+
# Copyright (C) 2022 Alteryx, Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the ALTERYX SDK AND API LICENSE AGREEMENT;
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# https://www.alteryx.com/alteryx-sdk-and-api-license-agreement
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
"""Record building utilities for converting between core and protobuf."""
|
15
|
+
from typing import Any, Dict, List, Sequence
|
16
|
+
|
17
|
+
from another_ayx_python_sdk.core.constants import NULL_VALUE_PLACEHOLDER
|
18
|
+
from another_ayx_python_sdk.core.field import FieldType
|
19
|
+
from another_ayx_python_sdk.core.metadata import Metadata
|
20
|
+
from another_ayx_python_sdk.providers.amp_provider.builders.packers import (
|
21
|
+
_BlobPacker,
|
22
|
+
_BoolFalsePacker,
|
23
|
+
_BoolPacker,
|
24
|
+
_BoolTruePacker,
|
25
|
+
_BytePacker,
|
26
|
+
_DatePacker,
|
27
|
+
_DatetimePacker,
|
28
|
+
_DoublePacker,
|
29
|
+
_EmptyStringPacker,
|
30
|
+
_FloatPacker,
|
31
|
+
_IndirectBlobPacker,
|
32
|
+
_IndirectStringPacker,
|
33
|
+
_Int0Packer,
|
34
|
+
_Int16Packer,
|
35
|
+
_IntegerPacker,
|
36
|
+
_LongIntegerPacker,
|
37
|
+
_NullPacker,
|
38
|
+
_Packer,
|
39
|
+
_StringPacker,
|
40
|
+
)
|
41
|
+
from another_ayx_python_sdk.providers.amp_provider.resources.generated.record_packet_pb2 import (
|
42
|
+
AMPFieldType,
|
43
|
+
Record as ProtobufRecord,
|
44
|
+
)
|
45
|
+
|
46
|
+
|
47
|
+
class RecordBuilder:
|
48
|
+
"""Utilities for converting records between protobuf and core format objects."""
|
49
|
+
|
50
|
+
_field_type_to_packer: Dict[Any, _Packer] = {
|
51
|
+
AMPFieldType.STRING: _StringPacker(),
|
52
|
+
AMPFieldType.BLOB: _BlobPacker(),
|
53
|
+
AMPFieldType.SPATIALOBJ: _BlobPacker(),
|
54
|
+
AMPFieldType.BCD: _BlobPacker(),
|
55
|
+
AMPFieldType.BOOL: _BoolPacker(),
|
56
|
+
AMPFieldType.INT0: _Int0Packer(),
|
57
|
+
AMPFieldType.UINT8: _BytePacker(),
|
58
|
+
AMPFieldType.INT16: _Int16Packer(),
|
59
|
+
AMPFieldType.INT32: _IntegerPacker(),
|
60
|
+
AMPFieldType.INT64: _LongIntegerPacker(),
|
61
|
+
AMPFieldType.FLOAT: _FloatPacker(),
|
62
|
+
AMPFieldType.DOUBLE: _DoublePacker(),
|
63
|
+
AMPFieldType.DATE: _DatePacker(),
|
64
|
+
AMPFieldType.TIME: _IntegerPacker(),
|
65
|
+
AMPFieldType.DATETIME: _DatetimePacker(),
|
66
|
+
AMPFieldType.INDIRECTSTRING: _IndirectStringPacker(),
|
67
|
+
AMPFieldType.INDIRECTBLOB: _IndirectBlobPacker(),
|
68
|
+
AMPFieldType.INDIRECTSPATIAL: _IndirectBlobPacker(),
|
69
|
+
AMPFieldType.BOOLFALSE: _BoolFalsePacker(),
|
70
|
+
AMPFieldType.BOOLTRUE: _BoolTruePacker(),
|
71
|
+
AMPFieldType.EMPTYSTRING: _EmptyStringPacker(),
|
72
|
+
AMPFieldType.NULL: _NullPacker(),
|
73
|
+
}
|
74
|
+
|
75
|
+
_blob_cosmetic_types_to_amp_type = {
|
76
|
+
FieldType.blob: AMPFieldType.BLOB,
|
77
|
+
FieldType.spatialobj: AMPFieldType.SPATIALOBJ,
|
78
|
+
FieldType.fixeddecimal: AMPFieldType.BCD,
|
79
|
+
}
|
80
|
+
|
81
|
+
_datetime_cosmetic_types_to_amp_type = {
|
82
|
+
FieldType.date: AMPFieldType.DATE,
|
83
|
+
FieldType.datetime: AMPFieldType.DATETIME,
|
84
|
+
FieldType.time: AMPFieldType.TIME,
|
85
|
+
}
|
86
|
+
|
87
|
+
_float_cosmetic_types_to_amp_type = {
|
88
|
+
FieldType.float: AMPFieldType.FLOAT,
|
89
|
+
FieldType.double: AMPFieldType.DOUBLE,
|
90
|
+
}
|
91
|
+
|
92
|
+
_int_cosmetic_types_to_amp_type = {
|
93
|
+
FieldType.byte: AMPFieldType.UINT8,
|
94
|
+
FieldType.int16: AMPFieldType.INT16,
|
95
|
+
FieldType.int32: AMPFieldType.INT32,
|
96
|
+
FieldType.int64: AMPFieldType.INT64,
|
97
|
+
}
|
98
|
+
|
99
|
+
_null_values = {NULL_VALUE_PLACEHOLDER, None}
|
100
|
+
|
101
|
+
@classmethod
|
102
|
+
def from_protobuf(cls, record: ProtobufRecord) -> List:
|
103
|
+
"""
|
104
|
+
Convert a protobuf to a list of values.
|
105
|
+
|
106
|
+
Parameters
|
107
|
+
----------
|
108
|
+
record
|
109
|
+
Protobuf representation of a record.
|
110
|
+
|
111
|
+
Returns
|
112
|
+
-------
|
113
|
+
List
|
114
|
+
All elements of the record as a list.
|
115
|
+
"""
|
116
|
+
start_byte_idx = 0
|
117
|
+
parsed_record = []
|
118
|
+
|
119
|
+
for amp_type in record.types:
|
120
|
+
try:
|
121
|
+
packer = cls._field_type_to_packer[amp_type]
|
122
|
+
except KeyError:
|
123
|
+
raise ValueError(f"Packer not found for type: {amp_type}")
|
124
|
+
|
125
|
+
element, stride = packer.unpack(record.data, start_byte_idx)
|
126
|
+
|
127
|
+
parsed_record.append(element)
|
128
|
+
start_byte_idx += stride
|
129
|
+
|
130
|
+
return parsed_record
|
131
|
+
|
132
|
+
@classmethod
|
133
|
+
def to_protobuf(cls, record: Sequence, metadata: Metadata) -> ProtobufRecord:
|
134
|
+
"""
|
135
|
+
Convert a sequence of values to a protobuf.
|
136
|
+
|
137
|
+
Parameters
|
138
|
+
----------
|
139
|
+
record
|
140
|
+
A sequence of values.
|
141
|
+
metadata
|
142
|
+
Metadata associated with the values.
|
143
|
+
|
144
|
+
Returns
|
145
|
+
-------
|
146
|
+
ProtobufRecord
|
147
|
+
The protobuf representation of the passed in record.
|
148
|
+
"""
|
149
|
+
assert len(record) == len(metadata)
|
150
|
+
|
151
|
+
raw_data = bytes()
|
152
|
+
amp_types = []
|
153
|
+
for field, element in zip(metadata, record):
|
154
|
+
try:
|
155
|
+
amp_type = cls._get_amp_type(field.type, element)
|
156
|
+
packer = cls._field_type_to_packer[amp_type]
|
157
|
+
except KeyError:
|
158
|
+
raise ValueError(f"Packer not found for type: {field.type}")
|
159
|
+
|
160
|
+
raw_data += packer.pack(element)
|
161
|
+
amp_types.append(amp_type)
|
162
|
+
|
163
|
+
return ProtobufRecord(data=raw_data, types=amp_types)
|
164
|
+
|
165
|
+
@classmethod
|
166
|
+
def _get_amp_type(cls, cosmetic_type: FieldType, element: Any) -> AMPFieldType:
|
167
|
+
if element in cls._null_values:
|
168
|
+
return AMPFieldType.NULL
|
169
|
+
|
170
|
+
if cosmetic_type in [
|
171
|
+
FieldType.string,
|
172
|
+
FieldType.v_string,
|
173
|
+
FieldType.v_wstring,
|
174
|
+
FieldType.wstring,
|
175
|
+
]:
|
176
|
+
if element == "":
|
177
|
+
return AMPFieldType.EMPTYSTRING
|
178
|
+
|
179
|
+
return AMPFieldType.STRING
|
180
|
+
|
181
|
+
if cosmetic_type in cls._blob_cosmetic_types_to_amp_type:
|
182
|
+
return cls._blob_cosmetic_types_to_amp_type[cosmetic_type]
|
183
|
+
|
184
|
+
if cosmetic_type == FieldType.bool:
|
185
|
+
if element:
|
186
|
+
return AMPFieldType.BOOLTRUE
|
187
|
+
|
188
|
+
return AMPFieldType.BOOLFALSE
|
189
|
+
|
190
|
+
if element == 0:
|
191
|
+
return AMPFieldType.INT0
|
192
|
+
|
193
|
+
if cosmetic_type in cls._float_cosmetic_types_to_amp_type:
|
194
|
+
return cls._float_cosmetic_types_to_amp_type[cosmetic_type]
|
195
|
+
|
196
|
+
if cosmetic_type in cls._datetime_cosmetic_types_to_amp_type:
|
197
|
+
return cls._datetime_cosmetic_types_to_amp_type[cosmetic_type]
|
198
|
+
|
199
|
+
if cosmetic_type in cls._int_cosmetic_types_to_amp_type:
|
200
|
+
return cls._int_cosmetic_types_to_amp_type[cosmetic_type]
|
201
|
+
|
202
|
+
raise ValueError(
|
203
|
+
f"AMP field type not found for cosmetic type {cosmetic_type} and value {element}."
|
204
|
+
)
|