@typespec/http-client-python 0.28.2 → 0.28.3
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.
- package/dist/emitter/code-model.d.ts.map +1 -1
- package/dist/emitter/code-model.js +6 -6
- package/dist/emitter/code-model.js.map +1 -1
- package/dist/emitter/emitter.d.ts.map +1 -1
- package/dist/emitter/emitter.js +27 -28
- package/dist/emitter/emitter.js.map +1 -1
- package/dist/emitter/lib.d.ts +4 -1
- package/dist/emitter/lib.d.ts.map +1 -1
- package/dist/emitter/lib.js.map +1 -1
- package/dist/emitter/system-requirements.js +6 -4
- package/dist/emitter/system-requirements.js.map +1 -1
- package/dist/emitter/types.d.ts +2 -5
- package/dist/emitter/types.d.ts.map +1 -1
- package/dist/emitter/types.js +55 -58
- package/dist/emitter/types.js.map +1 -1
- package/dist/emitter/utils.d.ts.map +1 -1
- package/dist/emitter/utils.js +16 -17
- package/dist/emitter/utils.js.map +1 -1
- package/emitter/src/code-model.ts +6 -13
- package/emitter/src/emitter.ts +29 -31
- package/emitter/src/lib.ts +4 -0
- package/emitter/src/system-requirements.ts +4 -4
- package/emitter/src/types.ts +67 -57
- package/emitter/src/utils.ts +16 -18
- package/emitter/temp/tsconfig.tsbuildinfo +1 -1
- package/eng/scripts/Build-Packages.ps1 +62 -37
- package/eng/scripts/Check-GitChanges.ps1 +30 -3
- package/eng/scripts/Functions.ps1 +54 -15
- package/eng/scripts/Generate.ps1 +42 -8
- package/eng/scripts/Generation.psm1 +44 -15
- package/eng/scripts/Initialize-Repository.ps1 +29 -11
- package/eng/scripts/Test-Packages.ps1 +47 -31
- package/eng/scripts/ci/config/eslint-ci.config.mjs +54 -0
- package/eng/scripts/ci/dev_requirements.txt +1 -0
- package/eng/scripts/ci/format.ts +232 -2
- package/eng/scripts/ci/lint.ts +216 -20
- package/eng/scripts/ci/regenerate-common.ts +18 -14
- package/eng/scripts/ci/regenerate.ts +305 -68
- package/eng/scripts/ci/run-tests.ts +402 -0
- package/eng/scripts/ci/run_mypy.py +4 -3
- package/eng/scripts/ci/run_pylint.py +4 -3
- package/eng/scripts/ci/run_pyright.py +4 -3
- package/eng/scripts/ci/typecheck.ts +225 -0
- package/eng/scripts/ci/util.py +1 -1
- package/eng/scripts/ci/utils.ts +5 -5
- package/eng/scripts/setup/__pycache__/package_manager.cpython-311.pyc +0 -0
- package/eng/scripts/setup/__pycache__/venvtools.cpython-311.pyc +0 -0
- package/eng/scripts/setup/build.ts +1 -1
- package/eng/scripts/setup/build_pygen_wheel.py +1 -0
- package/eng/scripts/setup/install.py +1 -0
- package/eng/scripts/setup/prepare.py +1 -0
- package/eng/scripts/setup/prepare.ts +1 -1
- package/eng/scripts/setup/run_tsp.py +3 -3
- package/eng/scripts/setup/system-requirements.ts +8 -4
- package/eng/scripts/setup/venvtools.py +1 -0
- package/generator/build/lib/pygen/codegen/templates/model_base.py.jinja2 +157 -64
- package/generator/dist/pygen-0.1.0-py3-none-any.whl +0 -0
- package/generator/pygen/codegen/templates/model_base.py.jinja2 +157 -64
- package/package.json +48 -42
- package/eng/scripts/ci/run-ci.ts +0 -89
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_commonproperties_async.py +0 -94
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_largeheader_async.py +0 -30
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_nonresource_async.py +0 -36
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_operationtemplates_async.py +0 -205
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_resource_async.py +0 -478
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_access_async.py +0 -101
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_api_version_header_async.py +0 -18
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_api_version_path_async.py +0 -18
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_api_version_query_async.py +0 -18
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_client_default_value_async.py +0 -46
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_client_initialization_async.py +0 -58
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_client_location_async.py +0 -82
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_deserialize_empty_string_as_null_async.py +0 -20
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_flatten_async.py +0 -115
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_hierrarchy_building_async.py +0 -53
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_next_link_verb_async.py +0 -28
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_override_async.py +0 -106
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_usage_async.py +0 -38
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_basic_async.py +0 -76
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_lro_rpc_async.py +0 -22
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_lro_standard_async.py +0 -39
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_model_async.py +0 -33
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_page_async.py +0 -80
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_scalar_async.py +0 -41
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_traits_async.py +0 -87
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_encode_duration_async.py +0 -19
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_example_basic_async.py +0 -30
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_payload_pageable_async.py +0 -19
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_resource_manager_method_subscription_id_async.py +0 -248
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_resource_manager_multi_service_async.py +0 -110
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_resource_manager_multi_service_shared_models_async.py +0 -132
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_special_headers_client_request_id_async.py +0 -30
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_versioning_previewversion_async.py +0 -53
- package/generator/test/azure/mock_api_tests/asynctests/test_client_namespace_async.py +0 -34
- package/generator/test/azure/mock_api_tests/asynctests/test_client_naming_async.py +0 -69
- package/generator/test/azure/mock_api_tests/asynctests/test_client_naming_enum_conflict_async.py +0 -37
- package/generator/test/azure/mock_api_tests/asynctests/test_client_overload_async.py +0 -27
- package/generator/test/azure/mock_api_tests/asynctests/test_client_structure_async.py +0 -64
- package/generator/test/azure/mock_api_tests/asynctests/test_client_structure_clientoperationgroup_async.py +0 -31
- package/generator/test/azure/mock_api_tests/asynctests/test_encode_duration_async.py +0 -63
- package/generator/test/azure/mock_api_tests/asynctests/test_encode_numeric_async.py +0 -35
- package/generator/test/azure/mock_api_tests/asynctests/test_parameters_basic_async.py +0 -24
- package/generator/test/azure/mock_api_tests/asynctests/test_parameters_spread_async.py +0 -76
- package/generator/test/azure/mock_api_tests/asynctests/test_payload_content_negotiation_async.py +0 -37
- package/generator/test/azure/mock_api_tests/asynctests/test_payload_multipart_async.py +0 -216
- package/generator/test/azure/mock_api_tests/asynctests/test_resiliency_srv_driven_async.py +0 -130
- package/generator/test/azure/mock_api_tests/asynctests/test_serialization_encoded_name_json_async.py +0 -24
- package/generator/test/azure/mock_api_tests/asynctests/test_service_multi_service_async.py +0 -31
- package/generator/test/azure/mock_api_tests/asynctests/test_special_words_async.py +0 -71
- package/generator/test/azure/mock_api_tests/conftest.py +0 -207
- package/generator/test/azure/mock_api_tests/data/image.jpg +0 -0
- package/generator/test/azure/mock_api_tests/data/image.png +0 -0
- package/generator/test/azure/mock_api_tests/test_azure_arm_commonproperties.py +0 -89
- package/generator/test/azure/mock_api_tests/test_azure_arm_largeheader.py +0 -27
- package/generator/test/azure/mock_api_tests/test_azure_arm_nonresource.py +0 -34
- package/generator/test/azure/mock_api_tests/test_azure_arm_operationtemplates.py +0 -180
- package/generator/test/azure/mock_api_tests/test_azure_arm_resource.py +0 -436
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_access.py +0 -92
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_api_version_header.py +0 -17
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_api_version_path.py +0 -17
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_api_version_query.py +0 -17
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_client_default_value.py +0 -42
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_client_initialization.py +0 -51
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_client_location.py +0 -70
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_deserialize_empty_string_as_null.py +0 -19
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_flatten.py +0 -104
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_hierrarchy_building.py +0 -45
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_next_link_verb.py +0 -27
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_override.py +0 -102
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_usage.py +0 -32
- package/generator/test/azure/mock_api_tests/test_azure_core_basic.py +0 -70
- package/generator/test/azure/mock_api_tests/test_azure_core_lro_rpc.py +0 -20
- package/generator/test/azure/mock_api_tests/test_azure_core_lro_standard.py +0 -32
- package/generator/test/azure/mock_api_tests/test_azure_core_model.py +0 -30
- package/generator/test/azure/mock_api_tests/test_azure_core_page.py +0 -71
- package/generator/test/azure/mock_api_tests/test_azure_core_scalar.py +0 -35
- package/generator/test/azure/mock_api_tests/test_azure_core_traits.py +0 -85
- package/generator/test/azure/mock_api_tests/test_azure_encode_duration.py +0 -18
- package/generator/test/azure/mock_api_tests/test_azure_example_basic.py +0 -29
- package/generator/test/azure/mock_api_tests/test_azure_payload_pageable.py +0 -18
- package/generator/test/azure/mock_api_tests/test_azure_resource_manager_method_subscription_id.py +0 -235
- package/generator/test/azure/mock_api_tests/test_azure_resource_manager_multi_service.py +0 -104
- package/generator/test/azure/mock_api_tests/test_azure_resource_manager_multi_service_shared_models.py +0 -128
- package/generator/test/azure/mock_api_tests/test_azure_special_headers_client_request_id.py +0 -29
- package/generator/test/azure/mock_api_tests/test_azure_versioning_previewversion.py +0 -50
- package/generator/test/azure/mock_api_tests/test_clear_output_folder.py +0 -23
- package/generator/test/azure/mock_api_tests/test_client_namespace.py +0 -32
- package/generator/test/azure/mock_api_tests/test_client_naming.py +0 -57
- package/generator/test/azure/mock_api_tests/test_client_naming_enum_conflict.py +0 -35
- package/generator/test/azure/mock_api_tests/test_client_overload.py +0 -25
- package/generator/test/azure/mock_api_tests/test_client_structure.py +0 -60
- package/generator/test/azure/mock_api_tests/test_client_structure_clientoperationgroup.py +0 -29
- package/generator/test/azure/mock_api_tests/test_encode_duration.py +0 -60
- package/generator/test/azure/mock_api_tests/test_encode_numeric.py +0 -31
- package/generator/test/azure/mock_api_tests/test_model_base_flatten_compatibility.py +0 -251
- package/generator/test/azure/mock_api_tests/test_parameters_basic.py +0 -22
- package/generator/test/azure/mock_api_tests/test_parameters_spread.py +0 -66
- package/generator/test/azure/mock_api_tests/test_payload_content_negotiation.py +0 -33
- package/generator/test/azure/mock_api_tests/test_payload_multipart.py +0 -198
- package/generator/test/azure/mock_api_tests/test_resiliency_srv_driven.py +0 -124
- package/generator/test/azure/mock_api_tests/test_serialization_encoded_name_json.py +0 -21
- package/generator/test/azure/mock_api_tests/test_service_multi_service.py +0 -29
- package/generator/test/azure/mock_api_tests/test_special_words.py +0 -63
- package/generator/test/azure/requirements.txt +0 -125
- package/generator/test/azure/tox.ini +0 -64
- package/generator/test/data/image.jpg +0 -0
- package/generator/test/data/image.png +0 -0
- package/generator/test/dev_requirements.txt +0 -8
- package/generator/test/generic_mock_api_tests/asynctests/test_authentication_async.py +0 -140
- package/generator/test/generic_mock_api_tests/asynctests/test_encode_array_async.py +0 -139
- package/generator/test/generic_mock_api_tests/asynctests/test_encode_bytes_async.py +0 -132
- package/generator/test/generic_mock_api_tests/asynctests/test_encode_datetime_async.py +0 -127
- package/generator/test/generic_mock_api_tests/asynctests/test_headasboolean_async.py +0 -35
- package/generator/test/generic_mock_api_tests/asynctests/test_parameters_body_optionality_async.py +0 -30
- package/generator/test/generic_mock_api_tests/asynctests/test_parameters_collection_format_async.py +0 -38
- package/generator/test/generic_mock_api_tests/asynctests/test_parameters_path_async.py +0 -24
- package/generator/test/generic_mock_api_tests/asynctests/test_parameters_query_async.py +0 -18
- package/generator/test/generic_mock_api_tests/asynctests/test_payload_json_merge_patch_async.py +0 -98
- package/generator/test/generic_mock_api_tests/asynctests/test_payload_media_type_async.py +0 -27
- package/generator/test/generic_mock_api_tests/asynctests/test_payload_pageable_async.py +0 -134
- package/generator/test/generic_mock_api_tests/asynctests/test_payload_xml_async.py +0 -150
- package/generator/test/generic_mock_api_tests/asynctests/test_response_status_code_range_async.py +0 -38
- package/generator/test/generic_mock_api_tests/asynctests/test_routes_async.py +0 -331
- package/generator/test/generic_mock_api_tests/asynctests/test_server_endpoint_not_defined_async.py +0 -18
- package/generator/test/generic_mock_api_tests/asynctests/test_server_path_multiple_async.py +0 -25
- package/generator/test/generic_mock_api_tests/asynctests/test_server_path_single_async.py +0 -18
- package/generator/test/generic_mock_api_tests/asynctests/test_server_versions_not_versioned_async.py +0 -28
- package/generator/test/generic_mock_api_tests/asynctests/test_server_versions_versioned_async.py +0 -34
- package/generator/test/generic_mock_api_tests/asynctests/test_special_headers_conditional_request_async.py +0 -38
- package/generator/test/generic_mock_api_tests/asynctests/test_special_headers_repeatability_async.py +0 -19
- package/generator/test/generic_mock_api_tests/asynctests/test_specs_documentation_async.py +0 -59
- package/generator/test/generic_mock_api_tests/asynctests/test_streaming_jsonl_async.py +0 -27
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_array_async.py +0 -127
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_dictionary_async.py +0 -98
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_enum_extensible_async.py +0 -25
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_enum_fixed_async.py +0 -27
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_file_async.py +0 -59
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_empty_async.py +0 -32
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_enum_discriminator_async.py +0 -70
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_nested_discriminator_async.py +0 -85
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_not_discriminated_async.py +0 -34
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_recursive_async.py +0 -34
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_single_discriminator_async.py +0 -67
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_usage_async.py +0 -32
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_visibility_async.py +0 -47
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_additionalproperties_async.py +0 -353
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_nullable_async.py +0 -110
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_optional_async.py +0 -197
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_valuetypes_async.py +0 -315
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_scalar_async.py +0 -60
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_union_async.py +0 -90
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_added_async.py +0 -36
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_made_optional_async.py +0 -21
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_removed_async.py +0 -39
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_renamed_from_async.py +0 -29
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_return_type_changed_from_async.py +0 -18
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_type_changed_from_async.py +0 -22
- package/generator/test/generic_mock_api_tests/conftest.py +0 -75
- package/generator/test/generic_mock_api_tests/data/image.jpg +0 -0
- package/generator/test/generic_mock_api_tests/data/image.png +0 -0
- package/generator/test/generic_mock_api_tests/test_authentication.py +0 -130
- package/generator/test/generic_mock_api_tests/test_encode_array.py +0 -126
- package/generator/test/generic_mock_api_tests/test_encode_bytes.py +0 -128
- package/generator/test/generic_mock_api_tests/test_encode_datetime.py +0 -123
- package/generator/test/generic_mock_api_tests/test_headasboolean.py +0 -33
- package/generator/test/generic_mock_api_tests/test_parameters_body_optionality.py +0 -27
- package/generator/test/generic_mock_api_tests/test_parameters_collection_format.py +0 -33
- package/generator/test/generic_mock_api_tests/test_parameters_path.py +0 -22
- package/generator/test/generic_mock_api_tests/test_parameters_query.py +0 -17
- package/generator/test/generic_mock_api_tests/test_payload_json_merge_patch.py +0 -93
- package/generator/test/generic_mock_api_tests/test_payload_media_type.py +0 -25
- package/generator/test/generic_mock_api_tests/test_payload_pageable.py +0 -99
- package/generator/test/generic_mock_api_tests/test_payload_xml.py +0 -135
- package/generator/test/generic_mock_api_tests/test_response_status_code_range.py +0 -36
- package/generator/test/generic_mock_api_tests/test_routes.py +0 -285
- package/generator/test/generic_mock_api_tests/test_server_endpoint_not_defined.py +0 -17
- package/generator/test/generic_mock_api_tests/test_server_path_multiple.py +0 -21
- package/generator/test/generic_mock_api_tests/test_server_path_single.py +0 -17
- package/generator/test/generic_mock_api_tests/test_server_versions_not_versioned.py +0 -25
- package/generator/test/generic_mock_api_tests/test_server_versions_versioned.py +0 -30
- package/generator/test/generic_mock_api_tests/test_special_headers_conditional_request.py +0 -34
- package/generator/test/generic_mock_api_tests/test_special_headers_repeatability.py +0 -18
- package/generator/test/generic_mock_api_tests/test_specs_documentation.py +0 -51
- package/generator/test/generic_mock_api_tests/test_streaming_jsonl.py +0 -25
- package/generator/test/generic_mock_api_tests/test_typetest_array.py +0 -111
- package/generator/test/generic_mock_api_tests/test_typetest_dictionary.py +0 -86
- package/generator/test/generic_mock_api_tests/test_typetest_enum_extensible.py +0 -23
- package/generator/test/generic_mock_api_tests/test_typetest_enum_fixed.py +0 -25
- package/generator/test/generic_mock_api_tests/test_typetest_file.py +0 -52
- package/generator/test/generic_mock_api_tests/test_typetest_model_empty.py +0 -29
- package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_enum_discriminator.py +0 -58
- package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_nested_discriminator.py +0 -79
- package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_not_discriminated.py +0 -31
- package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_recursive.py +0 -32
- package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_single_discriminator.py +0 -60
- package/generator/test/generic_mock_api_tests/test_typetest_model_usage.py +0 -28
- package/generator/test/generic_mock_api_tests/test_typetest_model_visibility.py +0 -40
- package/generator/test/generic_mock_api_tests/test_typetest_property_additionalproperties.py +0 -314
- package/generator/test/generic_mock_api_tests/test_typetest_property_nullable.py +0 -102
- package/generator/test/generic_mock_api_tests/test_typetest_property_optional.py +0 -174
- package/generator/test/generic_mock_api_tests/test_typetest_property_valuetypes.py +0 -286
- package/generator/test/generic_mock_api_tests/test_typetest_scalar.py +0 -53
- package/generator/test/generic_mock_api_tests/test_typetest_union.py +0 -80
- package/generator/test/generic_mock_api_tests/test_typetest_union_discriminated.py +0 -290
- package/generator/test/generic_mock_api_tests/test_versioning_added.py +0 -33
- package/generator/test/generic_mock_api_tests/test_versioning_made_optional.py +0 -20
- package/generator/test/generic_mock_api_tests/test_versioning_removed.py +0 -37
- package/generator/test/generic_mock_api_tests/test_versioning_renamed_from.py +0 -27
- package/generator/test/generic_mock_api_tests/test_versioning_return_type_changed_from.py +0 -17
- package/generator/test/generic_mock_api_tests/test_versioning_type_changed_from.py +0 -21
- package/generator/test/unbranded/mock_api_tests/asynctests/test_auth_flow_async.py +0 -19
- package/generator/test/unbranded/mock_api_tests/asynctests/test_encode_duration_async.py +0 -63
- package/generator/test/unbranded/mock_api_tests/asynctests/test_encode_numeric_async.py +0 -35
- package/generator/test/unbranded/mock_api_tests/asynctests/test_parameters_basic_async.py +0 -24
- package/generator/test/unbranded/mock_api_tests/asynctests/test_parameters_spread_async.py +0 -76
- package/generator/test/unbranded/mock_api_tests/asynctests/test_payload_content_negotiation_async.py +0 -37
- package/generator/test/unbranded/mock_api_tests/asynctests/test_payload_multipart_async.py +0 -218
- package/generator/test/unbranded/mock_api_tests/asynctests/test_serialization_encoded_name_json_async.py +0 -24
- package/generator/test/unbranded/mock_api_tests/asynctests/test_special_words_async.py +0 -73
- package/generator/test/unbranded/mock_api_tests/asynctests/test_unbranded_async.py +0 -24
- package/generator/test/unbranded/mock_api_tests/conftest.py +0 -91
- package/generator/test/unbranded/mock_api_tests/data/image.jpg +0 -0
- package/generator/test/unbranded/mock_api_tests/data/image.png +0 -0
- package/generator/test/unbranded/mock_api_tests/test_auth_flow.py +0 -17
- package/generator/test/unbranded/mock_api_tests/test_encode_duration.py +0 -60
- package/generator/test/unbranded/mock_api_tests/test_encode_numeric.py +0 -32
- package/generator/test/unbranded/mock_api_tests/test_parameters_basic.py +0 -22
- package/generator/test/unbranded/mock_api_tests/test_parameters_spread.py +0 -66
- package/generator/test/unbranded/mock_api_tests/test_payload_content_negotiation.py +0 -33
- package/generator/test/unbranded/mock_api_tests/test_payload_multipart.py +0 -200
- package/generator/test/unbranded/mock_api_tests/test_serialization_encoded_name_json.py +0 -22
- package/generator/test/unbranded/mock_api_tests/test_special_words.py +0 -66
- package/generator/test/unbranded/mock_api_tests/test_unbranded.py +0 -65
- package/generator/test/unbranded/requirements.txt +0 -69
- package/generator/test/unbranded/tox.ini +0 -64
- package/generator/test/unittests/conftest.py +0 -15
- package/generator/test/unittests/requirements.txt +0 -3
- package/generator/test/unittests/test_enums.py +0 -89
- package/generator/test/unittests/test_model_base_serialization.py +0 -4906
- package/generator/test/unittests/test_model_base_xml_serialization.py +0 -1239
- package/generator/test/unittests/test_name_converter.py +0 -35
- package/generator/test/unittests/test_optional_return_type.py +0 -268
- package/generator/test/unittests/test_parameter_ordering.py +0 -104
- package/generator/test/unittests/test_sort_schema.py +0 -93
- package/generator/test/unittests/tox.ini +0 -5
- /package/eng/scripts/ci/{mypy.ini → config/mypy.ini} +0 -0
- /package/eng/scripts/ci/{pylintrc → config/pylintrc} +0 -0
- /package/eng/scripts/ci/{pyproject.toml → config/pyproject.toml} +0 -0
- /package/eng/scripts/ci/{pyrightconfig.json → config/pyrightconfig.json} +0 -0
package/eng/scripts/ci/format.ts
CHANGED
|
@@ -1,3 +1,233 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import { spawn } from "child_process";
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import { dirname, join } from "path";
|
|
5
|
+
import pc from "picocolors";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
import { parseArgs } from "util";
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "../../../");
|
|
10
|
+
const monorepoRoot = join(root, "../../");
|
|
11
|
+
|
|
12
|
+
// Get Python venv path
|
|
13
|
+
function getVenvPython(): string {
|
|
14
|
+
const venvPath = join(root, "venv");
|
|
15
|
+
if (fs.existsSync(join(venvPath, "bin"))) {
|
|
16
|
+
return join(venvPath, "bin", "python");
|
|
17
|
+
} else if (fs.existsSync(join(venvPath, "Scripts"))) {
|
|
18
|
+
return join(venvPath, "Scripts", "python.exe");
|
|
19
|
+
}
|
|
20
|
+
throw new Error("Virtual environment not found. Run 'npm run install' first.");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const argv = parseArgs({
|
|
24
|
+
args: process.argv.slice(2),
|
|
25
|
+
options: {
|
|
26
|
+
emitter: { type: "boolean", short: "e" },
|
|
27
|
+
generator: { type: "boolean", short: "g" },
|
|
28
|
+
generated: { type: "boolean" },
|
|
29
|
+
check: { type: "boolean", short: "c" },
|
|
30
|
+
help: { type: "boolean", short: "h" },
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
if (argv.values.help) {
|
|
35
|
+
console.log(`
|
|
36
|
+
${pc.bold("Usage:")} tsx format.ts [options]
|
|
37
|
+
|
|
38
|
+
${pc.bold("Description:")}
|
|
39
|
+
Format code using Prettier (TypeScript) and Black (Python).
|
|
40
|
+
|
|
41
|
+
${pc.bold("Options:")}
|
|
42
|
+
${pc.cyan("-e, --emitter")}
|
|
43
|
+
Format TypeScript emitter code with Prettier.
|
|
44
|
+
|
|
45
|
+
${pc.cyan("-g, --generator")}
|
|
46
|
+
Format Python generator source code (pygen) with Black.
|
|
47
|
+
|
|
48
|
+
${pc.cyan("--generated")}
|
|
49
|
+
Format generated SDK packages with Black.
|
|
50
|
+
|
|
51
|
+
${pc.cyan("-c, --check")}
|
|
52
|
+
Check formatting without making changes (exit with error if unformatted).
|
|
53
|
+
|
|
54
|
+
${pc.cyan("-h, --help")}
|
|
55
|
+
Show this help message.
|
|
56
|
+
|
|
57
|
+
${pc.bold("Examples:")}
|
|
58
|
+
${pc.dim("# Format emitter + pygen source (default)")}
|
|
59
|
+
tsx format.ts
|
|
60
|
+
|
|
61
|
+
${pc.dim("# Format only TypeScript emitter")}
|
|
62
|
+
tsx format.ts --emitter
|
|
63
|
+
|
|
64
|
+
${pc.dim("# Format only pygen source code")}
|
|
65
|
+
tsx format.ts --generator
|
|
66
|
+
|
|
67
|
+
${pc.dim("# Check formatting without making changes")}
|
|
68
|
+
tsx format.ts --check
|
|
69
|
+
|
|
70
|
+
${pc.dim("# Format generated SDK packages")}
|
|
71
|
+
tsx format.ts --generated
|
|
72
|
+
`);
|
|
73
|
+
process.exit(0);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function runCommand(command: string, args: string[]): Promise<boolean> {
|
|
77
|
+
// Add node_modules/.bin directories to PATH so commands like prettier can be found
|
|
78
|
+
const pathSep = process.platform === "win32" ? ";" : ":";
|
|
79
|
+
const binPaths = [
|
|
80
|
+
join(root, "node_modules", ".bin"),
|
|
81
|
+
join(monorepoRoot, "node_modules", ".bin"),
|
|
82
|
+
].join(pathSep);
|
|
83
|
+
const env = {
|
|
84
|
+
...process.env,
|
|
85
|
+
PATH: `${binPaths}${pathSep}${process.env.PATH}`,
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
return new Promise((resolve) => {
|
|
89
|
+
console.log(`${pc.cyan("[RUN]")} ${command} ${args.join(" ")}`);
|
|
90
|
+
const proc = spawn(command, args, {
|
|
91
|
+
cwd: root,
|
|
92
|
+
stdio: "inherit",
|
|
93
|
+
shell: true,
|
|
94
|
+
env,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
proc.on("close", (code) => {
|
|
98
|
+
if (code === 0) {
|
|
99
|
+
console.log(`${pc.green("[PASS]")} ${command} completed successfully`);
|
|
100
|
+
resolve(true);
|
|
101
|
+
} else {
|
|
102
|
+
console.log(`${pc.red("[FAIL]")} ${command} failed with code ${code}`);
|
|
103
|
+
resolve(false);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
proc.on("error", (err) => {
|
|
108
|
+
console.log(`${pc.red("[ERROR]")} ${command}: ${err.message}`);
|
|
109
|
+
resolve(false);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
async function formatEmitter(check: boolean): Promise<boolean> {
|
|
115
|
+
console.log(`\n${pc.bold("=== Formatting TypeScript Emitter ===")}\n`);
|
|
116
|
+
// Use prettier directly - it's available via node_modules/.bin in PATH
|
|
117
|
+
// Exclude CHANGELOG.md as it's managed by chronus changelog tool
|
|
118
|
+
const args = check
|
|
119
|
+
? [
|
|
120
|
+
"--check",
|
|
121
|
+
"emitter/",
|
|
122
|
+
"eng/scripts/",
|
|
123
|
+
"*.json",
|
|
124
|
+
"README.md",
|
|
125
|
+
"CONTRIBUTING.md",
|
|
126
|
+
"ARCHITECTURE.md",
|
|
127
|
+
]
|
|
128
|
+
: [
|
|
129
|
+
"--write",
|
|
130
|
+
"emitter/",
|
|
131
|
+
"eng/scripts/",
|
|
132
|
+
"*.json",
|
|
133
|
+
"README.md",
|
|
134
|
+
"CONTRIBUTING.md",
|
|
135
|
+
"ARCHITECTURE.md",
|
|
136
|
+
];
|
|
137
|
+
return runCommand("prettier", args);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
async function formatPygenSource(check: boolean): Promise<boolean> {
|
|
141
|
+
console.log(`\n${pc.bold("=== Formatting Python Generator (pygen) ===")}\n`);
|
|
142
|
+
|
|
143
|
+
let pythonPath: string;
|
|
144
|
+
try {
|
|
145
|
+
pythonPath = getVenvPython();
|
|
146
|
+
} catch (error) {
|
|
147
|
+
console.error(pc.red((error as Error).message));
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const args = [
|
|
152
|
+
"-m",
|
|
153
|
+
"black",
|
|
154
|
+
"generator/pygen",
|
|
155
|
+
"eng/scripts/",
|
|
156
|
+
"--config",
|
|
157
|
+
"./eng/scripts/ci/config/pyproject.toml",
|
|
158
|
+
];
|
|
159
|
+
if (check) {
|
|
160
|
+
args.push("--check");
|
|
161
|
+
}
|
|
162
|
+
return runCommand(pythonPath, args);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
async function formatGeneratedPackages(check: boolean): Promise<boolean> {
|
|
166
|
+
console.log(`\n${pc.bold("=== Formatting Generated SDK Packages ===")}\n`);
|
|
167
|
+
|
|
168
|
+
let pythonPath: string;
|
|
169
|
+
try {
|
|
170
|
+
pythonPath = getVenvPython();
|
|
171
|
+
} catch (error) {
|
|
172
|
+
console.error(pc.red((error as Error).message));
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const args = [
|
|
177
|
+
"-m",
|
|
178
|
+
"black",
|
|
179
|
+
"generator/test/azure/generated",
|
|
180
|
+
"generator/test/unbranded/generated",
|
|
181
|
+
"--config",
|
|
182
|
+
"./eng/scripts/ci/config/pyproject.toml",
|
|
183
|
+
];
|
|
184
|
+
if (check) {
|
|
185
|
+
args.push("--check");
|
|
186
|
+
}
|
|
187
|
+
return runCommand(pythonPath, args);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
async function main(): Promise<void> {
|
|
191
|
+
const runEmitter = argv.values.emitter;
|
|
192
|
+
const runGenerator = argv.values.generator;
|
|
193
|
+
const runGenerated = argv.values.generated;
|
|
194
|
+
const check = argv.values.check || false;
|
|
195
|
+
|
|
196
|
+
// If --generated is specified, only format generated packages
|
|
197
|
+
if (runGenerated) {
|
|
198
|
+
const result = await formatGeneratedPackages(check);
|
|
199
|
+
if (!result) process.exit(1);
|
|
200
|
+
console.log(
|
|
201
|
+
`\n${pc.green(pc.bold(`Generated SDK formatting ${check ? "check " : ""}complete!`))}\n`,
|
|
202
|
+
);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Default: format emitter + pygen source
|
|
207
|
+
const runBoth = !runEmitter && !runGenerator;
|
|
208
|
+
|
|
209
|
+
let success = true;
|
|
210
|
+
|
|
211
|
+
if (runEmitter || runBoth) {
|
|
212
|
+
const result = await formatEmitter(check);
|
|
213
|
+
if (!result) success = false;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (runGenerator || runBoth) {
|
|
217
|
+
const result = await formatPygenSource(check);
|
|
218
|
+
if (!result) success = false;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (!success) {
|
|
222
|
+
process.exit(1);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
console.log(
|
|
226
|
+
`\n${pc.green(pc.bold(`All formatting ${check ? "checks passed" : "complete"}!`))}\n`,
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
main().catch((error) => {
|
|
231
|
+
console.error(`${pc.red("Unexpected error:")}`, error);
|
|
232
|
+
process.exit(1);
|
|
233
|
+
});
|
package/eng/scripts/ci/lint.ts
CHANGED
|
@@ -1,36 +1,232 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import { spawn } from "child_process";
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import { dirname, join } from "path";
|
|
5
|
+
import pc from "picocolors";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
1
7
|
import { parseArgs } from "util";
|
|
2
|
-
import { runCommand } from "./utils.js";
|
|
3
8
|
|
|
4
|
-
|
|
9
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "../../../");
|
|
10
|
+
const monorepoRoot = join(root, "../../");
|
|
11
|
+
const testsDir = join(root, "tests");
|
|
12
|
+
|
|
13
|
+
// Get Python venv path
|
|
14
|
+
function getVenvPython(): string {
|
|
15
|
+
const venvPath = join(root, "venv");
|
|
16
|
+
if (fs.existsSync(join(venvPath, "bin"))) {
|
|
17
|
+
return join(venvPath, "bin", "python");
|
|
18
|
+
} else if (fs.existsSync(join(venvPath, "Scripts"))) {
|
|
19
|
+
return join(venvPath, "Scripts", "python.exe");
|
|
20
|
+
}
|
|
21
|
+
throw new Error("Virtual environment not found. Run 'npm run install' first.");
|
|
22
|
+
}
|
|
5
23
|
|
|
6
24
|
const argv = parseArgs({
|
|
7
25
|
args: process.argv.slice(2),
|
|
8
26
|
options: {
|
|
9
|
-
|
|
10
|
-
|
|
27
|
+
emitter: { type: "boolean", short: "e" },
|
|
28
|
+
generator: { type: "boolean", short: "g" },
|
|
29
|
+
generated: { type: "boolean" },
|
|
30
|
+
flavor: { type: "string", short: "f" },
|
|
31
|
+
help: { type: "boolean", short: "h" },
|
|
11
32
|
},
|
|
12
33
|
});
|
|
13
34
|
|
|
14
|
-
|
|
15
|
-
|
|
35
|
+
if (argv.values.help) {
|
|
36
|
+
console.log(`
|
|
37
|
+
${pc.bold("Usage:")} tsx lint.ts [options]
|
|
38
|
+
|
|
39
|
+
${pc.bold("Description:")}
|
|
40
|
+
Run linting checks on the codebase.
|
|
41
|
+
|
|
42
|
+
${pc.bold("Options:")}
|
|
43
|
+
${pc.cyan("-e, --emitter")}
|
|
44
|
+
Run ESLint on TypeScript emitter code.
|
|
45
|
+
|
|
46
|
+
${pc.cyan("-g, --generator")}
|
|
47
|
+
Run pylint on Python generator source code (pygen).
|
|
48
|
+
|
|
49
|
+
${pc.cyan("--generated")}
|
|
50
|
+
Run pylint on generated SDK packages (via tox).
|
|
51
|
+
Use with --flavor to specify azure or unbranded.
|
|
52
|
+
|
|
53
|
+
${pc.cyan("-f, --flavor <azure|unbranded>")}
|
|
54
|
+
SDK flavor to lint (only applies to --generated).
|
|
55
|
+
If not specified, lints both flavors.
|
|
56
|
+
|
|
57
|
+
${pc.cyan("-h, --help")}
|
|
58
|
+
Show this help message.
|
|
59
|
+
|
|
60
|
+
${pc.bold("Examples:")}
|
|
61
|
+
${pc.dim("# Lint emitter + pygen source (default)")}
|
|
62
|
+
tsx lint.ts
|
|
63
|
+
|
|
64
|
+
${pc.dim("# Lint only TypeScript emitter")}
|
|
65
|
+
tsx lint.ts --emitter
|
|
66
|
+
|
|
67
|
+
${pc.dim("# Lint only pygen source code")}
|
|
68
|
+
tsx lint.ts --generator
|
|
69
|
+
|
|
70
|
+
${pc.dim("# Lint generated SDK packages")}
|
|
71
|
+
tsx lint.ts --generated
|
|
72
|
+
|
|
73
|
+
${pc.dim("# Lint generated SDK packages for azure only")}
|
|
74
|
+
tsx lint.ts --generated --flavor=azure
|
|
75
|
+
`);
|
|
76
|
+
process.exit(0);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function runCommand(
|
|
80
|
+
command: string,
|
|
81
|
+
args: string[],
|
|
82
|
+
cwd?: string,
|
|
83
|
+
displayName?: string,
|
|
84
|
+
): Promise<boolean> {
|
|
85
|
+
const workingDir = cwd || root;
|
|
86
|
+
const name = displayName || command;
|
|
87
|
+
|
|
88
|
+
// Add node_modules/.bin directories to PATH so commands like eslint can be found
|
|
89
|
+
// Also set NODE_PATH so that config files can resolve packages from monorepo's node_modules
|
|
90
|
+
const pathSep = process.platform === "win32" ? ";" : ":";
|
|
91
|
+
const binPaths = [
|
|
92
|
+
join(workingDir, "node_modules", ".bin"),
|
|
93
|
+
join(root, "node_modules", ".bin"),
|
|
94
|
+
join(monorepoRoot, "node_modules", ".bin"),
|
|
95
|
+
].join(pathSep);
|
|
96
|
+
const nodePaths = [
|
|
97
|
+
join(workingDir, "node_modules"),
|
|
98
|
+
join(root, "node_modules"),
|
|
99
|
+
join(monorepoRoot, "node_modules"),
|
|
100
|
+
].join(pathSep);
|
|
101
|
+
const env = {
|
|
102
|
+
...process.env,
|
|
103
|
+
PATH: `${binPaths}${pathSep}${process.env.PATH}`,
|
|
104
|
+
NODE_PATH: nodePaths,
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
return new Promise((resolve) => {
|
|
108
|
+
// If displayName is provided, show it as-is; otherwise show command + args
|
|
109
|
+
const logMessage = displayName ? displayName : `${command} ${args.join(" ")}`;
|
|
110
|
+
console.log(`${pc.cyan("[RUN]")} ${logMessage}`);
|
|
111
|
+
const proc = spawn(command, args, {
|
|
112
|
+
cwd: workingDir,
|
|
113
|
+
stdio: "inherit",
|
|
114
|
+
shell: true,
|
|
115
|
+
env,
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
proc.on("close", (code) => {
|
|
119
|
+
if (code === 0) {
|
|
120
|
+
console.log(`${pc.green("[PASS]")} ${name} completed successfully`);
|
|
121
|
+
resolve(true);
|
|
122
|
+
} else {
|
|
123
|
+
console.log(`${pc.red("[FAIL]")} ${name} failed with code ${code}`);
|
|
124
|
+
resolve(false);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
proc.on("error", (err) => {
|
|
129
|
+
console.log(`${pc.red("[ERROR]")} ${name}: ${err.message}`);
|
|
130
|
+
resolve(false);
|
|
131
|
+
});
|
|
132
|
+
});
|
|
16
133
|
}
|
|
17
134
|
|
|
18
|
-
|
|
19
|
-
|
|
135
|
+
async function lintEmitter(): Promise<boolean> {
|
|
136
|
+
console.log(`\n${pc.bold("=== Linting TypeScript Emitter ===")}\n`);
|
|
137
|
+
// Run eslint with local config to avoid dependency on monorepo's eslint.config.js
|
|
138
|
+
// This ensures the package can be linted in CI without full monorepo dependencies
|
|
139
|
+
return runCommand(
|
|
140
|
+
"eslint",
|
|
141
|
+
["emitter/", "--config", "eng/scripts/ci/config/eslint-ci.config.mjs", "--max-warnings=0"],
|
|
142
|
+
root,
|
|
143
|
+
"eslint emitter/ --max-warnings=0",
|
|
144
|
+
);
|
|
20
145
|
}
|
|
21
146
|
|
|
22
|
-
|
|
23
|
-
|
|
147
|
+
async function lintPygenSource(): Promise<boolean> {
|
|
148
|
+
console.log(`\n${pc.bold("=== Linting Python Generator (pygen) ===")}\n`);
|
|
149
|
+
|
|
150
|
+
let pythonPath: string;
|
|
151
|
+
try {
|
|
152
|
+
pythonPath = getVenvPython();
|
|
153
|
+
} catch (error) {
|
|
154
|
+
console.error(pc.red((error as Error).message));
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Lint pygen source code directly with pylint
|
|
159
|
+
return runCommand(pythonPath, [
|
|
160
|
+
"-m",
|
|
161
|
+
"pylint",
|
|
162
|
+
"generator/pygen",
|
|
163
|
+
"--rcfile=eng/scripts/ci/config/pylintrc",
|
|
164
|
+
"--recursive=y",
|
|
165
|
+
"--py-version=3.9",
|
|
166
|
+
]);
|
|
24
167
|
}
|
|
25
168
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
169
|
+
async function lintGeneratedPackages(flavor?: string): Promise<boolean> {
|
|
170
|
+
const flavors = flavor ? [flavor] : ["azure", "unbranded"];
|
|
171
|
+
console.log(`\n${pc.bold(`=== Linting Generated SDK Packages (${flavors.join(", ")}) ===`)}\n`);
|
|
172
|
+
|
|
173
|
+
let pythonPath: string;
|
|
174
|
+
try {
|
|
175
|
+
pythonPath = getVenvPython();
|
|
176
|
+
} catch (error) {
|
|
177
|
+
console.error(pc.red((error as Error).message));
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
let success = true;
|
|
182
|
+
for (const f of flavors) {
|
|
183
|
+
const toxEnv = `lint-${f}`;
|
|
184
|
+
const result = await runCommand(
|
|
185
|
+
pythonPath,
|
|
186
|
+
["-m", "tox", "-c", "tox.ini", "-e", toxEnv],
|
|
187
|
+
testsDir,
|
|
188
|
+
);
|
|
189
|
+
if (!result) success = false;
|
|
190
|
+
}
|
|
191
|
+
return success;
|
|
36
192
|
}
|
|
193
|
+
|
|
194
|
+
async function main(): Promise<void> {
|
|
195
|
+
const runEmitter = argv.values.emitter;
|
|
196
|
+
const runGenerator = argv.values.generator;
|
|
197
|
+
const runGenerated = argv.values.generated;
|
|
198
|
+
|
|
199
|
+
// If --generated is specified, only lint generated packages
|
|
200
|
+
if (runGenerated) {
|
|
201
|
+
const result = await lintGeneratedPackages(argv.values.flavor);
|
|
202
|
+
if (!result) process.exit(1);
|
|
203
|
+
console.log(`\n${pc.green(pc.bold("Generated SDK linting complete!"))}\n`);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// Default: lint emitter + pygen source
|
|
208
|
+
const runBoth = !runEmitter && !runGenerator;
|
|
209
|
+
|
|
210
|
+
let success = true;
|
|
211
|
+
|
|
212
|
+
if (runEmitter || runBoth) {
|
|
213
|
+
const result = await lintEmitter();
|
|
214
|
+
if (!result) success = false;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (runGenerator || runBoth) {
|
|
218
|
+
const result = await lintPygenSource();
|
|
219
|
+
if (!result) success = false;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (!success) {
|
|
223
|
+
process.exit(1);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
console.log(`\n${pc.green(pc.bold("All linting checks passed!"))}\n`);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
main().catch((error) => {
|
|
230
|
+
console.error(`${pc.red("Unexpected error:")}`, error);
|
|
231
|
+
process.exit(1);
|
|
232
|
+
});
|
|
@@ -282,6 +282,7 @@ export interface RegenerateFlagsInput {
|
|
|
282
282
|
debug?: boolean;
|
|
283
283
|
name?: string;
|
|
284
284
|
pyodide?: boolean;
|
|
285
|
+
jobs?: number;
|
|
285
286
|
}
|
|
286
287
|
|
|
287
288
|
export interface RegenerateFlags {
|
|
@@ -403,8 +404,9 @@ export function buildOptions(
|
|
|
403
404
|
}
|
|
404
405
|
if (options["emitter-output-dir"] === undefined) {
|
|
405
406
|
const packageName = options["package-name"] || defaultPackageName(spec, config);
|
|
407
|
+
// Output to new tests/generated/<flavor>/<package> structure
|
|
406
408
|
options["emitter-output-dir"] = toPosix(
|
|
407
|
-
`${generatedFolder}/
|
|
409
|
+
`${generatedFolder}/../tests/generated/${flags.flavor}/${packageName}`,
|
|
408
410
|
);
|
|
409
411
|
}
|
|
410
412
|
if (flags.debug) {
|
|
@@ -423,21 +425,21 @@ export async function runTaskPool(
|
|
|
423
425
|
tasks: Array<() => Promise<void>>,
|
|
424
426
|
poolLimit: number,
|
|
425
427
|
): Promise<void> {
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
428
|
+
const executing: Set<Promise<void>> = new Set();
|
|
429
|
+
|
|
430
|
+
for (const task of tasks) {
|
|
431
|
+
// Start the task and remove from set when done
|
|
432
|
+
const p: Promise<void> = task().finally(() => executing.delete(p));
|
|
433
|
+
executing.add(p);
|
|
434
|
+
|
|
435
|
+
// If at capacity, wait for one to complete
|
|
436
|
+
if (executing.size >= poolLimit) {
|
|
437
|
+
await Promise.race(executing);
|
|
430
438
|
}
|
|
431
439
|
}
|
|
432
440
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
while (start < tasks.length) {
|
|
436
|
-
const end = Math.min(start + poolLimit, tasks.length);
|
|
437
|
-
workers.push((async () => await worker(start, end))());
|
|
438
|
-
start = end;
|
|
439
|
-
}
|
|
440
|
-
await Promise.all(workers);
|
|
441
|
+
// Wait for remaining tasks
|
|
442
|
+
await Promise.all(executing);
|
|
441
443
|
}
|
|
442
444
|
|
|
443
445
|
export async function regenerate(
|
|
@@ -467,6 +469,8 @@ export async function regenerate(
|
|
|
467
469
|
});
|
|
468
470
|
|
|
469
471
|
// Run tasks with a concurrency limit
|
|
470
|
-
|
|
472
|
+
// Default: 30 jobs, or use provided value
|
|
473
|
+
const poolLimit = flags.jobs ?? 30;
|
|
474
|
+
await runTaskPool(tasks, poolLimit);
|
|
471
475
|
}
|
|
472
476
|
}
|