From a37f15095eb57b21accdbfd23f35a64cedd0fbd7 Mon Sep 17 00:00:00 2001 From: AutoPrFromHttpClientPython Date: Wed, 29 Apr 2026 07:02:45 +0000 Subject: [PATCH 1/9] Update dependencies --- packages/autorest.python/package.json | 2 +- packages/typespec-python/package.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/autorest.python/package.json b/packages/autorest.python/package.json index e59809bc31..4230d517fa 100644 --- a/packages/autorest.python/package.json +++ b/packages/autorest.python/package.json @@ -29,7 +29,7 @@ }, "homepage": "https://github.com/Azure/autorest.python/blob/main/README.md", "dependencies": { - "@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjE3ODYzNi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz", + "@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjIyNTU3My9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz", "@autorest/system-requirements": "~1.0.2", "fs-extra": "~11.2.0", "tsx": "^4.21.0" diff --git a/packages/typespec-python/package.json b/packages/typespec-python/package.json index b68b4bd844..55cb45db85 100644 --- a/packages/typespec-python/package.json +++ b/packages/typespec-python/package.json @@ -65,7 +65,7 @@ "@typespec/xml": ">=0.81.0 <1.0.0" }, "dependencies": { - "@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjE3ODYzNi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz", + "@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjIyNTU3My9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz", "fs-extra": "~11.2.0", "js-yaml": "~4.1.0", "semver": "~7.6.2", @@ -106,4 +106,4 @@ "typescript-eslint": "^8.49.0", "vitest": "^4.0.15" } -} +} \ No newline at end of file From aecc989169c806e19a08fd9a4fdd778e721fcad4 Mon Sep 17 00:00:00 2001 From: AutoPrFromHttpClientPython Date: Wed, 29 Apr 2026 07:02:47 +0000 Subject: [PATCH 2/9] Sync shared files from typespec repo (2026-04-29 07:02:47) --- packages/typespec-python/dev_requirements.txt | 17 +- .../eng/scripts/regenerate-common.ts | 869 +++++++++--------- ...t_generation_subdir2_for_generated_code.py | 2 +- ...st_generation_subdir_for_generated_code.py | 2 +- 4 files changed, 456 insertions(+), 434 deletions(-) diff --git a/packages/typespec-python/dev_requirements.txt b/packages/typespec-python/dev_requirements.txt index f05990860c..42b0ed775a 100644 --- a/packages/typespec-python/dev_requirements.txt +++ b/packages/typespec-python/dev_requirements.txt @@ -1,15 +1,16 @@ # shall keep aligned with dev_requirements.txt of @typespec/http-client-python -pyright==1.1.391 -pylint==3.2.7 -tox==4.23.2 -mypy==1.13.0 +pyright==1.1.407 +pylint==4.0.4 +tox==4.16.0 +tox-uv +mypy==1.19.1 colorama==0.4.6 -debugpy==1.8.12 -pytest==8.3.4 +debugpy==1.8.2 +pytest==8.3.2 coverage==7.6.1 -black==24.8.0 +black==26.3.1 ptvsd==4.3.2 -types-PyYAML==6.0.12.20241230 +types-PyYAML==6.0.12.8 # additional dependency needed for development setuptools diff --git a/packages/typespec-python/eng/scripts/regenerate-common.ts b/packages/typespec-python/eng/scripts/regenerate-common.ts index a342f918e1..8dd426152b 100644 --- a/packages/typespec-python/eng/scripts/regenerate-common.ts +++ b/packages/typespec-python/eng/scripts/regenerate-common.ts @@ -6,470 +6,491 @@ import { dirname, join, relative, resolve } from "path"; export const SKIP_SPECS: string[] = ["type/file", "service/multiple-services"]; export const SpecialFlags: Record> = { - azure: { - "generate-test": true, - "generate-sample": true, - }, + azure: { + "generate-test": true, + "generate-sample": true, + }, }; // ---- Base emitter options (shared across repos) ---- -export const BASE_AZURE_EMITTER_OPTIONS: Record | Record[]> = { - "azure/client-generator-core/access": { - namespace: "specs.azure.clientgenerator.core.access", - }, - "azure/client-generator-core/alternate-type": { - namespace: "specs.azure.clientgenerator.core.alternatetype", - }, - "azure/client-generator-core/api-version": { - namespace: "specs.azure.clientgenerator.core.apiversion", - }, - "azure/client-generator-core/client-initialization/default": { - namespace: "specs.azure.clientgenerator.core.clientinitialization.default", - }, - "azure/client-generator-core/client-initialization/individually": { - namespace: "specs.azure.clientgenerator.core.clientinitialization.individually", - }, - "azure/client-generator-core/client-initialization/individuallyParent": { - namespace: "specs.azure.clientgenerator.core.clientinitialization.individuallyparent", - }, - "azure/client-generator-core/client-location": { - namespace: "specs.azure.clientgenerator.core.clientlocation", - }, - "azure/client-generator-core/deserialize-empty-string-as-null": { - namespace: "specs.azure.clientgenerator.core.emptystring", - }, - "azure/client-generator-core/flatten-property": { - namespace: "specs.azure.clientgenerator.core.flattenproperty", - }, - "azure/client-generator-core/usage": { - namespace: "specs.azure.clientgenerator.core.usage", - }, - "azure/client-generator-core/client-doc": { - namespace: "specs.azure.clientgenerator.core.clientdoc", - }, - "azure/client-generator-core/override": { - namespace: "specs.azure.clientgenerator.core.override", - }, - "azure/client-generator-core/hierarchy-building": { - namespace: "specs.azure.clientgenerator.core.hierarchybuilding", - }, - "azure/core/basic": { - namespace: "specs.azure.core.basic", - }, - "azure/core/lro/rpc": { - namespace: "specs.azure.core.lro.rpc", - }, - "azure/core/lro/standard": { - namespace: "specs.azure.core.lro.standard", - }, - "azure/core/model": { - namespace: "specs.azure.core.model", - }, - "azure/core/page": { - namespace: "specs.azure.core.page", - }, - "azure/core/scalar": { - namespace: "specs.azure.core.scalar", - }, - "azure/core/traits": { - namespace: "specs.azure.core.traits", - }, - "azure/encode/duration": { - namespace: "specs.azure.encode.duration", - }, - "azure/example/basic": { - namespace: "specs.azure.example.basic", - }, - "azure/payload/pageable": { - namespace: "specs.azure.payload.pageable", - }, - "azure/versioning/previewVersion": { - namespace: "specs.azure.versioning.previewversion", - }, - "client/structure/default": { - namespace: "client.structure.service", - }, - "client/structure/multi-client": { - "package-name": "client-structure-multiclient", - "namespace": "client.structure.multiclient", - }, - "client/structure/renamed-operation": { - "package-name": "client-structure-renamedoperation", - "namespace": "client.structure.renamedoperation", - }, - "client/structure/two-operation-group": { - "package-name": "client-structure-twooperationgroup", - "namespace": "client.structure.twooperationgroup", - }, - "client/naming": { - namespace: "client.naming.main", - }, - "client/overload": { - namespace: "client.overload", - }, - "encode/duration": { - namespace: "encode.duration", - }, - "encode/numeric": { - namespace: "encode.numeric", - }, - "parameters/basic": { - namespace: "parameters.basic", - }, - "parameters/spread": { - namespace: "parameters.spread", - }, - "payload/content-negotiation": { - namespace: "payload.contentnegotiation", - }, - "payload/multipart": { - namespace: "payload.multipart", - }, - "serialization/encoded-name/json": { - namespace: "serialization.encodedname.json", - }, - "special-words": { - namespace: "specialwords", - }, - "service/multi-service": { - namespace: "service.multiservice", - }, +export const BASE_AZURE_EMITTER_OPTIONS: Record< + string, + Record | Record[] +> = { + "azure/client-generator-core/access": { + namespace: "specs.azure.clientgenerator.core.access", + }, + "azure/client-generator-core/alternate-type": { + namespace: "specs.azure.clientgenerator.core.alternatetype", + }, + "azure/client-generator-core/api-version": { + namespace: "specs.azure.clientgenerator.core.apiversion", + }, + "azure/client-generator-core/client-initialization/default": { + namespace: "specs.azure.clientgenerator.core.clientinitialization.default", + }, + "azure/client-generator-core/client-initialization/individually": { + namespace: "specs.azure.clientgenerator.core.clientinitialization.individually", + }, + "azure/client-generator-core/client-initialization/individuallyParent": { + namespace: "specs.azure.clientgenerator.core.clientinitialization.individuallyparent", + }, + "azure/client-generator-core/client-location": { + namespace: "specs.azure.clientgenerator.core.clientlocation", + }, + "azure/client-generator-core/deserialize-empty-string-as-null": { + namespace: "specs.azure.clientgenerator.core.emptystring", + }, + "azure/client-generator-core/flatten-property": { + namespace: "specs.azure.clientgenerator.core.flattenproperty", + }, + "azure/client-generator-core/usage": { + namespace: "specs.azure.clientgenerator.core.usage", + }, + "azure/client-generator-core/client-doc": { + namespace: "specs.azure.clientgenerator.core.clientdoc", + }, + "azure/client-generator-core/override": { + namespace: "specs.azure.clientgenerator.core.override", + }, + "azure/client-generator-core/hierarchy-building": { + namespace: "specs.azure.clientgenerator.core.hierarchybuilding", + }, + "azure/core/basic": { + namespace: "specs.azure.core.basic", + }, + "azure/core/lro/rpc": { + namespace: "specs.azure.core.lro.rpc", + }, + "azure/core/lro/standard": { + namespace: "specs.azure.core.lro.standard", + }, + "azure/core/model": { + namespace: "specs.azure.core.model", + }, + "azure/core/page": { + namespace: "specs.azure.core.page", + }, + "azure/core/scalar": { + namespace: "specs.azure.core.scalar", + }, + "azure/core/traits": { + namespace: "specs.azure.core.traits", + }, + "azure/encode/duration": { + namespace: "specs.azure.encode.duration", + }, + "azure/example/basic": { + namespace: "specs.azure.example.basic", + }, + "azure/payload/pageable": { + namespace: "specs.azure.payload.pageable", + }, + "azure/versioning/previewVersion": { + namespace: "specs.azure.versioning.previewversion", + }, + "client/structure/default": { + namespace: "client.structure.service", + }, + "client/structure/multi-client": { + "package-name": "client-structure-multiclient", + namespace: "client.structure.multiclient", + }, + "client/structure/renamed-operation": { + "package-name": "client-structure-renamedoperation", + namespace: "client.structure.renamedoperation", + }, + "client/structure/two-operation-group": { + "package-name": "client-structure-twooperationgroup", + namespace: "client.structure.twooperationgroup", + }, + "client/naming": { + namespace: "client.naming.main", + }, + "client/overload": { + namespace: "client.overload", + }, + "encode/duration": { + namespace: "encode.duration", + }, + "encode/numeric": { + namespace: "encode.numeric", + }, + "parameters/basic": { + namespace: "parameters.basic", + }, + "parameters/spread": { + namespace: "parameters.spread", + }, + "payload/content-negotiation": { + namespace: "payload.contentnegotiation", + }, + "payload/multipart": { + namespace: "payload.multipart", + }, + "serialization/encoded-name/json": { + namespace: "serialization.encodedname.json", + }, + "special-words": { + namespace: "specialwords", + }, + "service/multi-service": { + namespace: "service.multiservice", + }, }; -export const BASE_EMITTER_OPTIONS: Record | Record[]> = { - "resiliency/srv-driven/old.tsp": { - "package-name": "resiliency-srv-driven1", - "namespace": "resiliency.srv.driven1", - "package-mode": "azure-dataplane", - "package-pprint-name": "ResiliencySrvDriven1", - }, - "resiliency/srv-driven": { - "package-name": "resiliency-srv-driven2", - "namespace": "resiliency.srv.driven2", - "package-mode": "azure-dataplane", - "package-pprint-name": "ResiliencySrvDriven2", - }, - "authentication/api-key": { - "clear-output-folder": "true", - }, - "authentication/http/custom": { - "package-name": "authentication-http-custom", - "namespace": "authentication.http.custom", - "package-pprint-name": "Authentication Http Custom", - }, - "authentication/union": [ - { - "package-name": "authentication-union", - "namespace": "authentication.union", - }, - { - "package-name": "setuppy-authentication-union", - "namespace": "setuppy.authentication.union", - "keep-setup-py": "true", - }, - ], - "type/array": { - "package-name": "typetest-array", - "namespace": "typetest.array", - }, - "type/dictionary": { - "package-name": "typetest-dictionary", - "namespace": "typetest.dictionary", - }, - "type/enum/extensible": { - "package-name": "typetest-enum-extensible", - "namespace": "typetest.enum.extensible", - }, - "type/enum/fixed": { - "package-name": "typetest-enum-fixed", - "namespace": "typetest.enum.fixed", - }, - "type/model/empty": { - "package-name": "typetest-model-empty", - "namespace": "typetest.model.empty", - }, - "type/model/inheritance/enum-discriminator": { - "package-name": "typetest-model-enumdiscriminator", - "namespace": "typetest.model.enumdiscriminator", - }, - "type/model/inheritance/nested-discriminator": { - "package-name": "typetest-model-nesteddiscriminator", - "namespace": "typetest.model.nesteddiscriminator", - }, - "type/model/inheritance/not-discriminated": { - "package-name": "typetest-model-notdiscriminated", - "namespace": "typetest.model.notdiscriminated", - }, - "type/model/inheritance/single-discriminator": { - "package-name": "typetest-model-singlediscriminator", - "namespace": "typetest.model.singlediscriminator", - }, - "type/model/inheritance/recursive": [ - { - "package-name": "typetest-model-recursive", - "namespace": "typetest.model.recursive", - }, - { - // basic test for configuration "generation-subdir" - "package-name": "generation-subdir", - "namespace": "generation.subdir", - "generation-subdir": "_generated", - "generate-test": "false", - "clear-output-folder": "true", - }, - ], - "type/model/usage": { - "package-name": "typetest-model-usage", - "namespace": "typetest.model.usage", - }, - "type/model/visibility": [ - { - "package-name": "typetest-model-visibility", - "namespace": "typetest.model.visibility", - }, - { - "package-name": "headasbooleantrue", - "namespace": "headasbooleantrue", - "head-as-boolean": "true", - }, - { - "package-name": "headasbooleanfalse", - "namespace": "headasbooleanfalse", - "head-as-boolean": "false", - }, - ], - "type/property/nullable": { - "package-name": "typetest-property-nullable", - "namespace": "typetest.property.nullable", - }, - "type/property/optionality": { - "package-name": "typetest-property-optional", - "namespace": "typetest.property.optional", - }, - "type/property/additional-properties": { - "package-name": "typetest-property-additionalproperties", - "namespace": "typetest.property.additionalproperties", - }, - "type/scalar": { - "package-name": "typetest-scalar", - "namespace": "typetest.scalar", - }, - "type/property/value-types": { - "package-name": "typetest-property-valuetypes", - "namespace": "typetest.property.valuetypes", - }, - "type/union": { - "package-name": "typetest-union", - "namespace": "typetest.union", - }, - "type/union/discriminated": { - "package-name": "typetest-discriminatedunion", - "namespace": "typetest.discriminatedunion", - }, - "type/file": { - "package-name": "typetest-file", - "namespace": "typetest.file", - }, - "documentation": { - "package-name": "specs-documentation", - "namespace": "specs.documentation", - }, - "versioning/added": [ - { - "package-name": "versioning-added", - "namespace": "versioning.added", - }, - // check whether import of _validation.py/_types.py works when "generation-subdir" is configured - { - "package-name": "generation-subdir2", - "namespace": "generation.subdir2", - "generate-test": "false", - "generation-subdir": "_generated", - }, - ], +export const BASE_EMITTER_OPTIONS: Record< + string, + Record | Record[] +> = { + "resiliency/srv-driven/old.tsp": { + "package-name": "resiliency-srv-driven1", + namespace: "resiliency.srv.driven1", + "package-mode": "azure-dataplane", + "package-pprint-name": "ResiliencySrvDriven1", + }, + "resiliency/srv-driven": { + "package-name": "resiliency-srv-driven2", + namespace: "resiliency.srv.driven2", + "package-mode": "azure-dataplane", + "package-pprint-name": "ResiliencySrvDriven2", + }, + "authentication/api-key": { + "clear-output-folder": "true", + }, + "authentication/http/custom": { + "package-name": "authentication-http-custom", + namespace: "authentication.http.custom", + "package-pprint-name": "Authentication Http Custom", + }, + "authentication/union": [ + { + "package-name": "authentication-union", + namespace: "authentication.union", + }, + { + "package-name": "setuppy-authentication-union", + namespace: "setuppy.authentication.union", + "keep-setup-py": "true", + }, + ], + "type/array": { + "package-name": "typetest-array", + namespace: "typetest.array", + }, + "type/dictionary": { + "package-name": "typetest-dictionary", + namespace: "typetest.dictionary", + }, + "type/enum/extensible": { + "package-name": "typetest-enum-extensible", + namespace: "typetest.enum.extensible", + }, + "type/enum/fixed": { + "package-name": "typetest-enum-fixed", + namespace: "typetest.enum.fixed", + }, + "type/model/empty": { + "package-name": "typetest-model-empty", + namespace: "typetest.model.empty", + }, + "type/model/inheritance/enum-discriminator": { + "package-name": "typetest-model-enumdiscriminator", + namespace: "typetest.model.enumdiscriminator", + }, + "type/model/inheritance/nested-discriminator": { + "package-name": "typetest-model-nesteddiscriminator", + namespace: "typetest.model.nesteddiscriminator", + }, + "type/model/inheritance/not-discriminated": { + "package-name": "typetest-model-notdiscriminated", + namespace: "typetest.model.notdiscriminated", + }, + "type/model/inheritance/single-discriminator": { + "package-name": "typetest-model-singlediscriminator", + namespace: "typetest.model.singlediscriminator", + }, + "type/model/inheritance/recursive": [ + { + "package-name": "typetest-model-recursive", + namespace: "typetest.model.recursive", + }, + { + // basic test for configuration "generation-subdir" + "package-name": "generation-subdir", + namespace: "generation.subdir", + "generation-subdir": "_generated", + "generate-test": "false", + "clear-output-folder": "true", + }, + ], + "type/model/usage": { + "package-name": "typetest-model-usage", + namespace: "typetest.model.usage", + }, + "type/model/visibility": [ + { + "package-name": "typetest-model-visibility", + namespace: "typetest.model.visibility", + }, + { + "package-name": "headasbooleantrue", + namespace: "headasbooleantrue", + "head-as-boolean": "true", + }, + { + "package-name": "headasbooleanfalse", + namespace: "headasbooleanfalse", + "head-as-boolean": "false", + }, + ], + "type/property/nullable": { + "package-name": "typetest-property-nullable", + namespace: "typetest.property.nullable", + }, + "type/property/optionality": { + "package-name": "typetest-property-optional", + namespace: "typetest.property.optional", + }, + "type/property/additional-properties": { + "package-name": "typetest-property-additionalproperties", + namespace: "typetest.property.additionalproperties", + }, + "type/scalar": { + "package-name": "typetest-scalar", + namespace: "typetest.scalar", + }, + "type/property/value-types": { + "package-name": "typetest-property-valuetypes", + namespace: "typetest.property.valuetypes", + }, + "type/union": { + "package-name": "typetest-union", + namespace: "typetest.union", + }, + "type/union/discriminated": { + "package-name": "typetest-discriminatedunion", + namespace: "typetest.discriminatedunion", + }, + "type/file": { + "package-name": "typetest-file", + namespace: "typetest.file", + }, + documentation: { + "package-name": "specs-documentation", + namespace: "specs.documentation", + }, + "versioning/added": [ + { + "package-name": "versioning-added", + namespace: "versioning.added", + }, + // check whether import of _validation.py/_types.py works when "generation-subdir" is configured + { + "package-name": "generation-subdir2", + namespace: "generation.subdir2", + "generate-test": "false", + "generation-subdir": "_generated", + }, + ], }; // ---- Shared interfaces ---- export interface TspCommand { - outputDir: string; - command: string | string[]; + outputDir: string; + command: string | string[]; } export interface RegenerateFlagsInput { - flavor?: string; - debug?: boolean; - name?: string; - pyodide?: boolean; - jobs?: number; + flavor?: string; + debug?: boolean; + name?: string; + pyodide?: boolean; + jobs?: number; } export interface RegenerateFlags { - flavor: string; - debug: boolean; - name?: string; - pyodide?: boolean; + flavor: string; + debug: boolean; + name?: string; + pyodide?: boolean; } export interface RegenerateConfig { - azureHttpSpecs: string; - httpSpecs: string; - emitterOptions: Record | Record[]>; - azureEmitterOptions: Record | Record[]>; - preprocess: (flags: RegenerateFlagsInput) => Promise; - getCmdList: (spec: string, flags: RegenerateFlags) => TspCommand[]; - executeCommand: (cmd: TspCommand) => Promise; + azureHttpSpecs: string; + httpSpecs: string; + emitterOptions: Record | Record[]>; + azureEmitterOptions: Record | Record[]>; + preprocess: (flags: RegenerateFlagsInput) => Promise; + getCmdList: (spec: string, flags: RegenerateFlags) => TspCommand[]; + executeCommand: (cmd: TspCommand) => Promise; } // ---- Shared utility functions ---- export function toPosix(dir: string): string { - return dir.replace(/\\/g, "/"); + return dir.replace(/\\/g, "/"); } -export function getEmitterOption(spec: string, flavor: string, config: RegenerateConfig): Record[] { - const specDir = spec.includes("azure") ? config.azureHttpSpecs : config.httpSpecs; - const relativeSpec = toPosix(relative(specDir, spec)); - const key = relativeSpec.includes("resiliency/srv-driven/old.tsp") ? relativeSpec : dirname(relativeSpec); - const emitter_options = config.emitterOptions[key] || - (flavor === "azure" ? config.azureEmitterOptions[key] : [{}]) || [{}]; - return Array.isArray(emitter_options) ? emitter_options : [emitter_options]; +export function getEmitterOption( + spec: string, + flavor: string, + config: RegenerateConfig, +): Record[] { + const specDir = spec.includes("azure") ? config.azureHttpSpecs : config.httpSpecs; + const relativeSpec = toPosix(relative(specDir, spec)); + const key = relativeSpec.includes("resiliency/srv-driven/old.tsp") + ? relativeSpec + : dirname(relativeSpec); + const emitter_options = config.emitterOptions[key] || + (flavor === "azure" ? config.azureEmitterOptions[key] : [{}]) || [{}]; + return Array.isArray(emitter_options) ? emitter_options : [emitter_options]; } -export async function getSubdirectories(baseDir: string, flags: RegenerateFlags): Promise { - const subdirectories: string[] = []; - - async function searchDir(currentDir: string) { - const items = await promises.readdir(currentDir, { withFileTypes: true }); - - const promisesArray = items.map(async (item) => { - const subDirPath = join(currentDir, item.name); - if (item.isDirectory()) { - const mainTspPath = join(subDirPath, "main.tsp"); - const clientTspPath = join(subDirPath, "client.tsp"); - - const mainTspRelativePath = toPosix(relative(baseDir, mainTspPath)); - - if (SKIP_SPECS.some((skipSpec) => mainTspRelativePath.includes(skipSpec))) return; - - const hasMainTsp = await promises - .access(mainTspPath) - .then(() => true) - .catch(() => false); - const hasClientTsp = await promises - .access(clientTspPath) - .then(() => true) - .catch(() => false); - - if (mainTspRelativePath.toLowerCase().includes(flags.name || "")) { - if (mainTspRelativePath.includes("resiliency/srv-driven")) { - subdirectories.push(resolve(subDirPath, "old.tsp")); - } - if (hasClientTsp) { - subdirectories.push(resolve(subDirPath, "client.tsp")); - } else if (hasMainTsp) { - subdirectories.push(resolve(subDirPath, "main.tsp")); - } - } - - // Recursively search in the subdirectory - await searchDir(subDirPath); - } - }); - - await Promise.all(promisesArray); - } +export async function getSubdirectories( + baseDir: string, + flags: RegenerateFlags, +): Promise { + const subdirectories: string[] = []; + + async function searchDir(currentDir: string) { + const items = await promises.readdir(currentDir, { withFileTypes: true }); + + const promisesArray = items.map(async (item) => { + const subDirPath = join(currentDir, item.name); + if (item.isDirectory()) { + const mainTspPath = join(subDirPath, "main.tsp"); + const clientTspPath = join(subDirPath, "client.tsp"); + + const mainTspRelativePath = toPosix(relative(baseDir, mainTspPath)); + + if (SKIP_SPECS.some((skipSpec) => mainTspRelativePath.includes(skipSpec))) return; + + const hasMainTsp = await promises + .access(mainTspPath) + .then(() => true) + .catch(() => false); + const hasClientTsp = await promises + .access(clientTspPath) + .then(() => true) + .catch(() => false); + + if (mainTspRelativePath.toLowerCase().includes(flags.name || "")) { + if (mainTspRelativePath.includes("resiliency/srv-driven")) { + subdirectories.push(resolve(subDirPath, "old.tsp")); + } + if (hasClientTsp) { + subdirectories.push(resolve(subDirPath, "client.tsp")); + } else if (hasMainTsp) { + subdirectories.push(resolve(subDirPath, "main.tsp")); + } + } + + // Recursively search in the subdirectory + await searchDir(subDirPath); + } + }); - await searchDir(baseDir); - return subdirectories; + await Promise.all(promisesArray); + } + + await searchDir(baseDir); + return subdirectories; } -export async function runTaskPool(tasks: Array<() => Promise>, poolLimit: number): Promise { - const executing: Set> = new Set(); +export async function runTaskPool( + tasks: Array<() => Promise>, + poolLimit: number, +): Promise { + const executing: Set> = new Set(); - for (const task of tasks) { - // Start the task and remove from set when done - const p: Promise = task().finally(() => executing.delete(p)); - executing.add(p); + for (const task of tasks) { + // Start the task and remove from set when done + const p: Promise = task().finally(() => executing.delete(p)); + executing.add(p); - // If at capacity, wait for one to complete - if (executing.size >= poolLimit) { - await Promise.race(executing); - } + // If at capacity, wait for one to complete + if (executing.size >= poolLimit) { + await Promise.race(executing); } + } - // Wait for remaining tasks - await Promise.all(executing); + // Wait for remaining tasks + await Promise.all(executing); } -export async function regenerate(flags: RegenerateFlagsInput, config: RegenerateConfig): Promise { - if (flags.flavor === undefined) { - await regenerate({ flavor: "azure", ...flags }, config); - await regenerate({ flavor: "unbranded", ...flags }, config); - } else { - await config.preprocess(flags); - - const flagsResolved: RegenerateFlags = { debug: false, flavor: flags.flavor, ...flags }; - const subdirectoriesForAzure = await getSubdirectories(config.azureHttpSpecs, flagsResolved); - const subdirectoriesForNonAzure = await getSubdirectories(config.httpSpecs, flagsResolved); - const subdirectories = - flags.flavor === "azure" - ? [...subdirectoriesForAzure, ...subdirectoriesForNonAzure] - : subdirectoriesForNonAzure; - const cmdList: TspCommand[] = subdirectories.flatMap((subdirectory) => - config.getCmdList(subdirectory, flagsResolved), - ); - - // Create tasks as functions for the pool - const tasks: Array<() => Promise> = cmdList.map((tspCommand) => { - return () => config.executeCommand(tspCommand); - }); - - // Run tasks with a concurrency limit - // Default: 30 jobs, or use provided value - const poolLimit = flags.jobs ?? 30; - await runTaskPool(tasks, poolLimit); - } +export async function regenerate( + flags: RegenerateFlagsInput, + config: RegenerateConfig, +): Promise { + if (flags.flavor === undefined) { + await regenerate({ flavor: "azure", ...flags }, config); + await regenerate({ flavor: "unbranded", ...flags }, config); + } else { + await config.preprocess(flags); + + const flagsResolved: RegenerateFlags = { debug: false, flavor: flags.flavor, ...flags }; + const subdirectoriesForAzure = await getSubdirectories(config.azureHttpSpecs, flagsResolved); + const subdirectoriesForNonAzure = await getSubdirectories(config.httpSpecs, flagsResolved); + const subdirectories = + flags.flavor === "azure" + ? [...subdirectoriesForAzure, ...subdirectoriesForNonAzure] + : subdirectoriesForNonAzure; + const cmdList: TspCommand[] = subdirectories.flatMap((subdirectory) => + config.getCmdList(subdirectory, flagsResolved), + ); + + // Create tasks as functions for the pool + const tasks: Array<() => Promise> = cmdList.map((tspCommand) => { + return () => config.executeCommand(tspCommand); + }); + + // Run tasks with a concurrency limit + // Default: 30 jobs, or use provided value + const poolLimit = flags.jobs ?? 30; + await runTaskPool(tasks, poolLimit); + } } // Preprocess: create files that should be deleted after regeneration (for testing) export async function preprocess(flavor: string, generatedFolder: string): Promise { - if (flavor === "azure") { - // Use tests/generated// structure (same as output) - const testsGeneratedDir = resolve(generatedFolder, "../tests/generated/azure"); - - const DELETE_CONTENT = "# This file is to be deleted after regeneration"; - const DELETE_FILE = "to_be_deleted.py"; - const entries: { folder: string[]; file: string; content: string }[] = [ - { - folder: ["authentication-api-key", "authentication", "apikey", "_operations"], - file: DELETE_FILE, - content: DELETE_CONTENT, - }, - { - folder: ["generation-subdir", "generation", "subdir", "_generated"], - file: DELETE_FILE, - content: DELETE_CONTENT, - }, - { - folder: ["generation-subdir", "generated_tests"], - file: DELETE_FILE, - content: DELETE_CONTENT, - }, - { - folder: ["generation-subdir", "generation", "subdir"], - file: "to_be_kept.py", - content: "# This file is to be kept after regeneration", - }, - ]; - - await Promise.all( - entries.map(async ({ folder, file, content }) => { - const targetFolder = join(testsGeneratedDir, ...folder); - await promises.mkdir(targetFolder, { recursive: true }); - await promises.writeFile(join(targetFolder, file), content); - }), - ); - } + if (flavor === "azure") { + // Use tests/generated// structure (same as output) + const testsGeneratedDir = resolve(generatedFolder, "../tests/generated/azure"); + + const DELETE_CONTENT = "# This file is to be deleted after regeneration"; + const DELETE_FILE = "to_be_deleted.py"; + const entries: { folder: string[]; file: string; content: string }[] = [ + { + folder: ["authentication-api-key", "authentication", "apikey", "_operations"], + file: DELETE_FILE, + content: DELETE_CONTENT, + }, + { + folder: ["generation-subdir", "generation", "subdir", "_generated"], + file: DELETE_FILE, + content: DELETE_CONTENT, + }, + { + folder: ["generation-subdir", "generated_tests"], + file: DELETE_FILE, + content: DELETE_CONTENT, + }, + { + folder: ["generation-subdir", "generation", "subdir"], + file: "to_be_kept.py", + content: "# This file is to be kept after regeneration", + }, + ]; + + await Promise.all( + entries.map(async ({ folder, file, content }) => { + const targetFolder = join(testsGeneratedDir, ...folder); + await promises.mkdir(targetFolder, { recursive: true }); + await promises.writeFile(join(targetFolder, file), content); + }), + ); + } } diff --git a/packages/typespec-python/tests/mock_api/shared/test_generation_subdir2_for_generated_code.py b/packages/typespec-python/tests/mock_api/shared/test_generation_subdir2_for_generated_code.py index 345defd17b..32bbfc784d 100644 --- a/packages/typespec-python/tests/mock_api/shared/test_generation_subdir2_for_generated_code.py +++ b/packages/typespec-python/tests/mock_api/shared/test_generation_subdir2_for_generated_code.py @@ -30,4 +30,4 @@ def test_v2(client: AddedClient): def test_interface_v2(client: AddedClient): assert client.interface_v2.v2_in_interface( ModelV2(prop="foo", enum_prop=EnumV2.ENUM_MEMBER, union_prop="bar") - ) == ModelV2(prop="foo", enum_prop=EnumV2.ENUM_MEMBER, union_prop="bar") + ) == ModelV2(prop="foo", enum_prop=EnumV2.ENUM_MEMBER, union_prop="bar") \ No newline at end of file diff --git a/packages/typespec-python/tests/mock_api/shared/test_generation_subdir_for_generated_code.py b/packages/typespec-python/tests/mock_api/shared/test_generation_subdir_for_generated_code.py index 661fbaecf2..3750a98f1a 100644 --- a/packages/typespec-python/tests/mock_api/shared/test_generation_subdir_for_generated_code.py +++ b/packages/typespec-python/tests/mock_api/shared/test_generation_subdir_for_generated_code.py @@ -14,4 +14,4 @@ def test_custom_method(): "level": 0, "extension": [{"level": 1, "extension": [{"level": 2}]}, {"level": 1}], } - ) + ) \ No newline at end of file From 2f0e39e34d70b4b9973879aa51a9f8f4a70926ba Mon Sep 17 00:00:00 2001 From: AutoPrFromHttpClientPython Date: Wed, 29 Apr 2026 07:02:48 +0000 Subject: [PATCH 3/9] Add changelog --- ...ilot-fix-enum-name-compile-error-2026-3-16-5-51-48.md | 8 ++++++++ .../python-addBackApiViewSphinx-2026-3-9-12-35-1.md | 8 ++++++++ .chronus/changes/python-drop-39-2026-4-27-6-50-0.md | 9 +++++++++ .chronus/changes/python-fixCI-2026-3-24-14-53-10.md | 8 ++++++++ ...ython-update-contributing-docs-2026-04-23-10-47-41.md | 8 ++++++++ .chronus/changes/revert-wrong-code-2026-3-29-13-46-47.md | 8 ++++++++ 6 files changed, 49 insertions(+) create mode 100644 .chronus/changes/copilot-fix-enum-name-compile-error-2026-3-16-5-51-48.md create mode 100644 .chronus/changes/python-addBackApiViewSphinx-2026-3-9-12-35-1.md create mode 100644 .chronus/changes/python-drop-39-2026-4-27-6-50-0.md create mode 100644 .chronus/changes/python-fixCI-2026-3-24-14-53-10.md create mode 100644 .chronus/changes/python-update-contributing-docs-2026-04-23-10-47-41.md create mode 100644 .chronus/changes/revert-wrong-code-2026-3-29-13-46-47.md diff --git a/.chronus/changes/copilot-fix-enum-name-compile-error-2026-3-16-5-51-48.md b/.chronus/changes/copilot-fix-enum-name-compile-error-2026-3-16-5-51-48.md new file mode 100644 index 0000000000..a4b3733935 --- /dev/null +++ b/.chronus/changes/copilot-fix-enum-name-compile-error-2026-3-16-5-51-48.md @@ -0,0 +1,8 @@ +--- +changeKind: fix +packages: + - "@autorest/python" + - "@azure-tools/typespec-python" +--- + +Fix enum member names with hyphens generating invalid Python identifiers \ No newline at end of file diff --git a/.chronus/changes/python-addBackApiViewSphinx-2026-3-9-12-35-1.md b/.chronus/changes/python-addBackApiViewSphinx-2026-3-9-12-35-1.md new file mode 100644 index 0000000000..70fd0fb014 --- /dev/null +++ b/.chronus/changes/python-addBackApiViewSphinx-2026-3-9-12-35-1.md @@ -0,0 +1,8 @@ +--- +changeKind: internal +packages: + - "@autorest/python" + - "@azure-tools/typespec-python" +--- + +Add apiview and sphinx to ci \ No newline at end of file diff --git a/.chronus/changes/python-drop-39-2026-4-27-6-50-0.md b/.chronus/changes/python-drop-39-2026-4-27-6-50-0.md new file mode 100644 index 0000000000..f7cc418f14 --- /dev/null +++ b/.chronus/changes/python-drop-39-2026-4-27-6-50-0.md @@ -0,0 +1,9 @@ +--- +# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking +changeKind: deprecation +packages: + - "@autorest/python" + - "@azure-tools/typespec-python" +--- + +Drop support for Python 3.9. The minimum supported Python version is now 3.10. Python 3.9 reached end-of-life and is no longer supported by upstream Python. diff --git a/.chronus/changes/python-fixCI-2026-3-24-14-53-10.md b/.chronus/changes/python-fixCI-2026-3-24-14-53-10.md new file mode 100644 index 0000000000..1b3efbca4a --- /dev/null +++ b/.chronus/changes/python-fixCI-2026-3-24-14-53-10.md @@ -0,0 +1,8 @@ +--- +changeKind: internal +packages: + - "@autorest/python" + - "@azure-tools/typespec-python" +--- + +Fix failing CI \ No newline at end of file diff --git a/.chronus/changes/python-update-contributing-docs-2026-04-23-10-47-41.md b/.chronus/changes/python-update-contributing-docs-2026-04-23-10-47-41.md new file mode 100644 index 0000000000..1b89804394 --- /dev/null +++ b/.chronus/changes/python-update-contributing-docs-2026-04-23-10-47-41.md @@ -0,0 +1,8 @@ +--- +changeKind: internal +packages: + - "@autorest/python" + - "@azure-tools/typespec-python" +--- + +Fix transient mypy CI failures on Windows with retry logic and update CONTRIBUTING docs to reflect the new end-to-end release workflow diff --git a/.chronus/changes/revert-wrong-code-2026-3-29-13-46-47.md b/.chronus/changes/revert-wrong-code-2026-3-29-13-46-47.md new file mode 100644 index 0000000000..8c6a2fb198 --- /dev/null +++ b/.chronus/changes/revert-wrong-code-2026-3-29-13-46-47.md @@ -0,0 +1,8 @@ +--- +changeKind: fix +packages: + - "@autorest/python" + - "@azure-tools/typespec-python" +--- + +Revert wrong code to avoid overwrite customized code when generation-subdir is set \ No newline at end of file From e7aa5c6d2ba53728cdf43bd7cd33d154613dab49 Mon Sep 17 00:00:00 2001 From: AutoPrFromHttpClientPython Date: Wed, 29 Apr 2026 07:03:58 +0000 Subject: [PATCH 4/9] Update dependencies (2026-04-29 07:03:58) --- .../eng/scripts/regenerate-common.ts | 869 +++++++++--------- .../eng/scripts/setup/venvtools.py | 1 - packages/typespec-python/package.json | 2 +- ...t_generation_subdir2_for_generated_code.py | 2 +- ...st_generation_subdir_for_generated_code.py | 2 +- .../tests/mock_api/unbranded/conftest.py | 1 - pnpm-lock.yaml | 14 +- 7 files changed, 434 insertions(+), 457 deletions(-) diff --git a/packages/typespec-python/eng/scripts/regenerate-common.ts b/packages/typespec-python/eng/scripts/regenerate-common.ts index 8dd426152b..a342f918e1 100644 --- a/packages/typespec-python/eng/scripts/regenerate-common.ts +++ b/packages/typespec-python/eng/scripts/regenerate-common.ts @@ -6,491 +6,470 @@ import { dirname, join, relative, resolve } from "path"; export const SKIP_SPECS: string[] = ["type/file", "service/multiple-services"]; export const SpecialFlags: Record> = { - azure: { - "generate-test": true, - "generate-sample": true, - }, + azure: { + "generate-test": true, + "generate-sample": true, + }, }; // ---- Base emitter options (shared across repos) ---- -export const BASE_AZURE_EMITTER_OPTIONS: Record< - string, - Record | Record[] -> = { - "azure/client-generator-core/access": { - namespace: "specs.azure.clientgenerator.core.access", - }, - "azure/client-generator-core/alternate-type": { - namespace: "specs.azure.clientgenerator.core.alternatetype", - }, - "azure/client-generator-core/api-version": { - namespace: "specs.azure.clientgenerator.core.apiversion", - }, - "azure/client-generator-core/client-initialization/default": { - namespace: "specs.azure.clientgenerator.core.clientinitialization.default", - }, - "azure/client-generator-core/client-initialization/individually": { - namespace: "specs.azure.clientgenerator.core.clientinitialization.individually", - }, - "azure/client-generator-core/client-initialization/individuallyParent": { - namespace: "specs.azure.clientgenerator.core.clientinitialization.individuallyparent", - }, - "azure/client-generator-core/client-location": { - namespace: "specs.azure.clientgenerator.core.clientlocation", - }, - "azure/client-generator-core/deserialize-empty-string-as-null": { - namespace: "specs.azure.clientgenerator.core.emptystring", - }, - "azure/client-generator-core/flatten-property": { - namespace: "specs.azure.clientgenerator.core.flattenproperty", - }, - "azure/client-generator-core/usage": { - namespace: "specs.azure.clientgenerator.core.usage", - }, - "azure/client-generator-core/client-doc": { - namespace: "specs.azure.clientgenerator.core.clientdoc", - }, - "azure/client-generator-core/override": { - namespace: "specs.azure.clientgenerator.core.override", - }, - "azure/client-generator-core/hierarchy-building": { - namespace: "specs.azure.clientgenerator.core.hierarchybuilding", - }, - "azure/core/basic": { - namespace: "specs.azure.core.basic", - }, - "azure/core/lro/rpc": { - namespace: "specs.azure.core.lro.rpc", - }, - "azure/core/lro/standard": { - namespace: "specs.azure.core.lro.standard", - }, - "azure/core/model": { - namespace: "specs.azure.core.model", - }, - "azure/core/page": { - namespace: "specs.azure.core.page", - }, - "azure/core/scalar": { - namespace: "specs.azure.core.scalar", - }, - "azure/core/traits": { - namespace: "specs.azure.core.traits", - }, - "azure/encode/duration": { - namespace: "specs.azure.encode.duration", - }, - "azure/example/basic": { - namespace: "specs.azure.example.basic", - }, - "azure/payload/pageable": { - namespace: "specs.azure.payload.pageable", - }, - "azure/versioning/previewVersion": { - namespace: "specs.azure.versioning.previewversion", - }, - "client/structure/default": { - namespace: "client.structure.service", - }, - "client/structure/multi-client": { - "package-name": "client-structure-multiclient", - namespace: "client.structure.multiclient", - }, - "client/structure/renamed-operation": { - "package-name": "client-structure-renamedoperation", - namespace: "client.structure.renamedoperation", - }, - "client/structure/two-operation-group": { - "package-name": "client-structure-twooperationgroup", - namespace: "client.structure.twooperationgroup", - }, - "client/naming": { - namespace: "client.naming.main", - }, - "client/overload": { - namespace: "client.overload", - }, - "encode/duration": { - namespace: "encode.duration", - }, - "encode/numeric": { - namespace: "encode.numeric", - }, - "parameters/basic": { - namespace: "parameters.basic", - }, - "parameters/spread": { - namespace: "parameters.spread", - }, - "payload/content-negotiation": { - namespace: "payload.contentnegotiation", - }, - "payload/multipart": { - namespace: "payload.multipart", - }, - "serialization/encoded-name/json": { - namespace: "serialization.encodedname.json", - }, - "special-words": { - namespace: "specialwords", - }, - "service/multi-service": { - namespace: "service.multiservice", - }, +export const BASE_AZURE_EMITTER_OPTIONS: Record | Record[]> = { + "azure/client-generator-core/access": { + namespace: "specs.azure.clientgenerator.core.access", + }, + "azure/client-generator-core/alternate-type": { + namespace: "specs.azure.clientgenerator.core.alternatetype", + }, + "azure/client-generator-core/api-version": { + namespace: "specs.azure.clientgenerator.core.apiversion", + }, + "azure/client-generator-core/client-initialization/default": { + namespace: "specs.azure.clientgenerator.core.clientinitialization.default", + }, + "azure/client-generator-core/client-initialization/individually": { + namespace: "specs.azure.clientgenerator.core.clientinitialization.individually", + }, + "azure/client-generator-core/client-initialization/individuallyParent": { + namespace: "specs.azure.clientgenerator.core.clientinitialization.individuallyparent", + }, + "azure/client-generator-core/client-location": { + namespace: "specs.azure.clientgenerator.core.clientlocation", + }, + "azure/client-generator-core/deserialize-empty-string-as-null": { + namespace: "specs.azure.clientgenerator.core.emptystring", + }, + "azure/client-generator-core/flatten-property": { + namespace: "specs.azure.clientgenerator.core.flattenproperty", + }, + "azure/client-generator-core/usage": { + namespace: "specs.azure.clientgenerator.core.usage", + }, + "azure/client-generator-core/client-doc": { + namespace: "specs.azure.clientgenerator.core.clientdoc", + }, + "azure/client-generator-core/override": { + namespace: "specs.azure.clientgenerator.core.override", + }, + "azure/client-generator-core/hierarchy-building": { + namespace: "specs.azure.clientgenerator.core.hierarchybuilding", + }, + "azure/core/basic": { + namespace: "specs.azure.core.basic", + }, + "azure/core/lro/rpc": { + namespace: "specs.azure.core.lro.rpc", + }, + "azure/core/lro/standard": { + namespace: "specs.azure.core.lro.standard", + }, + "azure/core/model": { + namespace: "specs.azure.core.model", + }, + "azure/core/page": { + namespace: "specs.azure.core.page", + }, + "azure/core/scalar": { + namespace: "specs.azure.core.scalar", + }, + "azure/core/traits": { + namespace: "specs.azure.core.traits", + }, + "azure/encode/duration": { + namespace: "specs.azure.encode.duration", + }, + "azure/example/basic": { + namespace: "specs.azure.example.basic", + }, + "azure/payload/pageable": { + namespace: "specs.azure.payload.pageable", + }, + "azure/versioning/previewVersion": { + namespace: "specs.azure.versioning.previewversion", + }, + "client/structure/default": { + namespace: "client.structure.service", + }, + "client/structure/multi-client": { + "package-name": "client-structure-multiclient", + "namespace": "client.structure.multiclient", + }, + "client/structure/renamed-operation": { + "package-name": "client-structure-renamedoperation", + "namespace": "client.structure.renamedoperation", + }, + "client/structure/two-operation-group": { + "package-name": "client-structure-twooperationgroup", + "namespace": "client.structure.twooperationgroup", + }, + "client/naming": { + namespace: "client.naming.main", + }, + "client/overload": { + namespace: "client.overload", + }, + "encode/duration": { + namespace: "encode.duration", + }, + "encode/numeric": { + namespace: "encode.numeric", + }, + "parameters/basic": { + namespace: "parameters.basic", + }, + "parameters/spread": { + namespace: "parameters.spread", + }, + "payload/content-negotiation": { + namespace: "payload.contentnegotiation", + }, + "payload/multipart": { + namespace: "payload.multipart", + }, + "serialization/encoded-name/json": { + namespace: "serialization.encodedname.json", + }, + "special-words": { + namespace: "specialwords", + }, + "service/multi-service": { + namespace: "service.multiservice", + }, }; -export const BASE_EMITTER_OPTIONS: Record< - string, - Record | Record[] -> = { - "resiliency/srv-driven/old.tsp": { - "package-name": "resiliency-srv-driven1", - namespace: "resiliency.srv.driven1", - "package-mode": "azure-dataplane", - "package-pprint-name": "ResiliencySrvDriven1", - }, - "resiliency/srv-driven": { - "package-name": "resiliency-srv-driven2", - namespace: "resiliency.srv.driven2", - "package-mode": "azure-dataplane", - "package-pprint-name": "ResiliencySrvDriven2", - }, - "authentication/api-key": { - "clear-output-folder": "true", - }, - "authentication/http/custom": { - "package-name": "authentication-http-custom", - namespace: "authentication.http.custom", - "package-pprint-name": "Authentication Http Custom", - }, - "authentication/union": [ - { - "package-name": "authentication-union", - namespace: "authentication.union", - }, - { - "package-name": "setuppy-authentication-union", - namespace: "setuppy.authentication.union", - "keep-setup-py": "true", - }, - ], - "type/array": { - "package-name": "typetest-array", - namespace: "typetest.array", - }, - "type/dictionary": { - "package-name": "typetest-dictionary", - namespace: "typetest.dictionary", - }, - "type/enum/extensible": { - "package-name": "typetest-enum-extensible", - namespace: "typetest.enum.extensible", - }, - "type/enum/fixed": { - "package-name": "typetest-enum-fixed", - namespace: "typetest.enum.fixed", - }, - "type/model/empty": { - "package-name": "typetest-model-empty", - namespace: "typetest.model.empty", - }, - "type/model/inheritance/enum-discriminator": { - "package-name": "typetest-model-enumdiscriminator", - namespace: "typetest.model.enumdiscriminator", - }, - "type/model/inheritance/nested-discriminator": { - "package-name": "typetest-model-nesteddiscriminator", - namespace: "typetest.model.nesteddiscriminator", - }, - "type/model/inheritance/not-discriminated": { - "package-name": "typetest-model-notdiscriminated", - namespace: "typetest.model.notdiscriminated", - }, - "type/model/inheritance/single-discriminator": { - "package-name": "typetest-model-singlediscriminator", - namespace: "typetest.model.singlediscriminator", - }, - "type/model/inheritance/recursive": [ - { - "package-name": "typetest-model-recursive", - namespace: "typetest.model.recursive", - }, - { - // basic test for configuration "generation-subdir" - "package-name": "generation-subdir", - namespace: "generation.subdir", - "generation-subdir": "_generated", - "generate-test": "false", - "clear-output-folder": "true", - }, - ], - "type/model/usage": { - "package-name": "typetest-model-usage", - namespace: "typetest.model.usage", - }, - "type/model/visibility": [ - { - "package-name": "typetest-model-visibility", - namespace: "typetest.model.visibility", - }, - { - "package-name": "headasbooleantrue", - namespace: "headasbooleantrue", - "head-as-boolean": "true", - }, - { - "package-name": "headasbooleanfalse", - namespace: "headasbooleanfalse", - "head-as-boolean": "false", - }, - ], - "type/property/nullable": { - "package-name": "typetest-property-nullable", - namespace: "typetest.property.nullable", - }, - "type/property/optionality": { - "package-name": "typetest-property-optional", - namespace: "typetest.property.optional", - }, - "type/property/additional-properties": { - "package-name": "typetest-property-additionalproperties", - namespace: "typetest.property.additionalproperties", - }, - "type/scalar": { - "package-name": "typetest-scalar", - namespace: "typetest.scalar", - }, - "type/property/value-types": { - "package-name": "typetest-property-valuetypes", - namespace: "typetest.property.valuetypes", - }, - "type/union": { - "package-name": "typetest-union", - namespace: "typetest.union", - }, - "type/union/discriminated": { - "package-name": "typetest-discriminatedunion", - namespace: "typetest.discriminatedunion", - }, - "type/file": { - "package-name": "typetest-file", - namespace: "typetest.file", - }, - documentation: { - "package-name": "specs-documentation", - namespace: "specs.documentation", - }, - "versioning/added": [ - { - "package-name": "versioning-added", - namespace: "versioning.added", - }, - // check whether import of _validation.py/_types.py works when "generation-subdir" is configured - { - "package-name": "generation-subdir2", - namespace: "generation.subdir2", - "generate-test": "false", - "generation-subdir": "_generated", - }, - ], +export const BASE_EMITTER_OPTIONS: Record | Record[]> = { + "resiliency/srv-driven/old.tsp": { + "package-name": "resiliency-srv-driven1", + "namespace": "resiliency.srv.driven1", + "package-mode": "azure-dataplane", + "package-pprint-name": "ResiliencySrvDriven1", + }, + "resiliency/srv-driven": { + "package-name": "resiliency-srv-driven2", + "namespace": "resiliency.srv.driven2", + "package-mode": "azure-dataplane", + "package-pprint-name": "ResiliencySrvDriven2", + }, + "authentication/api-key": { + "clear-output-folder": "true", + }, + "authentication/http/custom": { + "package-name": "authentication-http-custom", + "namespace": "authentication.http.custom", + "package-pprint-name": "Authentication Http Custom", + }, + "authentication/union": [ + { + "package-name": "authentication-union", + "namespace": "authentication.union", + }, + { + "package-name": "setuppy-authentication-union", + "namespace": "setuppy.authentication.union", + "keep-setup-py": "true", + }, + ], + "type/array": { + "package-name": "typetest-array", + "namespace": "typetest.array", + }, + "type/dictionary": { + "package-name": "typetest-dictionary", + "namespace": "typetest.dictionary", + }, + "type/enum/extensible": { + "package-name": "typetest-enum-extensible", + "namespace": "typetest.enum.extensible", + }, + "type/enum/fixed": { + "package-name": "typetest-enum-fixed", + "namespace": "typetest.enum.fixed", + }, + "type/model/empty": { + "package-name": "typetest-model-empty", + "namespace": "typetest.model.empty", + }, + "type/model/inheritance/enum-discriminator": { + "package-name": "typetest-model-enumdiscriminator", + "namespace": "typetest.model.enumdiscriminator", + }, + "type/model/inheritance/nested-discriminator": { + "package-name": "typetest-model-nesteddiscriminator", + "namespace": "typetest.model.nesteddiscriminator", + }, + "type/model/inheritance/not-discriminated": { + "package-name": "typetest-model-notdiscriminated", + "namespace": "typetest.model.notdiscriminated", + }, + "type/model/inheritance/single-discriminator": { + "package-name": "typetest-model-singlediscriminator", + "namespace": "typetest.model.singlediscriminator", + }, + "type/model/inheritance/recursive": [ + { + "package-name": "typetest-model-recursive", + "namespace": "typetest.model.recursive", + }, + { + // basic test for configuration "generation-subdir" + "package-name": "generation-subdir", + "namespace": "generation.subdir", + "generation-subdir": "_generated", + "generate-test": "false", + "clear-output-folder": "true", + }, + ], + "type/model/usage": { + "package-name": "typetest-model-usage", + "namespace": "typetest.model.usage", + }, + "type/model/visibility": [ + { + "package-name": "typetest-model-visibility", + "namespace": "typetest.model.visibility", + }, + { + "package-name": "headasbooleantrue", + "namespace": "headasbooleantrue", + "head-as-boolean": "true", + }, + { + "package-name": "headasbooleanfalse", + "namespace": "headasbooleanfalse", + "head-as-boolean": "false", + }, + ], + "type/property/nullable": { + "package-name": "typetest-property-nullable", + "namespace": "typetest.property.nullable", + }, + "type/property/optionality": { + "package-name": "typetest-property-optional", + "namespace": "typetest.property.optional", + }, + "type/property/additional-properties": { + "package-name": "typetest-property-additionalproperties", + "namespace": "typetest.property.additionalproperties", + }, + "type/scalar": { + "package-name": "typetest-scalar", + "namespace": "typetest.scalar", + }, + "type/property/value-types": { + "package-name": "typetest-property-valuetypes", + "namespace": "typetest.property.valuetypes", + }, + "type/union": { + "package-name": "typetest-union", + "namespace": "typetest.union", + }, + "type/union/discriminated": { + "package-name": "typetest-discriminatedunion", + "namespace": "typetest.discriminatedunion", + }, + "type/file": { + "package-name": "typetest-file", + "namespace": "typetest.file", + }, + "documentation": { + "package-name": "specs-documentation", + "namespace": "specs.documentation", + }, + "versioning/added": [ + { + "package-name": "versioning-added", + "namespace": "versioning.added", + }, + // check whether import of _validation.py/_types.py works when "generation-subdir" is configured + { + "package-name": "generation-subdir2", + "namespace": "generation.subdir2", + "generate-test": "false", + "generation-subdir": "_generated", + }, + ], }; // ---- Shared interfaces ---- export interface TspCommand { - outputDir: string; - command: string | string[]; + outputDir: string; + command: string | string[]; } export interface RegenerateFlagsInput { - flavor?: string; - debug?: boolean; - name?: string; - pyodide?: boolean; - jobs?: number; + flavor?: string; + debug?: boolean; + name?: string; + pyodide?: boolean; + jobs?: number; } export interface RegenerateFlags { - flavor: string; - debug: boolean; - name?: string; - pyodide?: boolean; + flavor: string; + debug: boolean; + name?: string; + pyodide?: boolean; } export interface RegenerateConfig { - azureHttpSpecs: string; - httpSpecs: string; - emitterOptions: Record | Record[]>; - azureEmitterOptions: Record | Record[]>; - preprocess: (flags: RegenerateFlagsInput) => Promise; - getCmdList: (spec: string, flags: RegenerateFlags) => TspCommand[]; - executeCommand: (cmd: TspCommand) => Promise; + azureHttpSpecs: string; + httpSpecs: string; + emitterOptions: Record | Record[]>; + azureEmitterOptions: Record | Record[]>; + preprocess: (flags: RegenerateFlagsInput) => Promise; + getCmdList: (spec: string, flags: RegenerateFlags) => TspCommand[]; + executeCommand: (cmd: TspCommand) => Promise; } // ---- Shared utility functions ---- export function toPosix(dir: string): string { - return dir.replace(/\\/g, "/"); + return dir.replace(/\\/g, "/"); } -export function getEmitterOption( - spec: string, - flavor: string, - config: RegenerateConfig, -): Record[] { - const specDir = spec.includes("azure") ? config.azureHttpSpecs : config.httpSpecs; - const relativeSpec = toPosix(relative(specDir, spec)); - const key = relativeSpec.includes("resiliency/srv-driven/old.tsp") - ? relativeSpec - : dirname(relativeSpec); - const emitter_options = config.emitterOptions[key] || - (flavor === "azure" ? config.azureEmitterOptions[key] : [{}]) || [{}]; - return Array.isArray(emitter_options) ? emitter_options : [emitter_options]; +export function getEmitterOption(spec: string, flavor: string, config: RegenerateConfig): Record[] { + const specDir = spec.includes("azure") ? config.azureHttpSpecs : config.httpSpecs; + const relativeSpec = toPosix(relative(specDir, spec)); + const key = relativeSpec.includes("resiliency/srv-driven/old.tsp") ? relativeSpec : dirname(relativeSpec); + const emitter_options = config.emitterOptions[key] || + (flavor === "azure" ? config.azureEmitterOptions[key] : [{}]) || [{}]; + return Array.isArray(emitter_options) ? emitter_options : [emitter_options]; } -export async function getSubdirectories( - baseDir: string, - flags: RegenerateFlags, -): Promise { - const subdirectories: string[] = []; - - async function searchDir(currentDir: string) { - const items = await promises.readdir(currentDir, { withFileTypes: true }); - - const promisesArray = items.map(async (item) => { - const subDirPath = join(currentDir, item.name); - if (item.isDirectory()) { - const mainTspPath = join(subDirPath, "main.tsp"); - const clientTspPath = join(subDirPath, "client.tsp"); - - const mainTspRelativePath = toPosix(relative(baseDir, mainTspPath)); - - if (SKIP_SPECS.some((skipSpec) => mainTspRelativePath.includes(skipSpec))) return; - - const hasMainTsp = await promises - .access(mainTspPath) - .then(() => true) - .catch(() => false); - const hasClientTsp = await promises - .access(clientTspPath) - .then(() => true) - .catch(() => false); - - if (mainTspRelativePath.toLowerCase().includes(flags.name || "")) { - if (mainTspRelativePath.includes("resiliency/srv-driven")) { - subdirectories.push(resolve(subDirPath, "old.tsp")); - } - if (hasClientTsp) { - subdirectories.push(resolve(subDirPath, "client.tsp")); - } else if (hasMainTsp) { - subdirectories.push(resolve(subDirPath, "main.tsp")); - } - } - - // Recursively search in the subdirectory - await searchDir(subDirPath); - } - }); - - await Promise.all(promisesArray); - } +export async function getSubdirectories(baseDir: string, flags: RegenerateFlags): Promise { + const subdirectories: string[] = []; + + async function searchDir(currentDir: string) { + const items = await promises.readdir(currentDir, { withFileTypes: true }); + + const promisesArray = items.map(async (item) => { + const subDirPath = join(currentDir, item.name); + if (item.isDirectory()) { + const mainTspPath = join(subDirPath, "main.tsp"); + const clientTspPath = join(subDirPath, "client.tsp"); + + const mainTspRelativePath = toPosix(relative(baseDir, mainTspPath)); + + if (SKIP_SPECS.some((skipSpec) => mainTspRelativePath.includes(skipSpec))) return; + + const hasMainTsp = await promises + .access(mainTspPath) + .then(() => true) + .catch(() => false); + const hasClientTsp = await promises + .access(clientTspPath) + .then(() => true) + .catch(() => false); + + if (mainTspRelativePath.toLowerCase().includes(flags.name || "")) { + if (mainTspRelativePath.includes("resiliency/srv-driven")) { + subdirectories.push(resolve(subDirPath, "old.tsp")); + } + if (hasClientTsp) { + subdirectories.push(resolve(subDirPath, "client.tsp")); + } else if (hasMainTsp) { + subdirectories.push(resolve(subDirPath, "main.tsp")); + } + } + + // Recursively search in the subdirectory + await searchDir(subDirPath); + } + }); + + await Promise.all(promisesArray); + } - await searchDir(baseDir); - return subdirectories; + await searchDir(baseDir); + return subdirectories; } -export async function runTaskPool( - tasks: Array<() => Promise>, - poolLimit: number, -): Promise { - const executing: Set> = new Set(); +export async function runTaskPool(tasks: Array<() => Promise>, poolLimit: number): Promise { + const executing: Set> = new Set(); - for (const task of tasks) { - // Start the task and remove from set when done - const p: Promise = task().finally(() => executing.delete(p)); - executing.add(p); + for (const task of tasks) { + // Start the task and remove from set when done + const p: Promise = task().finally(() => executing.delete(p)); + executing.add(p); - // If at capacity, wait for one to complete - if (executing.size >= poolLimit) { - await Promise.race(executing); + // If at capacity, wait for one to complete + if (executing.size >= poolLimit) { + await Promise.race(executing); + } } - } - // Wait for remaining tasks - await Promise.all(executing); + // Wait for remaining tasks + await Promise.all(executing); } -export async function regenerate( - flags: RegenerateFlagsInput, - config: RegenerateConfig, -): Promise { - if (flags.flavor === undefined) { - await regenerate({ flavor: "azure", ...flags }, config); - await regenerate({ flavor: "unbranded", ...flags }, config); - } else { - await config.preprocess(flags); - - const flagsResolved: RegenerateFlags = { debug: false, flavor: flags.flavor, ...flags }; - const subdirectoriesForAzure = await getSubdirectories(config.azureHttpSpecs, flagsResolved); - const subdirectoriesForNonAzure = await getSubdirectories(config.httpSpecs, flagsResolved); - const subdirectories = - flags.flavor === "azure" - ? [...subdirectoriesForAzure, ...subdirectoriesForNonAzure] - : subdirectoriesForNonAzure; - const cmdList: TspCommand[] = subdirectories.flatMap((subdirectory) => - config.getCmdList(subdirectory, flagsResolved), - ); - - // Create tasks as functions for the pool - const tasks: Array<() => Promise> = cmdList.map((tspCommand) => { - return () => config.executeCommand(tspCommand); - }); - - // Run tasks with a concurrency limit - // Default: 30 jobs, or use provided value - const poolLimit = flags.jobs ?? 30; - await runTaskPool(tasks, poolLimit); - } +export async function regenerate(flags: RegenerateFlagsInput, config: RegenerateConfig): Promise { + if (flags.flavor === undefined) { + await regenerate({ flavor: "azure", ...flags }, config); + await regenerate({ flavor: "unbranded", ...flags }, config); + } else { + await config.preprocess(flags); + + const flagsResolved: RegenerateFlags = { debug: false, flavor: flags.flavor, ...flags }; + const subdirectoriesForAzure = await getSubdirectories(config.azureHttpSpecs, flagsResolved); + const subdirectoriesForNonAzure = await getSubdirectories(config.httpSpecs, flagsResolved); + const subdirectories = + flags.flavor === "azure" + ? [...subdirectoriesForAzure, ...subdirectoriesForNonAzure] + : subdirectoriesForNonAzure; + const cmdList: TspCommand[] = subdirectories.flatMap((subdirectory) => + config.getCmdList(subdirectory, flagsResolved), + ); + + // Create tasks as functions for the pool + const tasks: Array<() => Promise> = cmdList.map((tspCommand) => { + return () => config.executeCommand(tspCommand); + }); + + // Run tasks with a concurrency limit + // Default: 30 jobs, or use provided value + const poolLimit = flags.jobs ?? 30; + await runTaskPool(tasks, poolLimit); + } } // Preprocess: create files that should be deleted after regeneration (for testing) export async function preprocess(flavor: string, generatedFolder: string): Promise { - if (flavor === "azure") { - // Use tests/generated// structure (same as output) - const testsGeneratedDir = resolve(generatedFolder, "../tests/generated/azure"); - - const DELETE_CONTENT = "# This file is to be deleted after regeneration"; - const DELETE_FILE = "to_be_deleted.py"; - const entries: { folder: string[]; file: string; content: string }[] = [ - { - folder: ["authentication-api-key", "authentication", "apikey", "_operations"], - file: DELETE_FILE, - content: DELETE_CONTENT, - }, - { - folder: ["generation-subdir", "generation", "subdir", "_generated"], - file: DELETE_FILE, - content: DELETE_CONTENT, - }, - { - folder: ["generation-subdir", "generated_tests"], - file: DELETE_FILE, - content: DELETE_CONTENT, - }, - { - folder: ["generation-subdir", "generation", "subdir"], - file: "to_be_kept.py", - content: "# This file is to be kept after regeneration", - }, - ]; - - await Promise.all( - entries.map(async ({ folder, file, content }) => { - const targetFolder = join(testsGeneratedDir, ...folder); - await promises.mkdir(targetFolder, { recursive: true }); - await promises.writeFile(join(targetFolder, file), content); - }), - ); - } + if (flavor === "azure") { + // Use tests/generated// structure (same as output) + const testsGeneratedDir = resolve(generatedFolder, "../tests/generated/azure"); + + const DELETE_CONTENT = "# This file is to be deleted after regeneration"; + const DELETE_FILE = "to_be_deleted.py"; + const entries: { folder: string[]; file: string; content: string }[] = [ + { + folder: ["authentication-api-key", "authentication", "apikey", "_operations"], + file: DELETE_FILE, + content: DELETE_CONTENT, + }, + { + folder: ["generation-subdir", "generation", "subdir", "_generated"], + file: DELETE_FILE, + content: DELETE_CONTENT, + }, + { + folder: ["generation-subdir", "generated_tests"], + file: DELETE_FILE, + content: DELETE_CONTENT, + }, + { + folder: ["generation-subdir", "generation", "subdir"], + file: "to_be_kept.py", + content: "# This file is to be kept after regeneration", + }, + ]; + + await Promise.all( + entries.map(async ({ folder, file, content }) => { + const targetFolder = join(testsGeneratedDir, ...folder); + await promises.mkdir(targetFolder, { recursive: true }); + await promises.writeFile(join(targetFolder, file), content); + }), + ); + } } diff --git a/packages/typespec-python/eng/scripts/setup/venvtools.py b/packages/typespec-python/eng/scripts/setup/venvtools.py index f15abdd525..c733957dc9 100644 --- a/packages/typespec-python/eng/scripts/setup/venvtools.py +++ b/packages/typespec-python/eng/scripts/setup/venvtools.py @@ -8,7 +8,6 @@ import sys from pathlib import Path - _ROOT_DIR = Path(__file__).parent.parent diff --git a/packages/typespec-python/package.json b/packages/typespec-python/package.json index 55cb45db85..f98a367616 100644 --- a/packages/typespec-python/package.json +++ b/packages/typespec-python/package.json @@ -106,4 +106,4 @@ "typescript-eslint": "^8.49.0", "vitest": "^4.0.15" } -} \ No newline at end of file +} diff --git a/packages/typespec-python/tests/mock_api/shared/test_generation_subdir2_for_generated_code.py b/packages/typespec-python/tests/mock_api/shared/test_generation_subdir2_for_generated_code.py index 32bbfc784d..345defd17b 100644 --- a/packages/typespec-python/tests/mock_api/shared/test_generation_subdir2_for_generated_code.py +++ b/packages/typespec-python/tests/mock_api/shared/test_generation_subdir2_for_generated_code.py @@ -30,4 +30,4 @@ def test_v2(client: AddedClient): def test_interface_v2(client: AddedClient): assert client.interface_v2.v2_in_interface( ModelV2(prop="foo", enum_prop=EnumV2.ENUM_MEMBER, union_prop="bar") - ) == ModelV2(prop="foo", enum_prop=EnumV2.ENUM_MEMBER, union_prop="bar") \ No newline at end of file + ) == ModelV2(prop="foo", enum_prop=EnumV2.ENUM_MEMBER, union_prop="bar") diff --git a/packages/typespec-python/tests/mock_api/shared/test_generation_subdir_for_generated_code.py b/packages/typespec-python/tests/mock_api/shared/test_generation_subdir_for_generated_code.py index 3750a98f1a..661fbaecf2 100644 --- a/packages/typespec-python/tests/mock_api/shared/test_generation_subdir_for_generated_code.py +++ b/packages/typespec-python/tests/mock_api/shared/test_generation_subdir_for_generated_code.py @@ -14,4 +14,4 @@ def test_custom_method(): "level": 0, "extension": [{"level": 1, "extension": [{"level": 2}]}, {"level": 1}], } - ) \ No newline at end of file + ) diff --git a/packages/typespec-python/tests/mock_api/unbranded/conftest.py b/packages/typespec-python/tests/mock_api/unbranded/conftest.py index a94535b690..1d69d8bd1e 100644 --- a/packages/typespec-python/tests/mock_api/unbranded/conftest.py +++ b/packages/typespec-python/tests/mock_api/unbranded/conftest.py @@ -10,7 +10,6 @@ import pytest from typing import List - SPECIAL_WORDS = [ "and", "as", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1ba3a2a856..362bd689bf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -60,8 +60,8 @@ importers: specifier: ~1.0.2 version: 1.0.2 '@typespec/http-client-python': - specifier: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjE3ODYzNi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz - version: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjE3ODYzNi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz(y2blksstlsblh3iqmgy3brbone) + specifier: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjIyNTU3My9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz + version: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjIyNTU3My9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz(y2blksstlsblh3iqmgy3brbone) fs-extra: specifier: ~11.2.0 version: 11.2.0 @@ -82,8 +82,8 @@ importers: packages/typespec-python: dependencies: '@typespec/http-client-python': - specifier: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjE3ODYzNi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz - version: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjE3ODYzNi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz(y2blksstlsblh3iqmgy3brbone) + specifier: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjIyNTU3My9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz + version: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjIyNTU3My9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz(y2blksstlsblh3iqmgy3brbone) fs-extra: specifier: ~11.2.0 version: 11.2.0 @@ -1723,8 +1723,8 @@ packages: peerDependencies: '@typespec/compiler': ^1.11.0 - '@typespec/http-client-python@https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjE3ODYzNi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz': - resolution: {tarball: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjE3ODYzNi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz} + '@typespec/http-client-python@https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjIyNTU3My9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz': + resolution: {tarball: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjIyNTU3My9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz} version: 0.28.3 engines: {node: '>=20.0.0'} peerDependencies: @@ -6708,7 +6708,7 @@ snapshots: dependencies: '@typespec/compiler': 1.11.0(@types/node@25.0.10) - '@typespec/http-client-python@https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjE3ODYzNi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz(y2blksstlsblh3iqmgy3brbone)': + '@typespec/http-client-python@https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjIyNTU3My9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz(y2blksstlsblh3iqmgy3brbone)': dependencies: '@azure-tools/typespec-autorest': 0.67.0(7o3sem7p6i3t4jykacdovvl7ii) '@azure-tools/typespec-azure-core': 0.67.0(@typespec/compiler@1.11.0(@types/node@25.0.10))(@typespec/http@1.11.0(@typespec/compiler@1.11.0(@types/node@25.0.10))(@typespec/streams@0.81.0(@typespec/compiler@1.11.0(@types/node@25.0.10))))(@typespec/rest@0.81.0(@typespec/compiler@1.11.0(@types/node@25.0.10))(@typespec/http@1.11.0(@typespec/compiler@1.11.0(@types/node@25.0.10))(@typespec/streams@0.81.0(@typespec/compiler@1.11.0(@types/node@25.0.10))))) From f482c4b56e6fbcc46909788fa02f3c812141fdea Mon Sep 17 00:00:00 2001 From: AutoPrFromHttpClientPython Date: Wed, 29 Apr 2026 07:10:18 +0000 Subject: [PATCH 5/9] Regenerate for typespec-python (2026-04-29 07:10:18) --- .../authentication/apikey/_client.py | 7 ++++++- .../apikey/_operations/_patch.py | 1 + .../authentication/apikey/_patch.py | 1 + .../authentication/apikey/_utils/model_base.py | 18 +++++++++++------- .../apikey/_utils/serialization.py | 6 +++++- .../authentication/apikey/aio/_client.py | 7 ++++++- .../apikey/aio/_operations/_patch.py | 1 + .../authentication/apikey/aio/_patch.py | 1 + .../authentication/apikey/models/_patch.py | 1 + .../authentication-api-key/pyproject.toml | 3 +-- .../authentication/http/custom/_client.py | 7 ++++++- .../http/custom/_operations/_patch.py | 1 + .../authentication/http/custom/_patch.py | 1 + .../http/custom/_utils/model_base.py | 18 +++++++++++------- .../http/custom/_utils/serialization.py | 6 +++++- .../authentication/http/custom/aio/_client.py | 7 ++++++- .../http/custom/aio/_operations/_patch.py | 1 + .../authentication/http/custom/aio/_patch.py | 1 + .../http/custom/models/_patch.py | 1 + .../authentication-http-custom/pyproject.toml | 3 +-- .../authentication/noauth/union/_client.py | 7 ++++++- .../noauth/union/_operations/_patch.py | 1 - .../authentication/noauth/union/_patch.py | 1 - .../noauth/union/_utils/model_base.py | 18 +++++++++++------- .../noauth/union/_utils/serialization.py | 6 +++++- .../authentication/noauth/union/aio/_client.py | 7 ++++++- .../noauth/union/aio/_operations/_patch.py | 1 - .../authentication/noauth/union/aio/_patch.py | 1 - .../authentication-noauth-union/pyproject.toml | 3 +-- .../authentication/oauth2/_client.py | 7 ++++++- .../oauth2/_operations/_patch.py | 1 + .../authentication/oauth2/_patch.py | 1 + .../authentication/oauth2/_utils/model_base.py | 18 +++++++++++------- .../oauth2/_utils/serialization.py | 6 +++++- .../authentication/oauth2/aio/_client.py | 7 ++++++- .../oauth2/aio/_operations/_patch.py | 1 + .../authentication/oauth2/aio/_patch.py | 1 + .../authentication/oauth2/models/_patch.py | 1 + .../azure/authentication-oauth2/pyproject.toml | 3 +-- .../authentication/union/_client.py | 7 ++++++- .../authentication/union/_operations/_patch.py | 1 + .../authentication/union/_patch.py | 1 + .../authentication/union/_utils/model_base.py | 18 +++++++++++------- .../union/_utils/serialization.py | 6 +++++- .../authentication/union/aio/_client.py | 7 ++++++- .../union/aio/_operations/_patch.py | 1 + .../authentication/union/aio/_patch.py | 1 + .../azure/authentication-union/pyproject.toml | 3 +-- .../pyproject.toml | 3 +-- .../clientgenerator/core/access/_client.py | 7 ++++++- .../clientgenerator/core/access/_patch.py | 1 + .../core/access/_utils/model_base.py | 18 +++++++++++------- .../core/access/_utils/serialization.py | 6 +++++- .../clientgenerator/core/access/aio/_client.py | 7 ++++++- .../clientgenerator/core/access/aio/_patch.py | 1 + .../core/access/aio/operations/_patch.py | 1 + .../core/access/models/_patch.py | 1 + .../core/access/operations/_patch.py | 1 + .../pyproject.toml | 3 +-- .../core/alternatetype/_client.py | 7 ++++++- .../core/alternatetype/_patch.py | 1 - .../core/alternatetype/_utils/model_base.py | 18 +++++++++++------- .../core/alternatetype/_utils/serialization.py | 6 +++++- .../core/alternatetype/aio/_client.py | 7 ++++++- .../core/alternatetype/aio/_patch.py | 1 - .../alternatetype/aio/operations/_patch.py | 1 - .../core/alternatetype/models/_patch.py | 1 + .../core/alternatetype/operations/_patch.py | 1 - .../service/header/_client.py | 7 ++++++- .../service/header/_operations/_patch.py | 1 + .../service/header/_patch.py | 1 + .../service/header/_utils/model_base.py | 18 +++++++++++------- .../service/header/_utils/serialization.py | 6 +++++- .../service/header/aio/_client.py | 7 ++++++- .../service/header/aio/_operations/_patch.py | 1 + .../service/header/aio/_patch.py | 1 + .../pyproject.toml | 3 +-- .../service/path/_client.py | 7 ++++++- .../service/path/_operations/_patch.py | 1 - .../alternateapiversion/service/path/_patch.py | 1 - .../service/path/_utils/model_base.py | 18 +++++++++++------- .../service/path/_utils/serialization.py | 6 +++++- .../service/path/aio/_client.py | 7 ++++++- .../service/path/aio/_operations/_patch.py | 1 - .../service/path/aio/_patch.py | 1 - .../pyproject.toml | 3 +-- .../service/query/_client.py | 7 ++++++- .../service/query/_operations/_patch.py | 1 - .../service/query/_patch.py | 1 + .../service/query/_utils/model_base.py | 18 +++++++++++------- .../service/query/_utils/serialization.py | 6 +++++- .../service/query/aio/_client.py | 7 ++++++- .../service/query/aio/_operations/_patch.py | 1 + .../service/query/aio/_patch.py | 1 + .../pyproject.toml | 3 +-- .../generated_tests/test_default_value.py | 2 +- .../test_default_value_async.py | 2 +- .../pyproject.toml | 3 +-- .../core/clientdefaultvalue/_client.py | 7 ++++++- .../clientdefaultvalue/_operations/_patch.py | 1 - .../core/clientdefaultvalue/_patch.py | 1 - .../clientdefaultvalue/_utils/model_base.py | 18 +++++++++++------- .../clientdefaultvalue/_utils/serialization.py | 6 +++++- .../core/clientdefaultvalue/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 - .../core/clientdefaultvalue/aio/_patch.py | 1 - .../core/clientdefaultvalue/models/_models.py | 14 +++++++------- .../core/clientdefaultvalue/models/_patch.py | 1 - .../pyproject.toml | 3 +-- .../clientinitialization/default/_client.py | 7 ++++++- .../default/_operations/_patch.py | 1 - .../clientinitialization/default/_patch.py | 1 - .../default/_utils/model_base.py | 18 +++++++++++------- .../default/_utils/serialization.py | 6 +++++- .../default/aio/_client.py | 7 ++++++- .../default/aio/_operations/_patch.py | 1 - .../clientinitialization/default/aio/_patch.py | 1 - .../default/models/_patch.py | 1 - .../pyproject.toml | 3 +-- .../individually/_client.py | 7 ++++++- .../individually/_operations/_patch.py | 1 - .../individually/_patch.py | 1 - .../individually/_utils/model_base.py | 18 +++++++++++------- .../individually/_utils/serialization.py | 6 +++++- .../individually/aio/_client.py | 7 ++++++- .../individually/aio/_operations/_patch.py | 1 - .../individually/aio/_patch.py | 1 - .../individually/models/_patch.py | 1 - .../pyproject.toml | 3 +-- .../individuallyparent/_client.py | 7 ++++++- .../individuallyparent/_patch.py | 1 - .../individuallyparent/_utils/model_base.py | 18 +++++++++++------- .../individuallyparent/_utils/serialization.py | 6 +++++- .../individuallyparent/aio/_client.py | 7 ++++++- .../individuallyparent/aio/_patch.py | 1 - .../aio/operations/_patch.py | 1 - .../individuallyparent/models/_patch.py | 1 - .../individuallyparent/operations/_patch.py | 1 - .../pyproject.toml | 3 +-- .../core/clientlocation/parameter/_client.py | 7 ++++++- .../core/clientlocation/parameter/_patch.py | 1 - .../parameter/_utils/model_base.py | 18 +++++++++++------- .../parameter/_utils/serialization.py | 6 +++++- .../clientlocation/parameter/aio/_client.py | 7 ++++++- .../clientlocation/parameter/aio/_patch.py | 1 - .../parameter/aio/operations/_patch.py | 1 - .../clientlocation/parameter/models/_patch.py | 1 - .../parameter/operations/_patch.py | 1 - .../pyproject.toml | 3 +-- .../core/clientlocation/subclient/_client.py | 7 ++++++- .../core/clientlocation/subclient/_patch.py | 1 - .../subclient/_utils/model_base.py | 18 +++++++++++------- .../subclient/_utils/serialization.py | 6 +++++- .../clientlocation/subclient/aio/_client.py | 7 ++++++- .../clientlocation/subclient/aio/_patch.py | 1 - .../subclient/aio/operations/_patch.py | 1 - .../subclient/operations/_patch.py | 1 - .../pyproject.toml | 3 +-- .../clientlocation/newsubclient/_client.py | 7 ++++++- .../core/clientlocation/newsubclient/_patch.py | 1 - .../newsubclient/_utils/model_base.py | 18 +++++++++++------- .../newsubclient/_utils/serialization.py | 6 +++++- .../clientlocation/newsubclient/aio/_client.py | 7 ++++++- .../clientlocation/newsubclient/aio/_patch.py | 1 - .../newsubclient/aio/operations/_patch.py | 1 - .../newsubclient/operations/_patch.py | 1 - .../pyproject.toml | 3 +-- .../core/clientlocation/rootclient/_client.py | 7 ++++++- .../core/clientlocation/rootclient/_patch.py | 1 - .../rootclient/_utils/model_base.py | 18 +++++++++++------- .../rootclient/_utils/serialization.py | 6 +++++- .../clientlocation/rootclient/aio/_client.py | 7 ++++++- .../clientlocation/rootclient/aio/_patch.py | 1 - .../rootclient/aio/operations/_patch.py | 1 - .../rootclient/operations/_patch.py | 1 - .../pyproject.toml | 3 +-- .../core/emptystring/_client.py | 7 ++++++- .../core/emptystring/_operations/_patch.py | 1 + .../clientgenerator/core/emptystring/_patch.py | 1 + .../core/emptystring/_utils/model_base.py | 18 +++++++++++------- .../core/emptystring/_utils/serialization.py | 6 +++++- .../core/emptystring/aio/_client.py | 7 ++++++- .../core/emptystring/aio/_operations/_patch.py | 1 + .../core/emptystring/aio/_patch.py | 1 + .../core/emptystring/models/_patch.py | 1 + .../pyproject.toml | 3 +-- .../core/flattenproperty/_client.py | 7 ++++++- .../core/flattenproperty/_operations/_patch.py | 1 + .../core/flattenproperty/_patch.py | 1 + .../core/flattenproperty/_utils/model_base.py | 18 +++++++++++------- .../flattenproperty/_utils/serialization.py | 6 +++++- .../core/flattenproperty/aio/_client.py | 7 ++++++- .../flattenproperty/aio/_operations/_patch.py | 1 + .../core/flattenproperty/aio/_patch.py | 1 + .../core/flattenproperty/models/_patch.py | 1 + .../pyproject.toml | 3 +-- .../core/hierarchybuilding/_client.py | 7 ++++++- .../core/hierarchybuilding/_patch.py | 1 + .../hierarchybuilding/_utils/model_base.py | 18 +++++++++++------- .../hierarchybuilding/_utils/serialization.py | 6 +++++- .../core/hierarchybuilding/aio/_client.py | 7 ++++++- .../core/hierarchybuilding/aio/_patch.py | 1 + .../hierarchybuilding/aio/operations/_patch.py | 1 + .../core/hierarchybuilding/models/_patch.py | 1 + .../hierarchybuilding/operations/_patch.py | 1 + .../pyproject.toml | 3 +-- .../core/nextlinkverb/_client.py | 7 ++++++- .../core/nextlinkverb/_operations/_patch.py | 1 - .../core/nextlinkverb/_patch.py | 1 - .../core/nextlinkverb/_utils/model_base.py | 18 +++++++++++------- .../core/nextlinkverb/_utils/serialization.py | 6 +++++- .../core/nextlinkverb/aio/_client.py | 7 ++++++- .../nextlinkverb/aio/_operations/_patch.py | 1 - .../core/nextlinkverb/aio/_patch.py | 1 - .../core/nextlinkverb/models/_patch.py | 1 - .../pyproject.toml | 3 +-- .../clientgenerator/core/override/_client.py | 7 ++++++- .../clientgenerator/core/override/_patch.py | 1 - .../core/override/_utils/model_base.py | 18 +++++++++++------- .../core/override/_utils/serialization.py | 6 +++++- .../core/override/aio/_client.py | 7 ++++++- .../core/override/aio/_patch.py | 1 - .../core/override/aio/operations/_patch.py | 1 - .../core/override/models/_patch.py | 1 - .../core/override/operations/_patch.py | 1 - .../pyproject.toml | 3 +-- .../clientgenerator/core/usage/_client.py | 7 ++++++- .../azure/clientgenerator/core/usage/_patch.py | 1 + .../core/usage/_utils/model_base.py | 18 +++++++++++------- .../core/usage/_utils/serialization.py | 6 +++++- .../clientgenerator/core/usage/aio/_client.py | 7 ++++++- .../clientgenerator/core/usage/aio/_patch.py | 1 + .../core/usage/aio/operations/_patch.py | 1 + .../core/usage/models/_patch.py | 1 + .../core/usage/operations/_patch.py | 1 + .../azure/azure-core-basic/pyproject.toml | 3 +-- .../specs/azure/core/basic/_client.py | 7 ++++++- .../azure/core/basic/_operations/_patch.py | 1 + .../specs/azure/core/basic/_patch.py | 1 + .../azure/core/basic/_utils/model_base.py | 18 +++++++++++------- .../azure/core/basic/_utils/serialization.py | 6 +++++- .../specs/azure/core/basic/aio/_client.py | 7 ++++++- .../azure/core/basic/aio/_operations/_patch.py | 1 + .../specs/azure/core/basic/aio/_patch.py | 1 + .../specs/azure/core/basic/models/_patch.py | 1 + .../azure/azure-core-lro-rpc/pyproject.toml | 3 +-- .../specs/azure/core/lro/rpc/_client.py | 7 ++++++- .../azure/core/lro/rpc/_operations/_patch.py | 1 + .../specs/azure/core/lro/rpc/_patch.py | 1 + .../azure/core/lro/rpc/_utils/model_base.py | 18 +++++++++++------- .../azure/core/lro/rpc/_utils/serialization.py | 6 +++++- .../specs/azure/core/lro/rpc/aio/_client.py | 7 ++++++- .../core/lro/rpc/aio/_operations/_patch.py | 1 + .../specs/azure/core/lro/rpc/aio/_patch.py | 1 + .../specs/azure/core/lro/rpc/models/_patch.py | 1 + .../azure-core-lro-standard/pyproject.toml | 3 +-- .../specs/azure/core/lro/standard/_client.py | 7 ++++++- .../core/lro/standard/_operations/_patch.py | 1 - .../specs/azure/core/lro/standard/_patch.py | 1 - .../core/lro/standard/_utils/model_base.py | 18 +++++++++++------- .../core/lro/standard/_utils/serialization.py | 6 +++++- .../azure/core/lro/standard/aio/_client.py | 7 ++++++- .../lro/standard/aio/_operations/_patch.py | 1 - .../azure/core/lro/standard/aio/_patch.py | 1 - .../azure/core/lro/standard/models/_patch.py | 1 - .../azure/azure-core-model/pyproject.toml | 3 +-- .../specs/azure/core/model/_client.py | 7 ++++++- .../specs/azure/core/model/_patch.py | 1 + .../azure/core/model/_utils/model_base.py | 18 +++++++++++------- .../azure/core/model/_utils/serialization.py | 6 +++++- .../specs/azure/core/model/aio/_client.py | 7 ++++++- .../specs/azure/core/model/aio/_patch.py | 1 + .../azure/core/model/aio/operations/_patch.py | 1 + .../specs/azure/core/model/models/_patch.py | 1 + .../azure/core/model/operations/_patch.py | 1 + .../azure/azure-core-page/pyproject.toml | 3 +-- .../specs/azure/core/page/_client.py | 7 ++++++- .../specs/azure/core/page/_patch.py | 1 + .../specs/azure/core/page/_utils/model_base.py | 18 +++++++++++------- .../azure/core/page/_utils/serialization.py | 6 +++++- .../specs/azure/core/page/aio/_client.py | 7 ++++++- .../specs/azure/core/page/aio/_patch.py | 1 + .../azure/core/page/aio/operations/_patch.py | 1 + .../specs/azure/core/page/models/_patch.py | 1 + .../specs/azure/core/page/operations/_patch.py | 1 + .../azure/azure-core-scalar/pyproject.toml | 3 +-- .../specs/azure/core/scalar/_client.py | 7 ++++++- .../specs/azure/core/scalar/_patch.py | 1 + .../azure/core/scalar/_utils/model_base.py | 18 +++++++++++------- .../azure/core/scalar/_utils/serialization.py | 6 +++++- .../specs/azure/core/scalar/aio/_client.py | 7 ++++++- .../specs/azure/core/scalar/aio/_patch.py | 1 + .../azure/core/scalar/aio/operations/_patch.py | 1 + .../specs/azure/core/scalar/models/_patch.py | 1 + .../azure/core/scalar/operations/_patch.py | 1 + .../azure/azure-core-traits/pyproject.toml | 3 +-- .../specs/azure/core/traits/_client.py | 7 ++++++- .../azure/core/traits/_operations/_patch.py | 1 + .../specs/azure/core/traits/_patch.py | 1 + .../azure/core/traits/_utils/model_base.py | 18 +++++++++++------- .../azure/core/traits/_utils/serialization.py | 6 +++++- .../specs/azure/core/traits/aio/_client.py | 7 ++++++- .../core/traits/aio/_operations/_patch.py | 1 + .../specs/azure/core/traits/aio/_patch.py | 1 + .../specs/azure/core/traits/models/_patch.py | 1 + .../azure/azure-encode-duration/pyproject.toml | 3 +-- .../specs/azure/encode/duration/_client.py | 7 ++++++- .../encode/duration/_operations/_patch.py | 1 + .../specs/azure/encode/duration/_patch.py | 1 + .../azure/encode/duration/_utils/model_base.py | 18 +++++++++++------- .../encode/duration/_utils/serialization.py | 6 +++++- .../specs/azure/encode/duration/aio/_client.py | 7 ++++++- .../encode/duration/aio/_operations/_patch.py | 1 + .../specs/azure/encode/duration/aio/_patch.py | 1 + .../azure/encode/duration/models/_patch.py | 1 + .../azure/azure-example-basic/pyproject.toml | 3 +-- .../specs/azure/example/basic/_client.py | 7 ++++++- .../azure/example/basic/_operations/_patch.py | 1 + .../specs/azure/example/basic/_patch.py | 1 + .../azure/example/basic/_utils/model_base.py | 18 +++++++++++------- .../example/basic/_utils/serialization.py | 6 +++++- .../specs/azure/example/basic/aio/_client.py | 7 ++++++- .../example/basic/aio/_operations/_patch.py | 1 + .../specs/azure/example/basic/aio/_patch.py | 1 + .../specs/azure/example/basic/models/_patch.py | 1 + .../azure-payload-pageable/pyproject.toml | 3 +-- .../specs/azure/payload/pageable/_client.py | 7 ++++++- .../payload/pageable/_operations/_patch.py | 1 + .../specs/azure/payload/pageable/_patch.py | 1 + .../payload/pageable/_utils/model_base.py | 18 +++++++++++------- .../payload/pageable/_utils/serialization.py | 6 +++++- .../azure/payload/pageable/aio/_client.py | 7 ++++++- .../payload/pageable/aio/_operations/_patch.py | 1 + .../specs/azure/payload/pageable/aio/_patch.py | 1 + .../azure/payload/pageable/models/_patch.py | 1 + .../commonproperties/_client.py | 7 ++++++- .../resourcemanager/commonproperties/_patch.py | 1 + .../commonproperties/_utils/model_base.py | 18 +++++++++++------- .../commonproperties/_utils/serialization.py | 6 +++++- .../commonproperties/aio/_client.py | 7 ++++++- .../commonproperties/aio/_patch.py | 1 + .../commonproperties/aio/operations/_patch.py | 1 + .../commonproperties/models/_patch.py | 1 + .../commonproperties/operations/_patch.py | 1 + .../pyproject.toml | 3 +-- .../resourcemanager/largeheader/_client.py | 7 ++++++- .../resourcemanager/largeheader/_patch.py | 1 + .../largeheader/_utils/model_base.py | 18 +++++++++++------- .../largeheader/_utils/serialization.py | 6 +++++- .../resourcemanager/largeheader/aio/_client.py | 7 ++++++- .../resourcemanager/largeheader/aio/_patch.py | 1 + .../largeheader/aio/operations/_patch.py | 1 + .../largeheader/models/_patch.py | 1 + .../largeheader/operations/_patch.py | 1 + .../pyproject.toml | 3 +-- .../methodsubscriptionid/_client.py | 7 ++++++- .../methodsubscriptionid/_patch.py | 1 - .../methodsubscriptionid/_utils/model_base.py | 18 +++++++++++------- .../_utils/serialization.py | 6 +++++- .../methodsubscriptionid/aio/_client.py | 7 ++++++- .../methodsubscriptionid/aio/_patch.py | 1 - .../aio/operations/_patch.py | 1 - .../methodsubscriptionid/models/_patch.py | 1 - .../methodsubscriptionid/operations/_patch.py | 1 - .../pyproject.toml | 3 +-- .../combined/_client.py | 7 ++++++- .../combined/_patch.py | 1 - .../combined/_utils/model_base.py | 18 +++++++++++------- .../combined/_utils/serialization.py | 6 +++++- .../combined/aio/_client.py | 7 ++++++- .../combined/aio/_patch.py | 1 - .../combined/aio/operations/_patch.py | 1 - .../combined/models/_patch.py | 1 - .../combined/operations/_patch.py | 1 - .../pyproject.toml | 3 +-- .../multiservice/combined/_client.py | 7 ++++++- .../multiservice/combined/_patch.py | 1 - .../multiservice/combined/_utils/model_base.py | 18 +++++++++++------- .../combined/_utils/serialization.py | 6 +++++- .../multiservice/combined/aio/_client.py | 7 ++++++- .../multiservice/combined/aio/_patch.py | 1 - .../combined/aio/operations/_patch.py | 1 - .../multiservice/combined/models/_patch.py | 1 - .../multiservice/combined/operations/_patch.py | 1 - .../pyproject.toml | 3 +-- .../resourcemanager/nonresource/_client.py | 7 ++++++- .../resourcemanager/nonresource/_patch.py | 1 + .../nonresource/_utils/model_base.py | 18 +++++++++++------- .../nonresource/_utils/serialization.py | 6 +++++- .../resourcemanager/nonresource/aio/_client.py | 7 ++++++- .../resourcemanager/nonresource/aio/_patch.py | 1 + .../nonresource/aio/operations/_patch.py | 1 + .../nonresource/models/_patch.py | 1 + .../nonresource/operations/_patch.py | 1 + .../pyproject.toml | 3 +-- .../operationtemplates/_client.py | 7 ++++++- .../operationtemplates/_patch.py | 1 + .../operationtemplates/_utils/model_base.py | 18 +++++++++++------- .../operationtemplates/_utils/serialization.py | 6 +++++- .../operationtemplates/aio/_client.py | 7 ++++++- .../operationtemplates/aio/_patch.py | 1 + .../aio/operations/_patch.py | 1 + .../operationtemplates/models/_patch.py | 1 + .../operationtemplates/operations/_patch.py | 1 + .../pyproject.toml | 3 +-- .../azure/resourcemanager/resources/_client.py | 7 ++++++- .../azure/resourcemanager/resources/_patch.py | 1 + .../resources/_utils/model_base.py | 18 +++++++++++------- .../resources/_utils/serialization.py | 6 +++++- .../resourcemanager/resources/aio/_client.py | 7 ++++++- .../resourcemanager/resources/aio/_patch.py | 1 + .../resources/aio/operations/_patch.py | 1 + .../resourcemanager/resources/models/_patch.py | 1 + .../resources/operations/_patch.py | 1 + .../pyproject.toml | 3 +-- .../xmsclientrequestid/_client.py | 7 ++++++- .../xmsclientrequestid/_operations/_patch.py | 1 + .../xmsclientrequestid/_patch.py | 1 + .../xmsclientrequestid/_utils/model_base.py | 18 +++++++++++------- .../xmsclientrequestid/_utils/serialization.py | 6 +++++- .../xmsclientrequestid/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 + .../xmsclientrequestid/aio/_patch.py | 1 + .../pyproject.toml | 3 +-- .../pyproject.toml | 3 +-- .../azure/versioning/previewversion/_client.py | 7 ++++++- .../previewversion/_operations/_patch.py | 1 - .../azure/versioning/previewversion/_patch.py | 1 - .../previewversion/_utils/model_base.py | 18 +++++++++++------- .../previewversion/_utils/serialization.py | 6 +++++- .../versioning/previewversion/aio/_client.py | 7 ++++++- .../previewversion/aio/_operations/_patch.py | 1 - .../versioning/previewversion/aio/_patch.py | 1 - .../versioning/previewversion/models/_patch.py | 1 - .../client/clientnamespace/_client.py | 7 ++++++- .../clientnamespace/_operations/_patch.py | 1 - .../client/clientnamespace/_patch.py | 1 - .../clientnamespace/_utils/model_base.py | 18 +++++++++++------- .../clientnamespace/_utils/serialization.py | 6 +++++- .../client/clientnamespace/aio/_client.py | 7 ++++++- .../clientnamespace/aio/_operations/_patch.py | 1 - .../client/clientnamespace/aio/_patch.py | 1 - .../clientnamespace/first/models/_patch.py | 1 - .../client/clientnamespace/second/_client.py | 7 ++++++- .../second/_operations/_patch.py | 1 - .../client/clientnamespace/second/_patch.py | 1 - .../second/_utils/model_base.py | 18 +++++++++++------- .../second/_utils/serialization.py | 6 +++++- .../clientnamespace/second/aio/_client.py | 7 ++++++- .../second/aio/_operations/_patch.py | 1 - .../clientnamespace/second/aio/_patch.py | 1 - .../clientnamespace/second/models/_patch.py | 1 - .../second/sub/models/_patch.py | 1 - .../azure/client-namespace/pyproject.toml | 3 +-- .../client/naming/enumconflict/_client.py | 7 ++++++- .../client/naming/enumconflict/_patch.py | 1 + .../naming/enumconflict/_utils/model_base.py | 18 +++++++++++------- .../enumconflict/_utils/serialization.py | 6 +++++- .../client/naming/enumconflict/aio/_client.py | 7 ++++++- .../client/naming/enumconflict/aio/_patch.py | 1 + .../enumconflict/aio/operations/_patch.py | 1 + .../firstnamespace/models/_patch.py | 1 + .../naming/enumconflict/operations/_patch.py | 1 + .../secondnamespace/models/_patch.py | 1 + .../client-naming-enum-conflict/pyproject.toml | 3 +-- .../client/naming/main/_client.py | 7 ++++++- .../client-naming/client/naming/main/_patch.py | 1 - .../client/naming/main/_utils/model_base.py | 18 +++++++++++------- .../client/naming/main/_utils/serialization.py | 6 +++++- .../client/naming/main/aio/_client.py | 7 ++++++- .../client/naming/main/aio/_patch.py | 1 - .../naming/main/aio/operations/_patch.py | 1 - .../client/naming/main/models/_patch.py | 1 - .../client/naming/main/operations/_patch.py | 1 - .../azure/client-naming/pyproject.toml | 3 +-- .../client-overload/client/overload/_client.py | 7 ++++++- .../client/overload/_operations/_patch.py | 1 + .../client-overload/client/overload/_patch.py | 1 + .../client/overload/_utils/model_base.py | 18 +++++++++++------- .../client/overload/_utils/serialization.py | 6 +++++- .../client/overload/aio/_client.py | 7 ++++++- .../client/overload/aio/_operations/_patch.py | 1 + .../client/overload/aio/_patch.py | 1 + .../client/overload/models/_patch.py | 1 + .../azure/client-overload/pyproject.toml | 3 +-- .../structure/clientoperationgroup/_client.py | 7 ++++++- .../clientoperationgroup/_operations/_patch.py | 1 - .../structure/clientoperationgroup/_patch.py | 1 - .../clientoperationgroup/_utils/model_base.py | 18 +++++++++++------- .../_utils/serialization.py | 6 +++++- .../clientoperationgroup/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 - .../clientoperationgroup/aio/_patch.py | 1 - .../aio/operations/_patch.py | 1 - .../clientoperationgroup/models/_patch.py | 1 - .../clientoperationgroup/operations/_patch.py | 1 - .../pyproject.toml | 3 +-- .../client/structure/service/_client.py | 7 ++++++- .../client/structure/service/_patch.py | 1 + .../structure/service/_utils/model_base.py | 18 +++++++++++------- .../structure/service/_utils/serialization.py | 6 +++++- .../client/structure/service/aio/_client.py | 7 ++++++- .../client/structure/service/aio/_patch.py | 1 + .../structure/service/aio/operations/_patch.py | 1 + .../client/structure/service/models/_patch.py | 1 + .../structure/service/operations/_patch.py | 1 + .../client-structure-default/pyproject.toml | 3 +-- .../client/structure/multiclient/_client.py | 7 ++++++- .../multiclient/_operations/_patch.py | 1 + .../client/structure/multiclient/_patch.py | 1 + .../structure/multiclient/_utils/model_base.py | 18 +++++++++++------- .../multiclient/_utils/serialization.py | 6 +++++- .../structure/multiclient/aio/_client.py | 7 ++++++- .../multiclient/aio/_operations/_patch.py | 1 + .../client/structure/multiclient/aio/_patch.py | 1 + .../structure/multiclient/models/_patch.py | 1 + .../pyproject.toml | 3 +-- .../structure/renamedoperation/_client.py | 7 ++++++- .../renamedoperation/_operations/_patch.py | 1 - .../structure/renamedoperation/_patch.py | 1 + .../renamedoperation/_utils/model_base.py | 18 +++++++++++------- .../renamedoperation/_utils/serialization.py | 6 +++++- .../structure/renamedoperation/aio/_client.py | 7 ++++++- .../renamedoperation/aio/_operations/_patch.py | 1 - .../structure/renamedoperation/aio/_patch.py | 1 + .../renamedoperation/aio/operations/_patch.py | 1 + .../renamedoperation/models/_patch.py | 1 + .../renamedoperation/operations/_patch.py | 1 + .../pyproject.toml | 3 +-- .../structure/twooperationgroup/_client.py | 7 ++++++- .../twooperationgroup/_operations/_patch.py | 1 - .../structure/twooperationgroup/_patch.py | 1 + .../twooperationgroup/_utils/model_base.py | 18 +++++++++++------- .../twooperationgroup/_utils/serialization.py | 6 +++++- .../structure/twooperationgroup/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 - .../structure/twooperationgroup/aio/_patch.py | 1 + .../twooperationgroup/aio/operations/_patch.py | 1 + .../twooperationgroup/models/_patch.py | 1 + .../twooperationgroup/operations/_patch.py | 1 + .../pyproject.toml | 3 +-- .../azure/encode-array/encode/array/_client.py | 7 ++++++- .../azure/encode-array/encode/array/_patch.py | 1 - .../encode/array/_utils/model_base.py | 18 +++++++++++------- .../encode/array/_utils/serialization.py | 6 +++++- .../encode-array/encode/array/aio/_client.py | 7 ++++++- .../encode-array/encode/array/aio/_patch.py | 1 - .../encode-array/encode/array/models/_patch.py | 1 - .../array/property/aio/operations/_patch.py | 1 - .../encode/array/property/operations/_patch.py | 1 - .../azure/encode-array/pyproject.toml | 3 +-- .../azure/encode-bytes/encode/bytes/_client.py | 7 ++++++- .../azure/encode-bytes/encode/bytes/_patch.py | 1 - .../encode/bytes/_utils/model_base.py | 18 +++++++++++------- .../encode/bytes/_utils/serialization.py | 6 +++++- .../encode-bytes/encode/bytes/aio/_client.py | 7 ++++++- .../encode-bytes/encode/bytes/aio/_patch.py | 1 - .../bytes/header/aio/operations/_patch.py | 1 - .../encode/bytes/header/operations/_patch.py | 1 - .../encode-bytes/encode/bytes/models/_patch.py | 1 - .../bytes/property/aio/operations/_patch.py | 1 - .../encode/bytes/property/operations/_patch.py | 1 - .../bytes/query/aio/operations/_patch.py | 1 - .../encode/bytes/query/operations/_patch.py | 1 - .../bytes/requestbody/aio/operations/_patch.py | 1 - .../bytes/requestbody/operations/_patch.py | 1 - .../responsebody/aio/operations/_patch.py | 1 - .../bytes/responsebody/operations/_patch.py | 1 - .../azure/encode-bytes/pyproject.toml | 3 +-- .../encode-datetime/encode/datetime/_client.py | 7 ++++++- .../encode-datetime/encode/datetime/_patch.py | 1 + .../encode/datetime/_utils/model_base.py | 18 +++++++++++------- .../encode/datetime/_utils/serialization.py | 6 +++++- .../encode/datetime/aio/_client.py | 7 ++++++- .../encode/datetime/aio/_patch.py | 1 + .../datetime/header/aio/operations/_patch.py | 1 + .../datetime/header/operations/_patch.py | 1 + .../encode/datetime/models/_patch.py | 1 + .../datetime/property/aio/operations/_patch.py | 1 + .../datetime/property/operations/_patch.py | 1 + .../datetime/query/aio/operations/_patch.py | 1 + .../encode/datetime/query/operations/_patch.py | 1 + .../responseheader/aio/operations/_patch.py | 1 + .../responseheader/operations/_patch.py | 1 + .../azure/encode-datetime/pyproject.toml | 3 +-- .../encode-duration/encode/duration/_client.py | 7 ++++++- .../encode-duration/encode/duration/_patch.py | 1 + .../encode/duration/_utils/model_base.py | 18 +++++++++++------- .../encode/duration/_utils/serialization.py | 6 +++++- .../encode/duration/aio/_client.py | 7 ++++++- .../encode/duration/aio/_patch.py | 1 + .../encode/duration/aio/operations/_patch.py | 1 + .../encode/duration/models/_patch.py | 1 + .../encode/duration/operations/_patch.py | 1 + .../azure/encode-duration/pyproject.toml | 3 +-- .../encode-numeric/encode/numeric/_client.py | 7 ++++++- .../encode-numeric/encode/numeric/_patch.py | 1 + .../encode/numeric/_utils/model_base.py | 18 +++++++++++------- .../encode/numeric/_utils/serialization.py | 6 +++++- .../encode/numeric/aio/_client.py | 7 ++++++- .../encode/numeric/aio/_patch.py | 1 + .../encode/numeric/aio/operations/_patch.py | 1 + .../encode/numeric/models/_patch.py | 1 + .../encode/numeric/operations/_patch.py | 1 + .../azure/encode-numeric/pyproject.toml | 3 +-- .../generation/subdir/_generated/_client.py | 7 ++++++- .../subdir/_generated/_operations/_patch.py | 1 + .../generation/subdir/_generated/_patch.py | 1 + .../subdir/_generated/_utils/model_base.py | 18 +++++++++++------- .../subdir/_generated/_utils/serialization.py | 6 +++++- .../subdir/_generated/aio/_client.py | 7 ++++++- .../_generated/aio/_operations/_patch.py | 1 + .../generation/subdir/_generated/aio/_patch.py | 1 + .../subdir/_generated/models/_patch.py | 1 + .../azure/generation-subdir/pyproject.toml | 3 +-- .../generation/subdir2/_generated/_client.py | 7 ++++++- .../generation/subdir2/_generated/_patch.py | 1 - .../subdir2/_generated/_utils/model_base.py | 18 +++++++++++------- .../subdir2/_generated/_utils/serialization.py | 6 +++++- .../subdir2/_generated/aio/_client.py | 7 ++++++- .../subdir2/_generated/aio/_patch.py | 1 - .../_generated/aio/operations/_patch.py | 1 - .../subdir2/_generated/models/_patch.py | 1 - .../subdir2/_generated/operations/_patch.py | 1 - .../azure/generation-subdir2/pyproject.toml | 3 +-- .../headasbooleanfalse/_client.py | 7 ++++++- .../headasbooleanfalse/_operations/_patch.py | 1 + .../headasbooleanfalse/_patch.py | 1 + .../headasbooleanfalse/_utils/model_base.py | 18 +++++++++++------- .../headasbooleanfalse/_utils/serialization.py | 6 +++++- .../headasbooleanfalse/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 + .../headasbooleanfalse/aio/_patch.py | 1 + .../headasbooleanfalse/models/_patch.py | 1 + .../azure/headasbooleanfalse/pyproject.toml | 3 +-- .../headasbooleantrue/_client.py | 7 ++++++- .../headasbooleantrue/_operations/_patch.py | 1 + .../headasbooleantrue/_patch.py | 1 + .../headasbooleantrue/_utils/model_base.py | 18 +++++++++++------- .../headasbooleantrue/_utils/serialization.py | 6 +++++- .../headasbooleantrue/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 + .../headasbooleantrue/aio/_patch.py | 1 + .../headasbooleantrue/models/_patch.py | 1 + .../azure/headasbooleantrue/pyproject.toml | 3 +-- .../parameters/basic/_client.py | 7 ++++++- .../parameters/basic/_patch.py | 1 + .../parameters/basic/_utils/model_base.py | 18 +++++++++++------- .../parameters/basic/_utils/serialization.py | 6 +++++- .../parameters/basic/aio/_client.py | 7 ++++++- .../parameters/basic/aio/_patch.py | 1 + .../parameters/basic/aio/operations/_patch.py | 1 + .../parameters/basic/models/_patch.py | 1 + .../parameters/basic/operations/_patch.py | 1 + .../azure/parameters-basic/pyproject.toml | 3 +-- .../parameters/bodyoptionality/_client.py | 7 ++++++- .../bodyoptionality/_operations/_patch.py | 1 + .../parameters/bodyoptionality/_patch.py | 1 + .../bodyoptionality/_utils/model_base.py | 18 +++++++++++------- .../bodyoptionality/_utils/serialization.py | 6 +++++- .../parameters/bodyoptionality/aio/_client.py | 7 ++++++- .../bodyoptionality/aio/_operations/_patch.py | 1 + .../parameters/bodyoptionality/aio/_patch.py | 1 + .../bodyoptionality/models/_patch.py | 1 + .../optionalexplicit/aio/operations/_patch.py | 1 + .../optionalexplicit/operations/_patch.py | 1 + .../parameters-body-optionality/pyproject.toml | 3 +-- .../parameters/collectionformat/_client.py | 7 ++++++- .../parameters/collectionformat/_patch.py | 1 + .../collectionformat/_utils/model_base.py | 18 +++++++++++------- .../collectionformat/_utils/serialization.py | 6 +++++- .../parameters/collectionformat/aio/_client.py | 7 ++++++- .../parameters/collectionformat/aio/_patch.py | 1 + .../header/aio/operations/_patch.py | 1 + .../header/operations/_patch.py | 1 + .../query/aio/operations/_patch.py | 1 + .../query/operations/_patch.py | 1 + .../pyproject.toml | 3 +-- .../parameters-path/parameters/path/_client.py | 7 ++++++- .../parameters/path/_operations/_patch.py | 1 + .../parameters-path/parameters/path/_patch.py | 1 + .../parameters/path/_utils/model_base.py | 18 +++++++++++------- .../parameters/path/_utils/serialization.py | 6 +++++- .../parameters/path/aio/_client.py | 7 ++++++- .../parameters/path/aio/_operations/_patch.py | 1 + .../parameters/path/aio/_patch.py | 1 + .../azure/parameters-path/pyproject.toml | 3 +-- .../parameters/query/_client.py | 7 ++++++- .../parameters/query/_patch.py | 1 - .../parameters/query/_utils/model_base.py | 18 +++++++++++------- .../parameters/query/_utils/serialization.py | 6 +++++- .../parameters/query/aio/_client.py | 7 ++++++- .../parameters/query/aio/_patch.py | 1 - .../parameters/query/aio/operations/_patch.py | 1 - .../parameters/query/operations/_patch.py | 1 - .../azure/parameters-query/pyproject.toml | 3 +-- .../parameters/spread/_client.py | 7 ++++++- .../parameters/spread/_patch.py | 1 + .../parameters/spread/_utils/model_base.py | 18 +++++++++++------- .../parameters/spread/_utils/serialization.py | 6 +++++- .../parameters/spread/aio/_client.py | 7 ++++++- .../parameters/spread/aio/_patch.py | 1 + .../parameters/spread/aio/operations/_patch.py | 1 + .../parameters/spread/models/_patch.py | 1 + .../parameters/spread/operations/_patch.py | 1 + .../azure/parameters-spread/pyproject.toml | 3 +-- .../payload/contentnegotiation/_client.py | 7 ++++++- .../payload/contentnegotiation/_patch.py | 1 + .../contentnegotiation/_utils/model_base.py | 18 +++++++++++------- .../contentnegotiation/_utils/serialization.py | 6 +++++- .../payload/contentnegotiation/aio/_client.py | 7 ++++++- .../payload/contentnegotiation/aio/_patch.py | 1 + .../aio/operations/_patch.py | 1 + .../contentnegotiation/models/_patch.py | 1 + .../contentnegotiation/operations/_patch.py | 1 + .../payload-content-negotiation/pyproject.toml | 3 +-- .../payload/jsonmergepatch/_client.py | 7 ++++++- .../jsonmergepatch/_operations/_patch.py | 1 + .../payload/jsonmergepatch/_patch.py | 1 + .../jsonmergepatch/_utils/model_base.py | 18 +++++++++++------- .../jsonmergepatch/_utils/serialization.py | 6 +++++- .../payload/jsonmergepatch/aio/_client.py | 7 ++++++- .../jsonmergepatch/aio/_operations/_patch.py | 1 + .../payload/jsonmergepatch/aio/_patch.py | 1 + .../payload/jsonmergepatch/models/_patch.py | 1 + .../payload-json-merge-patch/pyproject.toml | 3 +-- .../payload/mediatype/_client.py | 7 ++++++- .../payload/mediatype/_patch.py | 1 + .../payload/mediatype/_utils/model_base.py | 18 +++++++++++------- .../payload/mediatype/_utils/serialization.py | 6 +++++- .../payload/mediatype/aio/_client.py | 7 ++++++- .../payload/mediatype/aio/_patch.py | 1 + .../stringbody/aio/operations/_patch.py | 1 + .../mediatype/stringbody/operations/_patch.py | 1 + .../azure/payload-media-type/pyproject.toml | 3 +-- .../payload/multipart/_client.py | 7 ++++++- .../payload/multipart/_patch.py | 1 + .../payload/multipart/_utils/model_base.py | 18 +++++++++++------- .../payload/multipart/_utils/serialization.py | 6 +++++- .../payload/multipart/_utils/utils.py | 1 - .../payload/multipart/aio/_client.py | 7 ++++++- .../payload/multipart/aio/_patch.py | 1 + .../payload/multipart/aio/operations/_patch.py | 1 + .../payload/multipart/models/_patch.py | 1 + .../payload/multipart/operations/_patch.py | 1 + .../azure/payload-multipart/pyproject.toml | 3 +-- .../payload/pageable/_client.py | 7 ++++++- .../payload/pageable/_operations/_patch.py | 1 - .../payload/pageable/_patch.py | 1 + .../payload/pageable/_utils/model_base.py | 18 +++++++++++------- .../payload/pageable/_utils/serialization.py | 6 +++++- .../payload/pageable/aio/_client.py | 7 ++++++- .../payload/pageable/aio/_operations/_patch.py | 1 - .../payload/pageable/aio/_patch.py | 1 + .../payload/pageable/models/_patch.py | 1 + .../pageable/pagesize/aio/operations/_patch.py | 1 - .../pageable/pagesize/operations/_patch.py | 1 - .../aio/operations/_patch.py | 1 + .../aio/operations/_patch.py | 1 - .../alternateinitialverb/models/_patch.py | 1 - .../alternateinitialverb/operations/_patch.py | 1 - .../continuationtoken/aio/operations/_patch.py | 1 + .../continuationtoken/models/_patch.py | 1 + .../continuationtoken/operations/_patch.py | 1 + .../serverdrivenpagination/models/_patch.py | 1 + .../operations/_patch.py | 1 + .../xmlpagination/aio/operations/_patch.py | 1 - .../xmlpagination/operations/_patch.py | 1 - .../azure/payload-pageable/pyproject.toml | 3 +-- .../azure/payload-xml/payload/xml/_client.py | 7 ++++++- .../azure/payload-xml/payload/xml/_patch.py | 1 + .../payload/xml/_utils/model_base.py | 18 +++++++++++------- .../payload/xml/_utils/serialization.py | 6 +++++- .../payload-xml/payload/xml/aio/_client.py | 7 ++++++- .../payload-xml/payload/xml/aio/_patch.py | 1 + .../payload/xml/aio/operations/_patch.py | 1 + .../payload-xml/payload/xml/models/_patch.py | 1 + .../payload/xml/operations/_patch.py | 1 + .../generated/azure/payload-xml/pyproject.toml | 3 +-- .../resiliency-srv-driven1/pyproject.toml | 3 +-- .../resiliency/srv/driven1/_client.py | 7 ++++++- .../srv/driven1/_operations/_patch.py | 1 + .../resiliency/srv/driven1/_patch.py | 1 + .../srv/driven1/_utils/model_base.py | 18 +++++++++++------- .../srv/driven1/_utils/serialization.py | 6 +++++- .../resiliency/srv/driven1/aio/_client.py | 7 ++++++- .../srv/driven1/aio/_operations/_patch.py | 1 + .../resiliency/srv/driven1/aio/_patch.py | 1 + .../resiliency-srv-driven2/pyproject.toml | 3 +-- .../resiliency/srv/driven2/_client.py | 7 ++++++- .../srv/driven2/_operations/_patch.py | 1 + .../resiliency/srv/driven2/_patch.py | 1 + .../srv/driven2/_utils/model_base.py | 18 +++++++++++------- .../srv/driven2/_utils/serialization.py | 6 +++++- .../resiliency/srv/driven2/aio/_client.py | 7 ++++++- .../srv/driven2/aio/_operations/_patch.py | 1 + .../resiliency/srv/driven2/aio/_patch.py | 1 + .../response-status-code-range/pyproject.toml | 3 +-- .../response/statuscoderange/_client.py | 7 ++++++- .../statuscoderange/_operations/_patch.py | 1 + .../response/statuscoderange/_patch.py | 1 + .../statuscoderange/_utils/model_base.py | 18 +++++++++++------- .../statuscoderange/_utils/serialization.py | 6 +++++- .../response/statuscoderange/aio/_client.py | 7 ++++++- .../statuscoderange/aio/_operations/_patch.py | 1 + .../response/statuscoderange/aio/_patch.py | 1 + .../response/statuscoderange/models/_patch.py | 1 + .../generated/azure/routes/pyproject.toml | 3 +-- .../generated/azure/routes/routes/_client.py | 7 ++++++- .../generated/azure/routes/routes/_patch.py | 1 + .../azure/routes/routes/_utils/model_base.py | 18 +++++++++++------- .../routes/routes/_utils/serialization.py | 6 +++++- .../azure/routes/routes/aio/_client.py | 7 ++++++- .../azure/routes/routes/aio/_patch.py | 1 + .../routes/routes/aio/operations/_patch.py | 1 + .../azure/routes/routes/operations/_patch.py | 1 + .../pathparameters/aio/operations/_patch.py | 1 + .../labelexpansion/aio/operations/_patch.py | 1 + .../explode/aio/operations/_patch.py | 1 + .../explode/operations/_patch.py | 1 + .../labelexpansion/operations/_patch.py | 1 + .../standard/aio/operations/_patch.py | 1 + .../standard/operations/_patch.py | 1 + .../matrixexpansion/aio/operations/_patch.py | 1 + .../explode/aio/operations/_patch.py | 1 + .../explode/operations/_patch.py | 1 + .../matrixexpansion/operations/_patch.py | 1 + .../standard/aio/operations/_patch.py | 1 + .../standard/operations/_patch.py | 1 + .../routes/pathparameters/operations/_patch.py | 1 + .../pathexpansion/aio/operations/_patch.py | 1 + .../explode/aio/operations/_patch.py | 1 + .../pathexpansion/explode/operations/_patch.py | 1 + .../pathexpansion/operations/_patch.py | 1 + .../standard/aio/operations/_patch.py | 1 + .../standard/operations/_patch.py | 1 + .../reservedexpansion/aio/operations/_patch.py | 1 + .../reservedexpansion/operations/_patch.py | 1 + .../simpleexpansion/aio/operations/_patch.py | 1 + .../explode/aio/operations/_patch.py | 1 + .../explode/operations/_patch.py | 1 + .../simpleexpansion/operations/_patch.py | 1 + .../standard/aio/operations/_patch.py | 1 + .../standard/operations/_patch.py | 1 + .../queryparameters/aio/operations/_patch.py | 1 + .../queryparameters/operations/_patch.py | 1 + .../querycontinuation/aio/operations/_patch.py | 1 + .../explode/aio/operations/_patch.py | 1 + .../explode/operations/_patch.py | 1 + .../querycontinuation/operations/_patch.py | 1 + .../standard/aio/operations/_patch.py | 1 + .../standard/operations/_patch.py | 1 + .../queryexpansion/aio/operations/_patch.py | 1 + .../explode/aio/operations/_patch.py | 1 + .../explode/operations/_patch.py | 1 + .../queryexpansion/operations/_patch.py | 1 + .../standard/aio/operations/_patch.py | 1 + .../standard/operations/_patch.py | 1 + .../pyproject.toml | 3 +-- .../serialization/encodedname/json/_client.py | 7 ++++++- .../serialization/encodedname/json/_patch.py | 1 + .../encodedname/json/_utils/model_base.py | 18 +++++++++++------- .../encodedname/json/_utils/serialization.py | 6 +++++- .../encodedname/json/aio/_client.py | 7 ++++++- .../encodedname/json/aio/_patch.py | 1 + .../encodedname/json/aio/operations/_patch.py | 1 + .../encodedname/json/models/_patch.py | 1 + .../encodedname/json/operations/_patch.py | 1 + .../server-endpoint-not-defined/pyproject.toml | 3 +-- .../server/endpoint/notdefined/_client.py | 7 ++++++- .../endpoint/notdefined/_operations/_patch.py | 1 + .../server/endpoint/notdefined/_patch.py | 1 + .../endpoint/notdefined/_utils/model_base.py | 18 +++++++++++------- .../notdefined/_utils/serialization.py | 6 +++++- .../server/endpoint/notdefined/aio/_client.py | 7 ++++++- .../notdefined/aio/_operations/_patch.py | 1 + .../server/endpoint/notdefined/aio/_patch.py | 1 + .../azure/server-path-multiple/pyproject.toml | 3 +-- .../server/path/multiple/_client.py | 7 ++++++- .../server/path/multiple/_operations/_patch.py | 1 - .../server/path/multiple/_patch.py | 1 - .../server/path/multiple/_utils/model_base.py | 18 +++++++++++------- .../path/multiple/_utils/serialization.py | 6 +++++- .../server/path/multiple/aio/_client.py | 7 ++++++- .../path/multiple/aio/_operations/_patch.py | 1 - .../server/path/multiple/aio/_patch.py | 1 - .../server/path/multiple/models/_patch.py | 1 - .../azure/server-path-single/pyproject.toml | 3 +-- .../server/path/single/_client.py | 7 ++++++- .../server/path/single/_operations/_patch.py | 1 + .../server/path/single/_patch.py | 1 + .../server/path/single/_utils/model_base.py | 18 +++++++++++------- .../server/path/single/_utils/serialization.py | 6 +++++- .../server/path/single/aio/_client.py | 7 ++++++- .../path/single/aio/_operations/_patch.py | 1 + .../server/path/single/aio/_patch.py | 1 + .../pyproject.toml | 3 +-- .../server/versions/notversioned/_client.py | 7 ++++++- .../notversioned/_operations/_patch.py | 1 + .../server/versions/notversioned/_patch.py | 1 + .../versions/notversioned/_utils/model_base.py | 18 +++++++++++------- .../notversioned/_utils/serialization.py | 6 +++++- .../versions/notversioned/aio/_client.py | 7 ++++++- .../notversioned/aio/_operations/_patch.py | 1 + .../server/versions/notversioned/aio/_patch.py | 1 + .../server-versions-versioned/pyproject.toml | 3 +-- .../server/versions/versioned/_client.py | 7 ++++++- .../versions/versioned/_operations/_patch.py | 1 + .../server/versions/versioned/_patch.py | 1 + .../versions/versioned/_utils/model_base.py | 18 +++++++++++------- .../versions/versioned/_utils/serialization.py | 6 +++++- .../server/versions/versioned/aio/_client.py | 7 ++++++- .../versioned/aio/_operations/_patch.py | 1 + .../server/versions/versioned/aio/_patch.py | 1 + .../azure/service-multi-service/pyproject.toml | 3 +-- .../service/multiservice/_client.py | 7 ++++++- .../service/multiservice/_patch.py | 1 - .../service/multiservice/_utils/model_base.py | 18 +++++++++++------- .../multiservice/_utils/serialization.py | 6 +++++- .../service/multiservice/aio/_client.py | 7 ++++++- .../service/multiservice/aio/_patch.py | 1 - .../multiservice/aio/operations/_patch.py | 1 - .../service/multiservice/models/_patch.py | 1 - .../service/multiservice/operations/_patch.py | 1 - .../setuppy-authentication-union/setup.py | 4 +--- .../setuppy/authentication/union/_client.py | 7 ++++++- .../authentication/union/_operations/_patch.py | 1 + .../setuppy/authentication/union/_patch.py | 1 + .../authentication/union/_utils/model_base.py | 18 +++++++++++------- .../union/_utils/serialization.py | 6 +++++- .../authentication/union/aio/_client.py | 7 ++++++- .../union/aio/_operations/_patch.py | 1 + .../setuppy/authentication/union/aio/_patch.py | 1 + .../pyproject.toml | 3 +-- .../conditionalrequest/_client.py | 7 ++++++- .../conditionalrequest/_operations/_patch.py | 1 + .../conditionalrequest/_patch.py | 1 + .../conditionalrequest/_utils/model_base.py | 18 +++++++++++------- .../conditionalrequest/_utils/serialization.py | 6 +++++- .../conditionalrequest/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 + .../conditionalrequest/aio/_patch.py | 1 + .../pyproject.toml | 3 +-- .../specialheaders/repeatability/_client.py | 7 ++++++- .../repeatability/_operations/_patch.py | 1 + .../specialheaders/repeatability/_patch.py | 1 + .../repeatability/_utils/model_base.py | 18 +++++++++++------- .../repeatability/_utils/serialization.py | 6 +++++- .../repeatability/aio/_client.py | 7 ++++++- .../repeatability/aio/_operations/_patch.py | 1 + .../specialheaders/repeatability/aio/_patch.py | 1 + .../azure/special-words/pyproject.toml | 3 +-- .../special-words/specialwords/_client.py | 7 ++++++- .../azure/special-words/specialwords/_patch.py | 1 + .../specialwords/_utils/model_base.py | 18 +++++++++++------- .../specialwords/_utils/serialization.py | 6 +++++- .../special-words/specialwords/aio/_client.py | 7 ++++++- .../special-words/specialwords/aio/_patch.py | 1 + .../specialwords/aio/operations/_patch.py | 1 + .../specialwords/models/_patch.py | 1 + .../specialwords/operations/_patch.py | 1 + .../azure/specs-documentation/pyproject.toml | 3 +-- .../specs/documentation/_client.py | 7 ++++++- .../specs/documentation/_patch.py | 1 - .../specs/documentation/_utils/model_base.py | 18 +++++++++++------- .../documentation/_utils/serialization.py | 6 +++++- .../specs/documentation/aio/_client.py | 7 ++++++- .../specs/documentation/aio/_patch.py | 1 - .../documentation/aio/operations/_patch.py | 1 - .../specs/documentation/models/_patch.py | 1 - .../specs/documentation/operations/_patch.py | 1 - .../azure/streaming-jsonl/pyproject.toml | 3 +-- .../streaming-jsonl/streaming/jsonl/_client.py | 7 ++++++- .../streaming-jsonl/streaming/jsonl/_patch.py | 1 + .../streaming/jsonl/_utils/model_base.py | 18 +++++++++++------- .../streaming/jsonl/_utils/serialization.py | 6 +++++- .../streaming/jsonl/aio/_client.py | 7 ++++++- .../streaming/jsonl/aio/_patch.py | 1 + .../jsonl/basic/aio/operations/_patch.py | 1 + .../streaming/jsonl/basic/models/_patch.py | 1 - .../streaming/jsonl/basic/operations/_patch.py | 1 + .../azure/typetest-array/pyproject.toml | 3 +-- .../typetest-array/typetest/array/_client.py | 7 ++++++- .../typetest-array/typetest/array/_patch.py | 1 + .../typetest/array/_utils/model_base.py | 18 +++++++++++------- .../typetest/array/_utils/serialization.py | 6 +++++- .../typetest/array/aio/_client.py | 7 ++++++- .../typetest/array/aio/_patch.py | 1 + .../typetest/array/aio/operations/_patch.py | 1 + .../typetest/array/models/_patch.py | 1 + .../typetest/array/operations/_patch.py | 1 + .../azure/typetest-dictionary/pyproject.toml | 3 +-- .../typetest/dictionary/_client.py | 7 ++++++- .../typetest/dictionary/_patch.py | 1 + .../typetest/dictionary/_utils/model_base.py | 18 +++++++++++------- .../dictionary/_utils/serialization.py | 6 +++++- .../typetest/dictionary/aio/_client.py | 7 ++++++- .../typetest/dictionary/aio/_patch.py | 1 + .../dictionary/aio/operations/_patch.py | 1 + .../typetest/dictionary/models/_patch.py | 1 + .../typetest/dictionary/operations/_patch.py | 1 + .../typetest-discriminatedunion/pyproject.toml | 3 +-- .../typetest/discriminatedunion/_client.py | 7 ++++++- .../typetest/discriminatedunion/_patch.py | 1 - .../discriminatedunion/_utils/model_base.py | 18 +++++++++++------- .../discriminatedunion/_utils/serialization.py | 6 +++++- .../typetest/discriminatedunion/aio/_client.py | 7 ++++++- .../typetest/discriminatedunion/aio/_patch.py | 1 - .../aio/operations/_patch.py | 1 - .../discriminatedunion/models/_patch.py | 1 - .../discriminatedunion/operations/_patch.py | 1 - .../typetest-enum-extensible/pyproject.toml | 3 +-- .../typetest/enum/extensible/_client.py | 7 ++++++- .../typetest/enum/extensible/_patch.py | 1 + .../enum/extensible/_utils/model_base.py | 18 +++++++++++------- .../enum/extensible/_utils/serialization.py | 6 +++++- .../typetest/enum/extensible/aio/_client.py | 7 ++++++- .../typetest/enum/extensible/aio/_patch.py | 1 + .../enum/extensible/aio/operations/_patch.py | 1 + .../typetest/enum/extensible/models/_patch.py | 1 + .../enum/extensible/operations/_patch.py | 1 + .../azure/typetest-enum-fixed/pyproject.toml | 3 +-- .../typetest/enum/fixed/_client.py | 7 ++++++- .../typetest/enum/fixed/_patch.py | 1 + .../typetest/enum/fixed/_utils/model_base.py | 18 +++++++++++------- .../enum/fixed/_utils/serialization.py | 6 +++++- .../typetest/enum/fixed/aio/_client.py | 7 ++++++- .../typetest/enum/fixed/aio/_patch.py | 1 + .../enum/fixed/aio/operations/_patch.py | 1 + .../typetest/enum/fixed/models/_patch.py | 1 + .../typetest/enum/fixed/operations/_patch.py | 1 + .../azure/typetest-model-empty/pyproject.toml | 3 +-- .../typetest/model/empty/_client.py | 7 ++++++- .../typetest/model/empty/_operations/_patch.py | 1 + .../typetest/model/empty/_patch.py | 1 + .../typetest/model/empty/_utils/model_base.py | 18 +++++++++++------- .../model/empty/_utils/serialization.py | 6 +++++- .../typetest/model/empty/aio/_client.py | 7 ++++++- .../model/empty/aio/_operations/_patch.py | 1 + .../typetest/model/empty/aio/_patch.py | 1 + .../typetest/model/empty/models/_patch.py | 1 + .../pyproject.toml | 3 +-- .../model/enumdiscriminator/_client.py | 7 ++++++- .../enumdiscriminator/_operations/_patch.py | 1 - .../typetest/model/enumdiscriminator/_patch.py | 1 - .../enumdiscriminator/_utils/model_base.py | 18 +++++++++++------- .../enumdiscriminator/_utils/serialization.py | 6 +++++- .../model/enumdiscriminator/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 - .../model/enumdiscriminator/aio/_patch.py | 1 - .../model/enumdiscriminator/models/_patch.py | 1 - .../pyproject.toml | 3 +-- .../model/nesteddiscriminator/_client.py | 7 ++++++- .../nesteddiscriminator/_operations/_patch.py | 1 + .../model/nesteddiscriminator/_patch.py | 1 + .../nesteddiscriminator/_utils/model_base.py | 18 +++++++++++------- .../_utils/serialization.py | 6 +++++- .../model/nesteddiscriminator/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 + .../model/nesteddiscriminator/aio/_patch.py | 1 + .../model/nesteddiscriminator/models/_patch.py | 1 + .../pyproject.toml | 3 +-- .../typetest/model/notdiscriminated/_client.py | 7 ++++++- .../notdiscriminated/_operations/_patch.py | 1 + .../typetest/model/notdiscriminated/_patch.py | 1 + .../notdiscriminated/_utils/model_base.py | 18 +++++++++++------- .../notdiscriminated/_utils/serialization.py | 6 +++++- .../model/notdiscriminated/aio/_client.py | 7 ++++++- .../notdiscriminated/aio/_operations/_patch.py | 1 + .../model/notdiscriminated/aio/_patch.py | 1 + .../model/notdiscriminated/models/_patch.py | 1 + .../typetest-model-recursive/pyproject.toml | 3 +-- .../typetest/model/recursive/_client.py | 7 ++++++- .../model/recursive/_operations/_patch.py | 1 + .../typetest/model/recursive/_patch.py | 1 + .../model/recursive/_utils/model_base.py | 18 +++++++++++------- .../model/recursive/_utils/serialization.py | 6 +++++- .../typetest/model/recursive/aio/_client.py | 7 ++++++- .../model/recursive/aio/_operations/_patch.py | 1 + .../typetest/model/recursive/aio/_patch.py | 1 + .../typetest/model/recursive/models/_patch.py | 1 + .../pyproject.toml | 3 +-- .../model/singlediscriminator/_client.py | 7 ++++++- .../singlediscriminator/_operations/_patch.py | 1 + .../model/singlediscriminator/_patch.py | 1 + .../singlediscriminator/_utils/model_base.py | 18 +++++++++++------- .../_utils/serialization.py | 6 +++++- .../model/singlediscriminator/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 + .../model/singlediscriminator/aio/_patch.py | 1 + .../model/singlediscriminator/models/_patch.py | 1 + .../azure/typetest-model-usage/pyproject.toml | 3 +-- .../typetest/model/usage/_client.py | 7 ++++++- .../typetest/model/usage/_operations/_patch.py | 1 + .../typetest/model/usage/_patch.py | 1 + .../typetest/model/usage/_utils/model_base.py | 18 +++++++++++------- .../model/usage/_utils/serialization.py | 6 +++++- .../typetest/model/usage/aio/_client.py | 7 ++++++- .../model/usage/aio/_operations/_patch.py | 1 + .../typetest/model/usage/aio/_patch.py | 1 + .../typetest/model/usage/models/_patch.py | 1 + .../typetest-model-visibility/pyproject.toml | 3 +-- .../typetest/model/visibility/_client.py | 7 ++++++- .../model/visibility/_operations/_patch.py | 1 + .../typetest/model/visibility/_patch.py | 1 + .../model/visibility/_utils/model_base.py | 18 +++++++++++------- .../model/visibility/_utils/serialization.py | 6 +++++- .../typetest/model/visibility/aio/_client.py | 7 ++++++- .../model/visibility/aio/_operations/_patch.py | 1 + .../typetest/model/visibility/aio/_patch.py | 1 + .../typetest/model/visibility/models/_patch.py | 1 + .../pyproject.toml | 3 +-- .../property/additionalproperties/_client.py | 7 ++++++- .../property/additionalproperties/_patch.py | 1 + .../additionalproperties/_utils/model_base.py | 18 +++++++++++------- .../_utils/serialization.py | 6 +++++- .../additionalproperties/aio/_client.py | 7 ++++++- .../additionalproperties/aio/_patch.py | 1 + .../aio/operations/_patch.py | 1 + .../additionalproperties/models/_patch.py | 1 + .../additionalproperties/operations/_patch.py | 1 + .../typetest-property-nullable/pyproject.toml | 3 +-- .../typetest/property/nullable/_client.py | 7 ++++++- .../typetest/property/nullable/_patch.py | 1 + .../property/nullable/_utils/model_base.py | 18 +++++++++++------- .../property/nullable/_utils/serialization.py | 6 +++++- .../typetest/property/nullable/aio/_client.py | 7 ++++++- .../typetest/property/nullable/aio/_patch.py | 1 + .../property/nullable/aio/operations/_patch.py | 1 + .../property/nullable/models/_patch.py | 1 + .../property/nullable/operations/_patch.py | 1 + .../typetest-property-optional/pyproject.toml | 3 +-- .../typetest/property/optional/_client.py | 7 ++++++- .../typetest/property/optional/_patch.py | 1 + .../property/optional/_utils/model_base.py | 18 +++++++++++------- .../property/optional/_utils/serialization.py | 6 +++++- .../typetest/property/optional/aio/_client.py | 7 ++++++- .../typetest/property/optional/aio/_patch.py | 1 + .../property/optional/aio/operations/_patch.py | 1 + .../property/optional/models/_patch.py | 1 + .../property/optional/operations/_patch.py | 1 + .../pyproject.toml | 3 +-- .../typetest/property/valuetypes/_client.py | 7 ++++++- .../typetest/property/valuetypes/_patch.py | 1 + .../property/valuetypes/_utils/model_base.py | 18 +++++++++++------- .../valuetypes/_utils/serialization.py | 6 +++++- .../property/valuetypes/aio/_client.py | 7 ++++++- .../typetest/property/valuetypes/aio/_patch.py | 1 + .../valuetypes/aio/operations/_patch.py | 1 + .../property/valuetypes/models/_patch.py | 1 + .../property/valuetypes/operations/_patch.py | 1 + .../azure/typetest-scalar/pyproject.toml | 3 +-- .../typetest-scalar/typetest/scalar/_client.py | 7 ++++++- .../typetest-scalar/typetest/scalar/_patch.py | 1 + .../typetest/scalar/_utils/model_base.py | 18 +++++++++++------- .../typetest/scalar/_utils/serialization.py | 6 +++++- .../typetest/scalar/aio/_client.py | 7 ++++++- .../typetest/scalar/aio/_patch.py | 1 + .../typetest/scalar/aio/operations/_patch.py | 1 + .../typetest/scalar/operations/_patch.py | 1 + .../azure/typetest-union/pyproject.toml | 3 +-- .../typetest-union/typetest/union/_client.py | 7 ++++++- .../typetest-union/typetest/union/_patch.py | 1 - .../typetest/union/_utils/model_base.py | 18 +++++++++++------- .../typetest/union/_utils/serialization.py | 6 +++++- .../typetest/union/aio/_client.py | 7 ++++++- .../typetest/union/aio/_patch.py | 1 - .../typetest/union/aio/operations/_patch.py | 1 - .../typetest/union/models/_patch.py | 1 - .../typetest/union/operations/_patch.py | 1 - .../azure/versioning-added/pyproject.toml | 3 +-- .../versioning/added/_client.py | 7 ++++++- .../versioning/added/_patch.py | 1 + .../versioning/added/_utils/model_base.py | 18 +++++++++++------- .../versioning/added/_utils/serialization.py | 6 +++++- .../versioning/added/aio/_client.py | 7 ++++++- .../versioning/added/aio/_patch.py | 1 + .../versioning/added/aio/operations/_patch.py | 1 + .../versioning/added/models/_patch.py | 1 + .../versioning/added/operations/_patch.py | 1 + .../versioning-madeoptional/pyproject.toml | 3 +-- .../versioning/madeoptional/_client.py | 7 ++++++- .../madeoptional/_operations/_patch.py | 1 + .../versioning/madeoptional/_patch.py | 1 + .../madeoptional/_utils/model_base.py | 18 +++++++++++------- .../madeoptional/_utils/serialization.py | 6 +++++- .../versioning/madeoptional/aio/_client.py | 7 ++++++- .../madeoptional/aio/_operations/_patch.py | 1 + .../versioning/madeoptional/aio/_patch.py | 1 + .../versioning/madeoptional/models/_patch.py | 1 + .../azure/versioning-removed/pyproject.toml | 3 +-- .../versioning/removed/_client.py | 7 ++++++- .../versioning/removed/_operations/_patch.py | 1 + .../versioning/removed/_patch.py | 1 + .../versioning/removed/_utils/model_base.py | 18 +++++++++++------- .../versioning/removed/_utils/serialization.py | 6 +++++- .../versioning/removed/aio/_client.py | 7 ++++++- .../removed/aio/_operations/_patch.py | 1 + .../versioning/removed/aio/_patch.py | 1 + .../versioning/removed/models/_patch.py | 1 + .../versioning-renamedfrom/pyproject.toml | 3 +-- .../versioning/renamedfrom/_client.py | 7 ++++++- .../versioning/renamedfrom/_patch.py | 1 + .../renamedfrom/_utils/model_base.py | 18 +++++++++++------- .../renamedfrom/_utils/serialization.py | 6 +++++- .../versioning/renamedfrom/aio/_client.py | 7 ++++++- .../versioning/renamedfrom/aio/_patch.py | 1 + .../renamedfrom/aio/operations/_patch.py | 1 + .../versioning/renamedfrom/models/_patch.py | 1 + .../renamedfrom/operations/_patch.py | 1 + .../pyproject.toml | 3 +-- .../returntypechangedfrom/_client.py | 7 ++++++- .../_operations/_patch.py | 1 + .../versioning/returntypechangedfrom/_patch.py | 1 + .../returntypechangedfrom/_utils/model_base.py | 18 +++++++++++------- .../_utils/serialization.py | 6 +++++- .../returntypechangedfrom/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 + .../returntypechangedfrom/aio/_patch.py | 1 + .../returntypechangedfrom/models/_patch.py | 1 + .../versioning-typechangedfrom/pyproject.toml | 3 +-- .../versioning/typechangedfrom/_client.py | 7 ++++++- .../typechangedfrom/_operations/_patch.py | 1 + .../versioning/typechangedfrom/_patch.py | 1 + .../typechangedfrom/_utils/model_base.py | 18 +++++++++++------- .../typechangedfrom/_utils/serialization.py | 6 +++++- .../versioning/typechangedfrom/aio/_client.py | 7 ++++++- .../typechangedfrom/aio/_operations/_patch.py | 1 + .../versioning/typechangedfrom/aio/_patch.py | 1 + .../typechangedfrom/models/_patch.py | 1 + .../authentication/apikey/_client.py | 7 ++++++- .../apikey/_operations/_patch.py | 1 + .../authentication/apikey/_patch.py | 1 + .../authentication/apikey/_utils/model_base.py | 18 +++++++++++------- .../apikey/_utils/serialization.py | 6 +++++- .../authentication/apikey/aio/_client.py | 7 ++++++- .../apikey/aio/_operations/_patch.py | 1 + .../authentication/apikey/aio/_patch.py | 1 + .../authentication/apikey/models/_patch.py | 1 + .../authentication-api-key/pyproject.toml | 3 +-- .../authentication/http/custom/_client.py | 7 ++++++- .../http/custom/_operations/_patch.py | 1 + .../authentication/http/custom/_patch.py | 1 + .../http/custom/_utils/model_base.py | 18 +++++++++++------- .../http/custom/_utils/serialization.py | 6 +++++- .../authentication/http/custom/aio/_client.py | 7 ++++++- .../http/custom/aio/_operations/_patch.py | 1 + .../authentication/http/custom/aio/_patch.py | 1 + .../http/custom/models/_patch.py | 1 + .../authentication-http-custom/pyproject.toml | 3 +-- .../authentication/noauth/union/_client.py | 7 ++++++- .../noauth/union/_operations/_patch.py | 1 - .../authentication/noauth/union/_patch.py | 1 - .../noauth/union/_utils/model_base.py | 18 +++++++++++------- .../noauth/union/_utils/serialization.py | 6 +++++- .../authentication/noauth/union/aio/_client.py | 7 ++++++- .../noauth/union/aio/_operations/_patch.py | 1 - .../authentication/noauth/union/aio/_patch.py | 1 - .../authentication-noauth-union/pyproject.toml | 3 +-- .../authentication/oauth2/_client.py | 7 ++++++- .../oauth2/_operations/_patch.py | 1 + .../authentication/oauth2/_patch.py | 1 + .../authentication/oauth2/_utils/model_base.py | 18 +++++++++++------- .../oauth2/_utils/serialization.py | 6 +++++- .../authentication/oauth2/aio/_client.py | 7 ++++++- .../oauth2/aio/_operations/_patch.py | 1 + .../authentication/oauth2/aio/_patch.py | 1 + .../authentication/oauth2/models/_patch.py | 1 + .../authentication-oauth2/pyproject.toml | 3 +-- .../authentication/union/_client.py | 7 ++++++- .../authentication/union/_operations/_patch.py | 1 + .../authentication/union/_patch.py | 1 + .../authentication/union/_utils/model_base.py | 18 +++++++++++------- .../union/_utils/serialization.py | 6 +++++- .../authentication/union/aio/_client.py | 7 ++++++- .../union/aio/_operations/_patch.py | 1 + .../authentication/union/aio/_patch.py | 1 + .../authentication-union/pyproject.toml | 3 +-- .../encode-array/encode/array/_client.py | 7 ++++++- .../encode-array/encode/array/_patch.py | 1 - .../encode/array/_utils/model_base.py | 18 +++++++++++------- .../encode/array/_utils/serialization.py | 6 +++++- .../encode-array/encode/array/aio/_client.py | 7 ++++++- .../encode-array/encode/array/aio/_patch.py | 1 - .../encode-array/encode/array/models/_patch.py | 1 - .../array/property/aio/operations/_patch.py | 1 - .../encode/array/property/operations/_patch.py | 1 - .../unbranded/encode-array/pyproject.toml | 3 +-- .../encode-bytes/encode/bytes/_client.py | 7 ++++++- .../encode-bytes/encode/bytes/_patch.py | 1 + .../encode/bytes/_utils/model_base.py | 18 +++++++++++------- .../encode/bytes/_utils/serialization.py | 6 +++++- .../encode-bytes/encode/bytes/aio/_client.py | 7 ++++++- .../encode-bytes/encode/bytes/aio/_patch.py | 1 + .../bytes/header/aio/operations/_patch.py | 1 + .../encode/bytes/header/operations/_patch.py | 1 + .../encode-bytes/encode/bytes/models/_patch.py | 1 + .../bytes/property/aio/operations/_patch.py | 1 + .../encode/bytes/property/operations/_patch.py | 1 + .../bytes/query/aio/operations/_patch.py | 1 + .../encode/bytes/query/operations/_patch.py | 1 + .../bytes/requestbody/aio/operations/_patch.py | 1 + .../bytes/requestbody/operations/_patch.py | 1 + .../responsebody/aio/operations/_patch.py | 1 + .../bytes/responsebody/operations/_patch.py | 1 + .../unbranded/encode-bytes/pyproject.toml | 3 +-- .../encode-datetime/encode/datetime/_client.py | 7 ++++++- .../encode-datetime/encode/datetime/_patch.py | 1 + .../encode/datetime/_utils/model_base.py | 18 +++++++++++------- .../encode/datetime/_utils/serialization.py | 6 +++++- .../encode/datetime/aio/_client.py | 7 ++++++- .../encode/datetime/aio/_patch.py | 1 + .../datetime/header/aio/operations/_patch.py | 1 + .../datetime/header/operations/_patch.py | 1 + .../encode/datetime/models/_patch.py | 1 + .../datetime/property/aio/operations/_patch.py | 1 + .../datetime/property/operations/_patch.py | 1 + .../datetime/query/aio/operations/_patch.py | 1 + .../encode/datetime/query/operations/_patch.py | 1 + .../responseheader/aio/operations/_patch.py | 1 + .../responseheader/operations/_patch.py | 1 + .../unbranded/encode-datetime/pyproject.toml | 3 +-- .../encode-duration/encode/duration/_client.py | 7 ++++++- .../encode-duration/encode/duration/_patch.py | 1 + .../encode/duration/_utils/model_base.py | 18 +++++++++++------- .../encode/duration/_utils/serialization.py | 6 +++++- .../encode/duration/aio/_client.py | 7 ++++++- .../encode/duration/aio/_patch.py | 1 + .../duration/header/aio/operations/_patch.py | 1 + .../duration/header/operations/_patch.py | 1 + .../duration/property/aio/operations/_patch.py | 1 + .../encode/duration/property/models/_patch.py | 1 + .../duration/property/operations/_patch.py | 1 + .../duration/query/aio/operations/_patch.py | 1 + .../encode/duration/query/operations/_patch.py | 1 + .../unbranded/encode-duration/pyproject.toml | 3 +-- .../encode-numeric/encode/numeric/_client.py | 7 ++++++- .../encode-numeric/encode/numeric/_patch.py | 1 + .../encode/numeric/_utils/model_base.py | 18 +++++++++++------- .../encode/numeric/_utils/serialization.py | 6 +++++- .../encode/numeric/aio/_client.py | 7 ++++++- .../encode/numeric/aio/_patch.py | 1 + .../numeric/property/aio/operations/_patch.py | 1 + .../encode/numeric/property/models/_patch.py | 1 + .../numeric/property/operations/_patch.py | 1 + .../unbranded/encode-numeric/pyproject.toml | 3 +-- .../generation/subdir/_generated/_client.py | 7 ++++++- .../subdir/_generated/_operations/_patch.py | 1 + .../generation/subdir/_generated/_patch.py | 1 + .../subdir/_generated/_utils/model_base.py | 18 +++++++++++------- .../subdir/_generated/_utils/serialization.py | 6 +++++- .../subdir/_generated/aio/_client.py | 7 ++++++- .../_generated/aio/_operations/_patch.py | 1 + .../generation/subdir/_generated/aio/_patch.py | 1 + .../subdir/_generated/models/_patch.py | 1 + .../unbranded/generation-subdir/pyproject.toml | 3 +-- .../generation/subdir2/_generated/_client.py | 7 ++++++- .../generation/subdir2/_generated/_patch.py | 1 - .../subdir2/_generated/_utils/model_base.py | 18 +++++++++++------- .../subdir2/_generated/_utils/serialization.py | 6 +++++- .../subdir2/_generated/aio/_client.py | 7 ++++++- .../subdir2/_generated/aio/_patch.py | 1 - .../_generated/aio/operations/_patch.py | 1 - .../subdir2/_generated/models/_patch.py | 1 - .../subdir2/_generated/operations/_patch.py | 1 - .../generation-subdir2/pyproject.toml | 3 +-- .../headasbooleanfalse/_client.py | 7 ++++++- .../headasbooleanfalse/_operations/_patch.py | 1 + .../headasbooleanfalse/_patch.py | 1 + .../headasbooleanfalse/_utils/model_base.py | 18 +++++++++++------- .../headasbooleanfalse/_utils/serialization.py | 6 +++++- .../headasbooleanfalse/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 + .../headasbooleanfalse/aio/_patch.py | 1 + .../headasbooleanfalse/models/_patch.py | 1 + .../headasbooleanfalse/pyproject.toml | 3 +-- .../headasbooleantrue/_client.py | 7 ++++++- .../headasbooleantrue/_operations/_patch.py | 1 + .../headasbooleantrue/_patch.py | 1 + .../headasbooleantrue/_utils/model_base.py | 18 +++++++++++------- .../headasbooleantrue/_utils/serialization.py | 6 +++++- .../headasbooleantrue/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 + .../headasbooleantrue/aio/_patch.py | 1 + .../headasbooleantrue/models/_patch.py | 1 + .../unbranded/headasbooleantrue/pyproject.toml | 3 +-- .../parameters/basic/_client.py | 7 ++++++- .../parameters/basic/_patch.py | 1 + .../parameters/basic/_utils/model_base.py | 18 +++++++++++------- .../parameters/basic/_utils/serialization.py | 6 +++++- .../parameters/basic/aio/_client.py | 7 ++++++- .../parameters/basic/aio/_patch.py | 1 + .../explicitbody/aio/operations/_patch.py | 1 + .../basic/explicitbody/models/_patch.py | 1 + .../basic/explicitbody/operations/_patch.py | 1 + .../implicitbody/aio/operations/_patch.py | 1 + .../basic/implicitbody/operations/_patch.py | 1 + .../unbranded/parameters-basic/pyproject.toml | 3 +-- .../parameters/bodyoptionality/_client.py | 7 ++++++- .../bodyoptionality/_operations/_patch.py | 1 + .../parameters/bodyoptionality/_patch.py | 1 + .../bodyoptionality/_utils/model_base.py | 18 +++++++++++------- .../bodyoptionality/_utils/serialization.py | 6 +++++- .../parameters/bodyoptionality/aio/_client.py | 7 ++++++- .../bodyoptionality/aio/_operations/_patch.py | 1 + .../parameters/bodyoptionality/aio/_patch.py | 1 + .../bodyoptionality/models/_patch.py | 1 + .../optionalexplicit/aio/operations/_patch.py | 1 + .../optionalexplicit/operations/_patch.py | 1 + .../parameters-body-optionality/pyproject.toml | 3 +-- .../parameters/collectionformat/_client.py | 7 ++++++- .../parameters/collectionformat/_patch.py | 1 + .../collectionformat/_utils/model_base.py | 18 +++++++++++------- .../collectionformat/_utils/serialization.py | 6 +++++- .../parameters/collectionformat/aio/_client.py | 7 ++++++- .../parameters/collectionformat/aio/_patch.py | 1 + .../header/aio/operations/_patch.py | 1 + .../header/operations/_patch.py | 1 + .../query/aio/operations/_patch.py | 1 + .../query/operations/_patch.py | 1 + .../pyproject.toml | 3 +-- .../parameters-path/parameters/path/_client.py | 7 ++++++- .../parameters/path/_operations/_patch.py | 1 + .../parameters-path/parameters/path/_patch.py | 1 + .../parameters/path/_utils/model_base.py | 18 +++++++++++------- .../parameters/path/_utils/serialization.py | 6 +++++- .../parameters/path/aio/_client.py | 7 ++++++- .../parameters/path/aio/_operations/_patch.py | 1 + .../parameters/path/aio/_patch.py | 1 + .../unbranded/parameters-path/pyproject.toml | 3 +-- .../parameters/query/_client.py | 7 ++++++- .../parameters/query/_patch.py | 1 - .../parameters/query/_utils/model_base.py | 18 +++++++++++------- .../parameters/query/_utils/serialization.py | 6 +++++- .../parameters/query/aio/_client.py | 7 ++++++- .../parameters/query/aio/_patch.py | 1 - .../parameters/query/aio/operations/_patch.py | 1 - .../parameters/query/operations/_patch.py | 1 - .../unbranded/parameters-query/pyproject.toml | 3 +-- .../parameters/spread/_client.py | 7 ++++++- .../parameters/spread/_patch.py | 1 + .../parameters/spread/_utils/model_base.py | 18 +++++++++++------- .../parameters/spread/_utils/serialization.py | 6 +++++- .../parameters/spread/aio/_client.py | 7 ++++++- .../parameters/spread/aio/_patch.py | 1 + .../spread/alias/aio/operations/_patch.py | 1 + .../spread/alias/operations/_patch.py | 1 + .../spread/model/aio/operations/_patch.py | 1 + .../parameters/spread/model/models/_patch.py | 1 + .../spread/model/operations/_patch.py | 1 + .../unbranded/parameters-spread/pyproject.toml | 3 +-- .../payload/contentnegotiation/_client.py | 7 ++++++- .../payload/contentnegotiation/_patch.py | 1 + .../contentnegotiation/_utils/model_base.py | 18 +++++++++++------- .../contentnegotiation/_utils/serialization.py | 6 +++++- .../payload/contentnegotiation/aio/_client.py | 7 ++++++- .../payload/contentnegotiation/aio/_patch.py | 1 + .../differentbody/aio/operations/_patch.py | 1 + .../differentbody/models/_patch.py | 1 + .../differentbody/operations/_patch.py | 1 + .../samebody/aio/operations/_patch.py | 1 + .../samebody/operations/_patch.py | 1 + .../payload-content-negotiation/pyproject.toml | 3 +-- .../payload/jsonmergepatch/_client.py | 7 ++++++- .../jsonmergepatch/_operations/_patch.py | 1 + .../payload/jsonmergepatch/_patch.py | 1 + .../jsonmergepatch/_utils/model_base.py | 18 +++++++++++------- .../jsonmergepatch/_utils/serialization.py | 6 +++++- .../payload/jsonmergepatch/aio/_client.py | 7 ++++++- .../jsonmergepatch/aio/_operations/_patch.py | 1 + .../payload/jsonmergepatch/aio/_patch.py | 1 + .../payload/jsonmergepatch/models/_patch.py | 1 + .../payload-json-merge-patch/pyproject.toml | 3 +-- .../payload/mediatype/_client.py | 7 ++++++- .../payload/mediatype/_patch.py | 1 + .../payload/mediatype/_utils/model_base.py | 18 +++++++++++------- .../payload/mediatype/_utils/serialization.py | 6 +++++- .../payload/mediatype/aio/_client.py | 7 ++++++- .../payload/mediatype/aio/_patch.py | 1 + .../stringbody/aio/operations/_patch.py | 1 + .../mediatype/stringbody/operations/_patch.py | 1 + .../payload-media-type/pyproject.toml | 3 +-- .../payload/multipart/_client.py | 7 ++++++- .../payload/multipart/_patch.py | 1 + .../payload/multipart/_utils/model_base.py | 18 +++++++++++------- .../payload/multipart/_utils/serialization.py | 6 +++++- .../payload/multipart/_utils/utils.py | 1 - .../payload/multipart/aio/_client.py | 7 ++++++- .../payload/multipart/aio/_patch.py | 1 + .../formdata/aio/operations/_patch.py | 1 + .../formdata/file/aio/operations/_patch.py | 1 - .../multipart/formdata/file/models/_patch.py | 1 - .../formdata/file/operations/_patch.py | 1 - .../httpparts/aio/operations/_patch.py | 1 + .../contenttype/aio/operations/_patch.py | 1 + .../httpparts/contenttype/operations/_patch.py | 1 + .../nonstring/aio/operations/_patch.py | 1 + .../httpparts/nonstring/models/_patch.py | 1 + .../httpparts/nonstring/operations/_patch.py | 1 + .../formdata/httpparts/operations/_patch.py | 1 + .../multipart/formdata/models/_patch.py | 1 + .../multipart/formdata/operations/_patch.py | 1 + .../payload/multipart/models/_patch.py | 1 + .../unbranded/payload-multipart/pyproject.toml | 3 +-- .../payload/pageable/_client.py | 7 ++++++- .../payload/pageable/_operations/_patch.py | 1 - .../payload/pageable/_patch.py | 1 + .../payload/pageable/_utils/model_base.py | 18 +++++++++++------- .../payload/pageable/_utils/serialization.py | 6 +++++- .../payload/pageable/aio/_client.py | 7 ++++++- .../payload/pageable/aio/_operations/_patch.py | 1 - .../payload/pageable/aio/_patch.py | 1 + .../payload/pageable/models/_patch.py | 1 + .../pageable/pagesize/aio/operations/_patch.py | 1 - .../pageable/pagesize/operations/_patch.py | 1 - .../aio/operations/_patch.py | 1 + .../aio/operations/_patch.py | 1 - .../alternateinitialverb/models/_patch.py | 1 - .../alternateinitialverb/operations/_patch.py | 1 - .../continuationtoken/aio/operations/_patch.py | 1 + .../continuationtoken/models/_patch.py | 1 + .../continuationtoken/operations/_patch.py | 1 + .../serverdrivenpagination/models/_patch.py | 1 + .../operations/_patch.py | 1 + .../xmlpagination/aio/operations/_patch.py | 1 - .../xmlpagination/operations/_patch.py | 1 - .../unbranded/payload-pageable/pyproject.toml | 3 +-- .../payload-xml/payload/xml/_client.py | 7 ++++++- .../payload-xml/payload/xml/_patch.py | 1 + .../payload/xml/_utils/model_base.py | 18 +++++++++++------- .../payload/xml/_utils/serialization.py | 6 +++++- .../payload-xml/payload/xml/aio/_client.py | 7 ++++++- .../payload-xml/payload/xml/aio/_patch.py | 1 + .../payload/xml/aio/operations/_patch.py | 1 + .../payload-xml/payload/xml/models/_patch.py | 1 + .../payload/xml/operations/_patch.py | 1 + .../unbranded/payload-xml/pyproject.toml | 3 +-- .../response-status-code-range/pyproject.toml | 3 +-- .../response/statuscoderange/_client.py | 7 ++++++- .../statuscoderange/_operations/_patch.py | 1 + .../response/statuscoderange/_patch.py | 1 + .../statuscoderange/_utils/model_base.py | 18 +++++++++++------- .../statuscoderange/_utils/serialization.py | 6 +++++- .../response/statuscoderange/aio/_client.py | 7 ++++++- .../statuscoderange/aio/_operations/_patch.py | 1 + .../response/statuscoderange/aio/_patch.py | 1 + .../response/statuscoderange/models/_patch.py | 1 + .../generated/unbranded/routes/pyproject.toml | 3 +-- .../unbranded/routes/routes/_client.py | 7 ++++++- .../unbranded/routes/routes/_patch.py | 1 + .../routes/routes/_utils/model_base.py | 18 +++++++++++------- .../routes/routes/_utils/serialization.py | 6 +++++- .../unbranded/routes/routes/aio/_client.py | 7 ++++++- .../unbranded/routes/routes/aio/_patch.py | 1 + .../routes/routes/aio/operations/_patch.py | 1 + .../routes/routes/operations/_patch.py | 1 + .../pathparameters/aio/operations/_patch.py | 1 + .../labelexpansion/aio/operations/_patch.py | 1 + .../explode/aio/operations/_patch.py | 1 + .../explode/operations/_patch.py | 1 + .../labelexpansion/operations/_patch.py | 1 + .../standard/aio/operations/_patch.py | 1 + .../standard/operations/_patch.py | 1 + .../matrixexpansion/aio/operations/_patch.py | 1 + .../explode/aio/operations/_patch.py | 1 + .../explode/operations/_patch.py | 1 + .../matrixexpansion/operations/_patch.py | 1 + .../standard/aio/operations/_patch.py | 1 + .../standard/operations/_patch.py | 1 + .../routes/pathparameters/operations/_patch.py | 1 + .../pathexpansion/aio/operations/_patch.py | 1 + .../explode/aio/operations/_patch.py | 1 + .../pathexpansion/explode/operations/_patch.py | 1 + .../pathexpansion/operations/_patch.py | 1 + .../standard/aio/operations/_patch.py | 1 + .../standard/operations/_patch.py | 1 + .../reservedexpansion/aio/operations/_patch.py | 1 + .../reservedexpansion/operations/_patch.py | 1 + .../simpleexpansion/aio/operations/_patch.py | 1 + .../explode/aio/operations/_patch.py | 1 + .../explode/operations/_patch.py | 1 + .../simpleexpansion/operations/_patch.py | 1 + .../standard/aio/operations/_patch.py | 1 + .../standard/operations/_patch.py | 1 + .../queryparameters/aio/operations/_patch.py | 1 + .../queryparameters/operations/_patch.py | 1 + .../querycontinuation/aio/operations/_patch.py | 1 + .../explode/aio/operations/_patch.py | 1 + .../explode/operations/_patch.py | 1 + .../querycontinuation/operations/_patch.py | 1 + .../standard/aio/operations/_patch.py | 1 + .../standard/operations/_patch.py | 1 + .../queryexpansion/aio/operations/_patch.py | 1 + .../explode/aio/operations/_patch.py | 1 + .../explode/operations/_patch.py | 1 + .../queryexpansion/operations/_patch.py | 1 + .../standard/aio/operations/_patch.py | 1 + .../standard/operations/_patch.py | 1 + .../pyproject.toml | 3 +-- .../serialization/encodedname/json/_client.py | 7 ++++++- .../serialization/encodedname/json/_patch.py | 1 + .../encodedname/json/_utils/model_base.py | 18 +++++++++++------- .../encodedname/json/_utils/serialization.py | 6 +++++- .../encodedname/json/aio/_client.py | 7 ++++++- .../encodedname/json/aio/_patch.py | 1 + .../json/property/aio/operations/_patch.py | 1 + .../encodedname/json/property/models/_patch.py | 1 + .../json/property/operations/_patch.py | 1 + .../server-endpoint-not-defined/pyproject.toml | 3 +-- .../server/endpoint/notdefined/_client.py | 7 ++++++- .../endpoint/notdefined/_operations/_patch.py | 1 + .../server/endpoint/notdefined/_patch.py | 1 + .../endpoint/notdefined/_utils/model_base.py | 18 +++++++++++------- .../notdefined/_utils/serialization.py | 6 +++++- .../server/endpoint/notdefined/aio/_client.py | 7 ++++++- .../notdefined/aio/_operations/_patch.py | 1 + .../server/endpoint/notdefined/aio/_patch.py | 1 + .../server-path-multiple/pyproject.toml | 3 +-- .../server/path/multiple/_client.py | 7 ++++++- .../server/path/multiple/_operations/_patch.py | 1 + .../server/path/multiple/_patch.py | 1 + .../server/path/multiple/_utils/model_base.py | 18 +++++++++++------- .../path/multiple/_utils/serialization.py | 6 +++++- .../server/path/multiple/aio/_client.py | 7 ++++++- .../path/multiple/aio/_operations/_patch.py | 1 + .../server/path/multiple/aio/_patch.py | 1 + .../server/path/multiple/models/_patch.py | 1 + .../server-path-single/pyproject.toml | 3 +-- .../server/path/single/_client.py | 7 ++++++- .../server/path/single/_operations/_patch.py | 1 + .../server/path/single/_patch.py | 1 + .../server/path/single/_utils/model_base.py | 18 +++++++++++------- .../server/path/single/_utils/serialization.py | 6 +++++- .../server/path/single/aio/_client.py | 7 ++++++- .../path/single/aio/_operations/_patch.py | 1 + .../server/path/single/aio/_patch.py | 1 + .../pyproject.toml | 3 +-- .../server/versions/notversioned/_client.py | 7 ++++++- .../notversioned/_operations/_patch.py | 1 + .../server/versions/notversioned/_patch.py | 1 + .../versions/notversioned/_utils/model_base.py | 18 +++++++++++------- .../notversioned/_utils/serialization.py | 6 +++++- .../versions/notversioned/aio/_client.py | 7 ++++++- .../notversioned/aio/_operations/_patch.py | 1 + .../server/versions/notversioned/aio/_patch.py | 1 + .../server-versions-versioned/pyproject.toml | 3 +-- .../server/versions/versioned/_client.py | 7 ++++++- .../versions/versioned/_operations/_patch.py | 1 + .../server/versions/versioned/_patch.py | 1 + .../versions/versioned/_utils/model_base.py | 18 +++++++++++------- .../versions/versioned/_utils/serialization.py | 6 +++++- .../server/versions/versioned/aio/_client.py | 7 ++++++- .../versioned/aio/_operations/_patch.py | 1 + .../server/versions/versioned/aio/_patch.py | 1 + .../setuppy-authentication-union/setup.py | 4 +--- .../setuppy/authentication/union/_client.py | 7 ++++++- .../authentication/union/_operations/_patch.py | 1 + .../setuppy/authentication/union/_patch.py | 1 + .../authentication/union/_utils/model_base.py | 18 +++++++++++------- .../union/_utils/serialization.py | 6 +++++- .../authentication/union/aio/_client.py | 7 ++++++- .../union/aio/_operations/_patch.py | 1 + .../setuppy/authentication/union/aio/_patch.py | 1 + .../pyproject.toml | 3 +-- .../conditionalrequest/_client.py | 7 ++++++- .../conditionalrequest/_operations/_patch.py | 1 + .../conditionalrequest/_patch.py | 1 + .../conditionalrequest/_utils/model_base.py | 18 +++++++++++------- .../conditionalrequest/_utils/serialization.py | 6 +++++- .../conditionalrequest/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 + .../conditionalrequest/aio/_patch.py | 1 + .../pyproject.toml | 3 +-- .../specialheaders/repeatability/_client.py | 7 ++++++- .../repeatability/_operations/_patch.py | 1 + .../specialheaders/repeatability/_patch.py | 1 + .../repeatability/_utils/model_base.py | 18 +++++++++++------- .../repeatability/_utils/serialization.py | 6 +++++- .../repeatability/aio/_client.py | 7 ++++++- .../repeatability/aio/_operations/_patch.py | 1 + .../specialheaders/repeatability/aio/_patch.py | 1 + .../unbranded/special-words/pyproject.toml | 3 +-- .../special-words/specialwords/_client.py | 7 ++++++- .../special-words/specialwords/_patch.py | 1 + .../specialwords/_utils/model_base.py | 18 +++++++++++------- .../specialwords/_utils/serialization.py | 6 +++++- .../special-words/specialwords/aio/_client.py | 7 ++++++- .../special-words/specialwords/aio/_patch.py | 1 + .../specialwords/aio/operations/_patch.py | 1 + .../extensiblestrings/aio/operations/_patch.py | 1 - .../extensiblestrings/models/_patch.py | 1 - .../extensiblestrings/operations/_patch.py | 1 - .../modelproperties/aio/operations/_patch.py | 1 + .../modelproperties/models/_patch.py | 1 + .../modelproperties/operations/_patch.py | 1 + .../models/aio/operations/_patch.py | 1 + .../specialwords/models/models/_patch.py | 1 + .../specialwords/models/operations/_patch.py | 1 + .../specialwords/operations/_patch.py | 1 + .../specs-documentation/pyproject.toml | 3 +-- .../specs/documentation/_client.py | 7 ++++++- .../specs/documentation/_patch.py | 1 - .../specs/documentation/_utils/model_base.py | 18 +++++++++++------- .../documentation/_utils/serialization.py | 6 +++++- .../specs/documentation/aio/_client.py | 7 ++++++- .../specs/documentation/aio/_patch.py | 1 - .../documentation/aio/operations/_patch.py | 1 - .../specs/documentation/models/_patch.py | 1 - .../specs/documentation/operations/_patch.py | 1 - .../unbranded/streaming-jsonl/pyproject.toml | 3 +-- .../streaming-jsonl/streaming/jsonl/_client.py | 7 ++++++- .../streaming-jsonl/streaming/jsonl/_patch.py | 1 + .../streaming/jsonl/_utils/model_base.py | 18 +++++++++++------- .../streaming/jsonl/_utils/serialization.py | 6 +++++- .../streaming/jsonl/aio/_client.py | 7 ++++++- .../streaming/jsonl/aio/_patch.py | 1 + .../jsonl/basic/aio/operations/_patch.py | 1 + .../streaming/jsonl/basic/models/_patch.py | 1 - .../streaming/jsonl/basic/operations/_patch.py | 1 + .../unbranded/typetest-array/pyproject.toml | 3 +-- .../typetest-array/typetest/array/_client.py | 7 ++++++- .../typetest-array/typetest/array/_patch.py | 1 + .../typetest/array/_utils/model_base.py | 18 +++++++++++------- .../typetest/array/_utils/serialization.py | 6 +++++- .../typetest/array/aio/_client.py | 7 ++++++- .../typetest/array/aio/_patch.py | 1 + .../typetest/array/aio/operations/_patch.py | 1 + .../typetest/array/models/_patch.py | 1 + .../typetest/array/operations/_patch.py | 1 + .../typetest-dictionary/pyproject.toml | 3 +-- .../typetest/dictionary/_client.py | 7 ++++++- .../typetest/dictionary/_patch.py | 1 + .../typetest/dictionary/_utils/model_base.py | 18 +++++++++++------- .../dictionary/_utils/serialization.py | 6 +++++- .../typetest/dictionary/aio/_client.py | 7 ++++++- .../typetest/dictionary/aio/_patch.py | 1 + .../dictionary/aio/operations/_patch.py | 1 + .../typetest/dictionary/models/_patch.py | 1 + .../typetest/dictionary/operations/_patch.py | 1 + .../typetest-discriminatedunion/pyproject.toml | 3 +-- .../typetest/discriminatedunion/_client.py | 7 ++++++- .../typetest/discriminatedunion/_patch.py | 1 - .../discriminatedunion/_utils/model_base.py | 18 +++++++++++------- .../discriminatedunion/_utils/serialization.py | 6 +++++- .../typetest/discriminatedunion/aio/_client.py | 7 ++++++- .../typetest/discriminatedunion/aio/_patch.py | 1 - .../aio/operations/_patch.py | 1 - .../discriminatedunion/models/_patch.py | 1 - .../discriminatedunion/operations/_patch.py | 1 - .../typetest-enum-extensible/pyproject.toml | 3 +-- .../typetest/enum/extensible/_client.py | 7 ++++++- .../typetest/enum/extensible/_patch.py | 1 + .../enum/extensible/_utils/model_base.py | 18 +++++++++++------- .../enum/extensible/_utils/serialization.py | 6 +++++- .../typetest/enum/extensible/aio/_client.py | 7 ++++++- .../typetest/enum/extensible/aio/_patch.py | 1 + .../enum/extensible/aio/operations/_patch.py | 1 + .../typetest/enum/extensible/models/_patch.py | 1 + .../enum/extensible/operations/_patch.py | 1 + .../typetest-enum-fixed/pyproject.toml | 3 +-- .../typetest/enum/fixed/_client.py | 7 ++++++- .../typetest/enum/fixed/_patch.py | 1 + .../typetest/enum/fixed/_utils/model_base.py | 18 +++++++++++------- .../enum/fixed/_utils/serialization.py | 6 +++++- .../typetest/enum/fixed/aio/_client.py | 7 ++++++- .../typetest/enum/fixed/aio/_patch.py | 1 + .../enum/fixed/aio/operations/_patch.py | 1 + .../typetest/enum/fixed/models/_patch.py | 1 + .../typetest/enum/fixed/operations/_patch.py | 1 + .../typetest-model-empty/pyproject.toml | 3 +-- .../typetest/model/empty/_client.py | 7 ++++++- .../typetest/model/empty/_operations/_patch.py | 1 + .../typetest/model/empty/_patch.py | 1 + .../typetest/model/empty/_utils/model_base.py | 18 +++++++++++------- .../model/empty/_utils/serialization.py | 6 +++++- .../typetest/model/empty/aio/_client.py | 7 ++++++- .../model/empty/aio/_operations/_patch.py | 1 + .../typetest/model/empty/aio/_patch.py | 1 + .../typetest/model/empty/models/_patch.py | 1 + .../pyproject.toml | 3 +-- .../model/enumdiscriminator/_client.py | 7 ++++++- .../enumdiscriminator/_operations/_patch.py | 1 + .../typetest/model/enumdiscriminator/_patch.py | 1 + .../enumdiscriminator/_utils/model_base.py | 18 +++++++++++------- .../enumdiscriminator/_utils/serialization.py | 6 +++++- .../model/enumdiscriminator/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 + .../model/enumdiscriminator/aio/_patch.py | 1 + .../model/enumdiscriminator/models/_patch.py | 1 + .../pyproject.toml | 3 +-- .../model/nesteddiscriminator/_client.py | 7 ++++++- .../nesteddiscriminator/_operations/_patch.py | 1 + .../model/nesteddiscriminator/_patch.py | 1 + .../nesteddiscriminator/_utils/model_base.py | 18 +++++++++++------- .../_utils/serialization.py | 6 +++++- .../model/nesteddiscriminator/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 + .../model/nesteddiscriminator/aio/_patch.py | 1 + .../model/nesteddiscriminator/models/_patch.py | 1 + .../pyproject.toml | 3 +-- .../typetest/model/notdiscriminated/_client.py | 7 ++++++- .../notdiscriminated/_operations/_patch.py | 1 + .../typetest/model/notdiscriminated/_patch.py | 1 + .../notdiscriminated/_utils/model_base.py | 18 +++++++++++------- .../notdiscriminated/_utils/serialization.py | 6 +++++- .../model/notdiscriminated/aio/_client.py | 7 ++++++- .../notdiscriminated/aio/_operations/_patch.py | 1 + .../model/notdiscriminated/aio/_patch.py | 1 + .../model/notdiscriminated/models/_patch.py | 1 + .../typetest-model-recursive/pyproject.toml | 3 +-- .../typetest/model/recursive/_client.py | 7 ++++++- .../model/recursive/_operations/_patch.py | 1 + .../typetest/model/recursive/_patch.py | 1 + .../model/recursive/_utils/model_base.py | 18 +++++++++++------- .../model/recursive/_utils/serialization.py | 6 +++++- .../typetest/model/recursive/aio/_client.py | 7 ++++++- .../model/recursive/aio/_operations/_patch.py | 1 + .../typetest/model/recursive/aio/_patch.py | 1 + .../typetest/model/recursive/models/_patch.py | 1 + .../pyproject.toml | 3 +-- .../model/singlediscriminator/_client.py | 7 ++++++- .../singlediscriminator/_operations/_patch.py | 1 + .../model/singlediscriminator/_patch.py | 1 + .../singlediscriminator/_utils/model_base.py | 18 +++++++++++------- .../_utils/serialization.py | 6 +++++- .../model/singlediscriminator/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 + .../model/singlediscriminator/aio/_patch.py | 1 + .../model/singlediscriminator/models/_patch.py | 1 + .../typetest-model-usage/pyproject.toml | 3 +-- .../typetest/model/usage/_client.py | 7 ++++++- .../typetest/model/usage/_operations/_patch.py | 1 + .../typetest/model/usage/_patch.py | 1 + .../typetest/model/usage/_utils/model_base.py | 18 +++++++++++------- .../model/usage/_utils/serialization.py | 6 +++++- .../typetest/model/usage/aio/_client.py | 7 ++++++- .../model/usage/aio/_operations/_patch.py | 1 + .../typetest/model/usage/aio/_patch.py | 1 + .../typetest/model/usage/models/_patch.py | 1 + .../typetest-model-visibility/pyproject.toml | 3 +-- .../typetest/model/visibility/_client.py | 7 ++++++- .../model/visibility/_operations/_patch.py | 1 + .../typetest/model/visibility/_patch.py | 1 + .../model/visibility/_utils/model_base.py | 18 +++++++++++------- .../model/visibility/_utils/serialization.py | 6 +++++- .../typetest/model/visibility/aio/_client.py | 7 ++++++- .../model/visibility/aio/_operations/_patch.py | 1 + .../typetest/model/visibility/aio/_patch.py | 1 + .../typetest/model/visibility/models/_patch.py | 1 + .../pyproject.toml | 3 +-- .../property/additionalproperties/_client.py | 7 ++++++- .../property/additionalproperties/_patch.py | 1 + .../additionalproperties/_utils/model_base.py | 18 +++++++++++------- .../_utils/serialization.py | 6 +++++- .../additionalproperties/aio/_client.py | 7 ++++++- .../additionalproperties/aio/_patch.py | 1 + .../aio/operations/_patch.py | 1 + .../additionalproperties/models/_patch.py | 1 + .../additionalproperties/operations/_patch.py | 1 + .../typetest-property-nullable/pyproject.toml | 3 +-- .../typetest/property/nullable/_client.py | 7 ++++++- .../typetest/property/nullable/_patch.py | 1 + .../property/nullable/_utils/model_base.py | 18 +++++++++++------- .../property/nullable/_utils/serialization.py | 6 +++++- .../typetest/property/nullable/aio/_client.py | 7 ++++++- .../typetest/property/nullable/aio/_patch.py | 1 + .../property/nullable/aio/operations/_patch.py | 1 + .../property/nullable/models/_patch.py | 1 + .../property/nullable/operations/_patch.py | 1 + .../typetest-property-optional/pyproject.toml | 3 +-- .../typetest/property/optional/_client.py | 7 ++++++- .../typetest/property/optional/_patch.py | 1 + .../property/optional/_utils/model_base.py | 18 +++++++++++------- .../property/optional/_utils/serialization.py | 6 +++++- .../typetest/property/optional/aio/_client.py | 7 ++++++- .../typetest/property/optional/aio/_patch.py | 1 + .../property/optional/aio/operations/_patch.py | 1 + .../property/optional/models/_patch.py | 1 + .../property/optional/operations/_patch.py | 1 + .../pyproject.toml | 3 +-- .../typetest/property/valuetypes/_client.py | 7 ++++++- .../typetest/property/valuetypes/_patch.py | 1 + .../property/valuetypes/_utils/model_base.py | 18 +++++++++++------- .../valuetypes/_utils/serialization.py | 6 +++++- .../property/valuetypes/aio/_client.py | 7 ++++++- .../typetest/property/valuetypes/aio/_patch.py | 1 + .../valuetypes/aio/operations/_patch.py | 1 + .../property/valuetypes/models/_patch.py | 1 + .../property/valuetypes/operations/_patch.py | 1 + .../unbranded/typetest-scalar/pyproject.toml | 3 +-- .../typetest-scalar/typetest/scalar/_client.py | 7 ++++++- .../typetest-scalar/typetest/scalar/_patch.py | 1 + .../typetest/scalar/_utils/model_base.py | 18 +++++++++++------- .../typetest/scalar/_utils/serialization.py | 6 +++++- .../typetest/scalar/aio/_client.py | 7 ++++++- .../typetest/scalar/aio/_patch.py | 1 + .../typetest/scalar/aio/operations/_patch.py | 1 + .../typetest/scalar/operations/_patch.py | 1 + .../unbranded/typetest-union/pyproject.toml | 3 +-- .../typetest-union/typetest/union/_client.py | 7 ++++++- .../typetest-union/typetest/union/_patch.py | 1 + .../typetest/union/_utils/model_base.py | 18 +++++++++++------- .../typetest/union/_utils/serialization.py | 6 +++++- .../typetest/union/aio/_client.py | 7 ++++++- .../typetest/union/aio/_patch.py | 1 + .../typetest/union/aio/operations/_patch.py | 1 + .../typetest/union/models/_patch.py | 1 + .../typetest/union/operations/_patch.py | 1 + .../unbranded/versioning-added/pyproject.toml | 3 +-- .../versioning/added/_client.py | 7 ++++++- .../versioning/added/_patch.py | 1 + .../versioning/added/_utils/model_base.py | 18 +++++++++++------- .../versioning/added/_utils/serialization.py | 6 +++++- .../versioning/added/aio/_client.py | 7 ++++++- .../versioning/added/aio/_patch.py | 1 + .../versioning/added/aio/operations/_patch.py | 1 + .../versioning/added/models/_patch.py | 1 + .../versioning/added/operations/_patch.py | 1 + .../versioning-madeoptional/pyproject.toml | 3 +-- .../versioning/madeoptional/_client.py | 7 ++++++- .../madeoptional/_operations/_patch.py | 1 + .../versioning/madeoptional/_patch.py | 1 + .../madeoptional/_utils/model_base.py | 18 +++++++++++------- .../madeoptional/_utils/serialization.py | 6 +++++- .../versioning/madeoptional/aio/_client.py | 7 ++++++- .../madeoptional/aio/_operations/_patch.py | 1 + .../versioning/madeoptional/aio/_patch.py | 1 + .../versioning/madeoptional/models/_patch.py | 1 + .../versioning-removed/pyproject.toml | 3 +-- .../versioning/removed/_client.py | 7 ++++++- .../versioning/removed/_operations/_patch.py | 1 + .../versioning/removed/_patch.py | 1 + .../versioning/removed/_utils/model_base.py | 18 +++++++++++------- .../versioning/removed/_utils/serialization.py | 6 +++++- .../versioning/removed/aio/_client.py | 7 ++++++- .../removed/aio/_operations/_patch.py | 1 + .../versioning/removed/aio/_patch.py | 1 + .../versioning/removed/models/_patch.py | 1 + .../versioning-renamedfrom/pyproject.toml | 3 +-- .../versioning/renamedfrom/_client.py | 7 ++++++- .../versioning/renamedfrom/_patch.py | 1 + .../renamedfrom/_utils/model_base.py | 18 +++++++++++------- .../renamedfrom/_utils/serialization.py | 6 +++++- .../versioning/renamedfrom/aio/_client.py | 7 ++++++- .../versioning/renamedfrom/aio/_patch.py | 1 + .../renamedfrom/aio/operations/_patch.py | 1 + .../versioning/renamedfrom/models/_patch.py | 1 + .../renamedfrom/operations/_patch.py | 1 + .../pyproject.toml | 3 +-- .../returntypechangedfrom/_client.py | 7 ++++++- .../_operations/_patch.py | 1 + .../versioning/returntypechangedfrom/_patch.py | 1 + .../returntypechangedfrom/_utils/model_base.py | 18 +++++++++++------- .../_utils/serialization.py | 6 +++++- .../returntypechangedfrom/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 + .../returntypechangedfrom/aio/_patch.py | 1 + .../returntypechangedfrom/models/_patch.py | 1 + .../versioning-typechangedfrom/pyproject.toml | 3 +-- .../versioning/typechangedfrom/_client.py | 7 ++++++- .../typechangedfrom/_operations/_patch.py | 1 + .../versioning/typechangedfrom/_patch.py | 1 + .../typechangedfrom/_utils/model_base.py | 18 +++++++++++------- .../typechangedfrom/_utils/serialization.py | 6 +++++- .../versioning/typechangedfrom/aio/_client.py | 7 ++++++- .../typechangedfrom/aio/_operations/_patch.py | 1 + .../versioning/typechangedfrom/aio/_patch.py | 1 + .../typechangedfrom/models/_patch.py | 1 + 1968 files changed, 6117 insertions(+), 2418 deletions(-) diff --git a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_client.py b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_client.py index b41d3a4770..51b5ff1bd4 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_client.py +++ b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._operations import _ApiKeyClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ApiKeyClient(_ApiKeyClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with ApiKey authentication. diff --git a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_operations/_patch.py index fc4fac79b3..8391c35e9d 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List from ._operations import _ApiKeyClientOperationsMixin as Generated diff --git a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/aio/_client.py b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/aio/_client.py index 496661c0e0..7636f8574f 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._configuration import ApiKeyClientConfiguration from ._operations import _ApiKeyClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ApiKeyClient(_ApiKeyClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with ApiKey authentication. diff --git a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/aio/_operations/_patch.py index fc4fac79b3..8391c35e9d 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List from ._operations import _ApiKeyClientOperationsMixin as Generated diff --git a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/aio/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/models/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-api-key/pyproject.toml b/packages/typespec-python/tests/generated/azure/authentication-api-key/pyproject.toml index b9892fa24d..a72c01ac20 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-api-key/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/authentication-api-key/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_client.py b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_client.py index 0b94f5629d..c6bb8d6014 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_client.py +++ b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._operations import _CustomClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class CustomClient(_CustomClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with generic HTTP auth. diff --git a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/aio/_client.py b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/aio/_client.py index c845aab2e1..9d00d20c3d 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._configuration import CustomClientConfiguration from ._operations import _CustomClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class CustomClient(_CustomClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with generic HTTP auth. diff --git a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/aio/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/models/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-http-custom/pyproject.toml b/packages/typespec-python/tests/generated/azure/authentication-http-custom/pyproject.toml index 04a9c177f1..3742750738 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-http-custom/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/authentication-http-custom/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_client.py b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_client.py index 7dd81d3d03..74dad94331 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_client.py +++ b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _UnionClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_client.py b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_client.py index 57283c6553..cd1e18605f 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import UnionClientConfiguration from ._operations import _UnionClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/pyproject.toml b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/pyproject.toml index 1103980789..06298f5944 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_client.py b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_client.py index 0942dadeb8..6909af7c63 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_client.py +++ b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, TYPE_CHECKING -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _OAuth2ClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/aio/_client.py b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/aio/_client.py index 395cc216bc..5a641a54df 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import OAuth2ClientConfiguration from ._operations import _OAuth2ClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/aio/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/models/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-oauth2/pyproject.toml b/packages/typespec-python/tests/generated/azure/authentication-oauth2/pyproject.toml index 98e794779c..475e43b540 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-oauth2/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/authentication-oauth2/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_client.py b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_client.py index 667dadb9ad..d885b938a6 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_client.py +++ b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, TYPE_CHECKING, Union -from typing_extensions import Self from azure.core import PipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._operations import _UnionClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/aio/_client.py b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/aio/_client.py index 7bcbfc2c01..5b6e205f2a 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, TYPE_CHECKING, Union -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._configuration import UnionClientConfiguration from ._operations import _UnionClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/aio/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-union/pyproject.toml b/packages/typespec-python/tests/generated/azure/authentication-union/pyproject.toml index c47183cf0c..3be63bda88 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-union/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/authentication-union/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/pyproject.toml index 5d21837a14..a99e4bd807 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_client.py index d9c94e451c..8c15eb79f8 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -23,6 +23,11 @@ SharedModelInOperationOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AccessClient: # pylint: disable=client-accepts-api-version-keyword """Test for internal decorator. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/_client.py index e731ef7b56..444dc14a78 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -23,6 +23,11 @@ SharedModelInOperationOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AccessClient: # pylint: disable=client-accepts-api-version-keyword """Test for internal decorator. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/pyproject.toml index 252eb46ea8..f2ab7b5fb6 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_client.py index 5f6f4f3a36..6b510a7d95 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ExternalTypeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AlternateTypeClient: # pylint: disable=client-accepts-api-version-keyword """Test for alternate type decorator. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_utils/model_base.py index 6194c9d9d7..7c4f47a2bc 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_utils/model_base.py @@ -23,15 +23,20 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.serialization import TypeHandlerRegistry from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -609,11 +614,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1127,7 +1128,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/_client.py index 700583712c..31100c62a5 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AlternateTypeClientConfiguration from .operations import ExternalTypeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AlternateTypeClient: # pylint: disable=client-accepts-api-version-keyword """Test for alternate type decorator. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/models/_patch.py index fa513da4c0..565fc9249b 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import Type import geojson from .._utils.model_base import TYPE_HANDLER_REGISTRY diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_client.py index 5caa918fa5..0b8eb2bb56 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _HeaderClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class HeaderClient(_HeaderClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """HeaderClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_client.py index 74d0e35037..e14b19a93e 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import HeaderClientConfiguration from ._operations import _HeaderClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class HeaderClient(_HeaderClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """HeaderClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/pyproject.toml index 318f81bea4..f19913acee 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_client.py index f3dc482bcd..f751106a19 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _PathClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PathClient(_PathClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """PathClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_client.py index eb223856d4..8c42ac8c9a 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import PathClientConfiguration from ._operations import _PathClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PathClient(_PathClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """PathClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/pyproject.toml index 333f74df67..221880bd2b 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_client.py index 75edccdf7e..6db2a2d061 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _QueryClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class QueryClient(_QueryClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """QueryClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_client.py index 9805772f70..2572947577 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import QueryClientConfiguration from ._operations import _QueryClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class QueryClient(_QueryClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """QueryClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/pyproject.toml index 7b220604eb..a6e0f7c92a 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/generated_tests/test_default_value.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/generated_tests/test_default_value.py index 24fcaa570b..4ac0cdce6d 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/generated_tests/test_default_value.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/generated_tests/test_default_value.py @@ -17,7 +17,7 @@ class TestDefaultValue(ClientDefaultValueClientTestBase): def test_put_model_property(self, defaultvalue_endpoint): client = self.create_client(endpoint=defaultvalue_endpoint) response = client.put_model_property( - body={"name": "str", "retry": bool, "tier": "str", "timeout": 0}, + body={"name": "str", "retry": True, "tier": "standard", "timeout": 30}, ) # please add some check logic here by yourself diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/generated_tests/test_default_value_async.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/generated_tests/test_default_value_async.py index 05cd22175b..a5df13d3c0 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/generated_tests/test_default_value_async.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/generated_tests/test_default_value_async.py @@ -18,7 +18,7 @@ class TestDefaultValueAsync(ClientDefaultValueClientTestBaseAsync): async def test_put_model_property(self, defaultvalue_endpoint): client = self.create_async_client(endpoint=defaultvalue_endpoint) response = await client.put_model_property( - body={"name": "str", "retry": bool, "tier": "str", "timeout": 0}, + body={"name": "str", "retry": True, "tier": "standard", "timeout": 30}, ) # please add some check logic here by yourself diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/pyproject.toml index d62d885cba..996faf4e29 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_client.py index 673e3c5ca6..50670f5376 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _ClientDefaultValueClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClientDefaultValueClient( _ClientDefaultValueClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_client.py index 2a0b89be46..10070f04b7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ClientDefaultValueClientConfiguration from ._operations import _ClientDefaultValueClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClientDefaultValueClient( _ClientDefaultValueClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/models/_models.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/models/_models.py index 12cde99664..9d099f255a 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/models/_models.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/models/_models.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- # pylint: disable=useless-super-delegation -from typing import Any, Mapping, Optional, overload +from typing import Any, Mapping, overload from .._utils.model_base import Model as _Model, rest_field @@ -27,11 +27,11 @@ class ModelWithDefaultValues(_Model): name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Name property with no default value. Required.""" - timeout: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + timeout: int = rest_field(visibility=["read", "create", "update", "delete", "query"], default=30) """Timeout property with client default value of 30.""" - tier: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + tier: str = rest_field(visibility=["read", "create", "update", "delete", "query"], default="standard") """Tier property with client default value of 'standard'.""" - retry: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + retry: bool = rest_field(visibility=["read", "create", "update", "delete", "query"], default=True) """Retry property with client default value of true.""" @overload @@ -39,9 +39,9 @@ def __init__( self, *, name: str, - timeout: Optional[int] = None, - tier: Optional[str] = None, - retry: Optional[bool] = None, + timeout: int = 30, + tier: str = "standard", + retry: bool = True, ) -> None: ... @overload diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/pyproject.toml index 42cac9e54e..928f1dfc35 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_client.py index 1b3753644b..87b89320e0 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -32,6 +32,11 @@ ) from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class HeaderParamClient(_HeaderParamClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Client for testing header parameter moved to client level. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_client.py index 17672ef52d..ce89275346 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -32,6 +32,11 @@ _QueryParamClientOperationsMixin, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class HeaderParamClient(_HeaderParamClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Client for testing header parameter moved to client level. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/pyproject.toml index 1f3865ebfc..4bb4f48659 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_client.py index 4ba5024baf..58d4c595f8 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -32,6 +32,11 @@ ) from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class IndividuallyNestedWithPathClient( _IndividuallyNestedWithPathClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_client.py index 6e14353cef..c9e7e2638d 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -32,6 +32,11 @@ _IndividuallyNestedWithQueryClientOperationsMixin, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class IndividuallyNestedWithPathClient( _IndividuallyNestedWithPathClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/pyproject.toml index fd345840a7..7b9b2f6c5c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_client.py index 421a939dd5..1e3a311a75 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_client.py @@ -8,8 +8,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -26,6 +26,11 @@ IndividuallyParentNestedWithQueryClientOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class IndividuallyParentClient: # pylint: disable=client-accepts-api-version-keyword """Test for client initialization decorator - moving parameters from method to client level. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/_client.py index 0dcd88c302..27579294dd 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/_client.py @@ -8,8 +8,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -26,6 +26,11 @@ IndividuallyParentNestedWithQueryClientOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class IndividuallyParentClient: # pylint: disable=client-accepts-api-version-keyword """Test for client initialization decorator - moving parameters from method to client level. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/pyproject.toml index b090a2a871..3eaa21601f 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_client.py index 4cc1f63ca7..52bb510b18 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import BlobOperationsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MoveMethodParameterToClient: # pylint: disable=client-accepts-api-version-keyword """Test for @clientLocation decorator - moving operations between clients. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/_client.py index c66717949c..45a88c1283 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import MoveMethodParameterToClientConfiguration from .operations import BlobOperationsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MoveMethodParameterToClient: # pylint: disable=client-accepts-api-version-keyword """Test for @clientLocation decorator - moving operations between clients. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/pyproject.toml index a29f4add1e..e316f06820 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_client.py index fa5125e977..42f4e4e671 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import AdminOperationsOperations, UserOperationsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MoveToExistingSubClient: # pylint: disable=client-accepts-api-version-keyword """Test for @clientLocation decorator - moving operations between clients. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/_client.py index 57c994423a..4722370609 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import MoveToExistingSubClientConfiguration from .operations import AdminOperationsOperations, UserOperationsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MoveToExistingSubClient: # pylint: disable=client-accepts-api-version-keyword """Test for @clientLocation decorator - moving operations between clients. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/pyproject.toml index b49bc2db19..a798b23e00 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_client.py index 22b5fd7dfa..010560027a 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ArchiveOperationsOperations, ProductOperationsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MoveToNewSubClient: # pylint: disable=client-accepts-api-version-keyword """Test for @clientLocation decorator - moving operations between clients. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/_client.py index e9bab050e7..0ba7ef78d4 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import MoveToNewSubClientConfiguration from .operations import ArchiveOperationsOperations, ProductOperationsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MoveToNewSubClient: # pylint: disable=client-accepts-api-version-keyword """Test for @clientLocation decorator - moving operations between clients. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/pyproject.toml index b950a801b2..7cd0046e51 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_client.py index abbf51cf09..3820705a37 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ResourceOperationsOperations, _MoveToRootClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MoveToRootClient(_MoveToRootClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for @clientLocation decorator - moving operations between clients. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/_client.py index 8ea90e4529..5e81765701 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import MoveToRootClientConfiguration from .operations import ResourceOperationsOperations, _MoveToRootClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MoveToRootClient(_MoveToRootClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for @clientLocation decorator - moving operations between clients. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/pyproject.toml index 3a049f9bd0..da28d960f2 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_client.py index d9f4721175..c55b59704a 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _DeserializeEmptyStringAsNullClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DeserializeEmptyStringAsNullClient( _DeserializeEmptyStringAsNullClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_client.py index 4666d7b8f6..bfc9e55d41 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import DeserializeEmptyStringAsNullClientConfiguration from ._operations import _DeserializeEmptyStringAsNullClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DeserializeEmptyStringAsNullClient( _DeserializeEmptyStringAsNullClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/pyproject.toml index f19206769b..21ed005cea 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_client.py index 2867c8db44..ce9924a5ad 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _FlattenPropertyClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class FlattenPropertyClient( _FlattenPropertyClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_client.py index b079e85212..315ab191ec 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import FlattenPropertyClientConfiguration from ._operations import _FlattenPropertyClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class FlattenPropertyClient( _FlattenPropertyClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/pyproject.toml index 96c5111bf5..fa26588422 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_client.py index 2fbc7d670d..9a7cecd40b 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import AnimalOperationsOperations, DogOperationsOperations, PetOperationsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class HierarchyBuildingClient: # pylint: disable=client-accepts-api-version-keyword """Test for @hierarchyBuilding decorator. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/_client.py index ffce83178a..a757d657af 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import HierarchyBuildingClientConfiguration from .operations import AnimalOperationsOperations, DogOperationsOperations, PetOperationsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class HierarchyBuildingClient: # pylint: disable=client-accepts-api-version-keyword """Test for @hierarchyBuilding decorator. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/pyproject.toml index 80b8d412a7..1881e057f9 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_client.py index 97d21cfd1d..94e0341ce9 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _NextLinkVerbClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NextLinkVerbClient(_NextLinkVerbClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for @nextLinkVerb decorator. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_client.py index c006d1c204..e0cd6d4e88 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import NextLinkVerbClientConfiguration from ._operations import _NextLinkVerbClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NextLinkVerbClient(_NextLinkVerbClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for @nextLinkVerb decorator. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/pyproject.toml index 39123d6942..a4d03b4350 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_client.py index 18f33dea2f..541f37bf59 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -23,6 +23,11 @@ RequireOptionalParameterOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class OverrideClient: # pylint: disable=client-accepts-api-version-keyword """Test scenarios for client override behavior. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/_client.py index f5f9bd68d9..b88438e69c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -23,6 +23,11 @@ RequireOptionalParameterOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class OverrideClient: # pylint: disable=client-accepts-api-version-keyword """Test scenarios for client override behavior. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/pyproject.toml index d2a6f3cf34..14a791298b 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_client.py index e46fc7d382..f196d51a21 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ModelInOperationOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class UsageClient: # pylint: disable=client-accepts-api-version-keyword """Test for internal decorator. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/_client.py index e613aa05e5..c6eaeceec6 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import UsageClientConfiguration from .operations import ModelInOperationOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class UsageClient: # pylint: disable=client-accepts-api-version-keyword """Test for internal decorator. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-basic/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-core-basic/pyproject.toml index edf9ef0a27..1a5a30200e 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-basic/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-core-basic/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_client.py index 8a8296eab8..5c0758e300 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _BasicClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BasicClient(_BasicClientOperationsMixin): """Illustrates bodies templated with Azure Core. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_client.py index d1ffea1fa3..364133474c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import BasicClientConfiguration from ._operations import _BasicClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BasicClient(_BasicClientOperationsMixin): """Illustrates bodies templated with Azure Core. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/pyproject.toml index 93e7c030dd..6509f7ea17 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_client.py index acd49a788b..1fea1d4c37 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _RpcClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RpcClient(_RpcClientOperationsMixin): """Illustrates bodies templated with Azure Core with long-running RPC operation. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_client.py index f5895bce2f..413f9852e8 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import RpcClientConfiguration from ._operations import _RpcClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RpcClient(_RpcClientOperationsMixin): """Illustrates bodies templated with Azure Core with long-running RPC operation. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/pyproject.toml index bc052fce86..d162f8adae 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_client.py index da4c813fbb..50e4be9164 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _StandardClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class StandardClient(_StandardClientOperationsMixin): """Illustrates bodies templated with Azure Core with long-running operation. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_client.py index 79c0a0a27a..8a73c913d6 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import StandardClientConfiguration from ._operations import _StandardClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class StandardClient(_StandardClientOperationsMixin): """Illustrates bodies templated with Azure Core with long-running operation. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-model/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-core-model/pyproject.toml index 9df914dbc7..a950035949 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-model/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-core-model/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_client.py index e058323504..9ab1ea009e 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import AzureCoreEmbeddingVectorOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ModelClient: # pylint: disable=client-accepts-api-version-keyword """ModelClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/aio/_client.py index 13c47c2bae..8808cd3a91 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ModelClientConfiguration from .operations import AzureCoreEmbeddingVectorOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ModelClient: # pylint: disable=client-accepts-api-version-keyword """ModelClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-page/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-core-page/pyproject.toml index 9bd6508bda..4bb188a865 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-page/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-core-page/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_client.py index 03abd3d712..31748e2813 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import TwoModelsAsPageItemOperations, _PageClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PageClient(_PageClientOperationsMixin): """Illustrates bodies templated with Azure Core with paging support. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/aio/_client.py index 131fcb2fbb..57eacf2f19 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import PageClientConfiguration from .operations import TwoModelsAsPageItemOperations, _PageClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PageClient(_PageClientOperationsMixin): """Illustrates bodies templated with Azure Core with paging support. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-scalar/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-core-scalar/pyproject.toml index b49d85d9c3..341e0f56ba 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-scalar/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-core-scalar/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_client.py index ce90cf2486..c83ac35762 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import AzureLocationScalarOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ScalarClient: # pylint: disable=client-accepts-api-version-keyword """ScalarClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/_client.py index 069a26f68e..29f23dcdfd 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ScalarClientConfiguration from .operations import AzureLocationScalarOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ScalarClient: # pylint: disable=client-accepts-api-version-keyword """ScalarClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-traits/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-core-traits/pyproject.toml index 0db824d41f..8459f62747 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-traits/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-core-traits/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_client.py index e28b69d8b3..ff42f56fd2 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _TraitsClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class TraitsClient(_TraitsClientOperationsMixin): """Illustrates Azure Core operation customizations by traits. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_client.py index 8b2ec0a028..c7e6b716bd 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import TraitsClientConfiguration from ._operations import _TraitsClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class TraitsClient(_TraitsClientOperationsMixin): """Illustrates Azure Core operation customizations by traits. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-encode-duration/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-encode-duration/pyproject.toml index f059244eeb..c316bf2202 100644 --- a/packages/typespec-python/tests/generated/azure/azure-encode-duration/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-encode-duration/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_client.py b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_client.py index ce4ff9e4bc..339fd345f8 100644 --- a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _DurationClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DurationClient(_DurationClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for azure related encode decorator. diff --git a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_patch.py b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_client.py index 9c467dae99..05fd61b3fb 100644 --- a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import DurationClientConfiguration from ._operations import _DurationClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DurationClient(_DurationClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for azure related encode decorator. diff --git a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-example-basic/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-example-basic/pyproject.toml index eb2b606a5d..f970b43820 100644 --- a/packages/typespec-python/tests/generated/azure/azure-example-basic/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-example-basic/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_client.py b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_client.py index 0f387711f3..14946c3f4f 100644 --- a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _AzureExampleClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AzureExampleClient(_AzureExampleClientOperationsMixin): """AzureExampleClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_patch.py b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_client.py index e4bbd107c9..b52d48a07a 100644 --- a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AzureExampleClientConfiguration from ._operations import _AzureExampleClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AzureExampleClient(_AzureExampleClientOperationsMixin): """AzureExampleClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/pyproject.toml index afa3fe5b80..6cf64f058b 100644 --- a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_client.py b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_client.py index 865cb7678f..cc8c7a7fab 100644 --- a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _PageableClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PageableClient(_PageableClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test describing pageable. diff --git a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_patch.py b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_client.py index 9f5a244bf9..4bdde44736 100644 --- a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import PageableClientConfiguration from ._operations import _PageableClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PageableClient(_PageableClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test describing pageable. diff --git a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_client.py index d94ad53fa8..9d8330cf43 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ErrorOperations, ManagedIdentityOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/_client.py index 874b07e3b4..63514b9dde 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import CommonPropertiesClientConfiguration from .operations import ErrorOperations, ManagedIdentityOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/pyproject.toml index c35ccd4b81..a90f3d2bfc 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_client.py index 3f57f6f570..c308527f7b 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import LargeHeadersOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/_client.py index 45898de9c6..8f7f02dc2c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import LargeHeaderClientConfiguration from .operations import LargeHeadersOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/pyproject.toml index af78f6186d..2a30ee51ba 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_client.py index 2f41e9c1b9..be5c62e445 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import MixedSubscriptionPlacementOperations, Operations, TwoSubscriptionResourcesMethodLevelOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/_client.py index 318dd0f622..5497860897 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import MethodSubscriptionIdClientConfiguration from .operations import MixedSubscriptionPlacementOperations, Operations, TwoSubscriptionResourcesMethodLevelOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/pyproject.toml index 1cf5c18087..cd973c646b 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_client.py index 88ac2876a0..0465e91351 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import StorageAccountsOperations, VirtualMachinesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/_client.py index 0cc8870c56..a8963d141f 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import CombinedClientConfiguration from .operations import StorageAccountsOperations, VirtualMachinesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/pyproject.toml index dc468d8646..270dddee34 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_client.py index 20e90e9288..2af1ff380a 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DisksOperations, VirtualMachinesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/_client.py index 4c4c40bd0e..7638e2ed52 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import CombinedClientConfiguration from .operations import DisksOperations, VirtualMachinesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/pyproject.toml index 2c6a014564..286dc45868 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_client.py index ac9f3eeb8f..22d7ed2f69 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import NonResourceOperationsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/_client.py index f4fb00f244..b3169a6260 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import NonResourceClientConfiguration from .operations import NonResourceOperationsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/pyproject.toml index e9d471588b..20d31b7916 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_client.py index f8b48e18c7..108d69cc24 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -27,6 +27,11 @@ OptionalBodyOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/_client.py index cdc53e0b3e..0a56e693eb 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -27,6 +27,11 @@ OptionalBodyOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/pyproject.toml index 82d73c80b6..4aad24d530 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_client.py index 689b326c98..9e4eda8bf0 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -27,6 +27,11 @@ TopLevelOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/_client.py index 69a7ff1e2e..beb94eaaff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -27,6 +27,11 @@ TopLevelOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/pyproject.toml index 81661bc317..726d227e2e 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_client.py b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_client.py index d74870945e..20901c47c2 100644 --- a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _XmsClientRequestIdClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class XmsClientRequestIdClient( _XmsClientRequestIdClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_patch.py b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_client.py index 7cbb568665..17e34f0c49 100644 --- a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import XmsClientRequestIdClientConfiguration from ._operations import _XmsClientRequestIdClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class XmsClientRequestIdClient( _XmsClientRequestIdClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/pyproject.toml index 873360a4b8..9748c4d8ef 100644 --- a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/pyproject.toml index 2e9fea0c54..e72ff6a536 100644 --- a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_client.py b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_client.py index 333d49a72f..c0a3c46caa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _PreviewVersionClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PreviewVersionClient(_PreviewVersionClientOperationsMixin): """PreviewVersionClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_patch.py b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_client.py index 2f1f888be1..af120d7c51 100644 --- a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import PreviewVersionClientConfiguration from ._operations import _PreviewVersionClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PreviewVersionClient(_PreviewVersionClientOperationsMixin): """PreviewVersionClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_client.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_client.py index 4c2a2d79eb..f0770ee915 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _ClientNamespaceFirstClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClientNamespaceFirstClient( _ClientNamespaceFirstClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_patch.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/aio/_client.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/aio/_client.py index 150ce47a09..e259dd19d8 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ClientNamespaceFirstClientConfiguration from ._operations import _ClientNamespaceFirstClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClientNamespaceFirstClient( _ClientNamespaceFirstClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/aio/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/aio/_patch.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/first/models/_patch.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/first/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/first/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/first/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_client.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_client.py index 521fd3c81f..ee29eb2855 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ClientNamespaceSecondClientConfiguration from ._operations import _ClientNamespaceSecondClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClientNamespaceSecondClient( _ClientNamespaceSecondClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_patch.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/aio/_client.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/aio/_client.py index da23574ad5..0c1f4ec21f 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ClientNamespaceSecondClientConfiguration from ._operations import _ClientNamespaceSecondClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClientNamespaceSecondClient( _ClientNamespaceSecondClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/aio/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/aio/_patch.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/models/_patch.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/sub/models/_patch.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/sub/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/sub/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/sub/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/pyproject.toml b/packages/typespec-python/tests/generated/azure/client-namespace/pyproject.toml index a508068857..c1392c7555 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/client-namespace/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_client.py b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_client.py index fc921cfc2d..795db6ba14 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import FirstOperationsOperations, SecondOperationsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class EnumConflictClient: # pylint: disable=client-accepts-api-version-keyword """Test for enum with same name in different namespace. diff --git a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_patch.py b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/_client.py b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/_client.py index 715c2a0120..231a85d6bf 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import EnumConflictClientConfiguration from .operations import FirstOperationsOperations, SecondOperationsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class EnumConflictClient: # pylint: disable=client-accepts-api-version-keyword """Test for enum with same name in different namespace. diff --git a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/_patch.py b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/firstnamespace/models/_patch.py b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/firstnamespace/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/firstnamespace/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/firstnamespace/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/secondnamespace/models/_patch.py b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/secondnamespace/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/secondnamespace/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/secondnamespace/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/pyproject.toml b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/pyproject.toml index 62c8feb9c3..28e8995c6b 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_client.py b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_client.py index 398e6aed35..6d58dcc21d 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -24,6 +24,11 @@ _NamingClientOperationsMixin, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NamingClient(_NamingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Describe changing names of types in a client with ``@clientName``. diff --git a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_patch.py b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/aio/_client.py b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/aio/_client.py index 99eb52a012..4fd88fa786 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -24,6 +24,11 @@ _NamingClientOperationsMixin, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NamingClient(_NamingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Describe changing names of types in a client with ``@clientName``. diff --git a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/aio/_patch.py b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/models/_patch.py b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-naming/pyproject.toml b/packages/typespec-python/tests/generated/azure/client-naming/pyproject.toml index 4a7f98f5f8..d5aa590866 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/client-naming/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_client.py b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_client.py index 4aa0930219..8e7a2b66d2 100644 --- a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _OverloadClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class OverloadClient(_OverloadClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for overload operation in .NET. diff --git a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_patch.py b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/aio/_client.py b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/aio/_client.py index d66ff6db47..a8a24c0972 100644 --- a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import OverloadClientConfiguration from ._operations import _OverloadClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class OverloadClient(_OverloadClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for overload operation in .NET. diff --git a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/aio/_patch.py b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/models/_patch.py b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-overload/pyproject.toml b/packages/typespec-python/tests/generated/azure/client-overload/pyproject.toml index 8d21e96456..ea1f60dbdc 100644 --- a/packages/typespec-python/tests/generated/azure/client-overload/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/client-overload/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_client.py b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_client.py index aad355f1ae..62471f251a 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Union -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -25,6 +25,11 @@ _SecondClientOperationsMixin, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class FirstClient(_FirstClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """FirstClient. diff --git a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_client.py b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_client.py index 0639d17095..766af80bfb 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Union -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -25,6 +25,11 @@ _SecondClientOperationsMixin, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class FirstClient(_FirstClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """FirstClient. diff --git a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/models/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/pyproject.toml b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/pyproject.toml index d98ae71c66..f4b203cdf3 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_client.py b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_client.py index 81771551b7..50ec83c44a 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Union -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import BarOperations, BazOperations, FooOperations, QuxOperations, _ServiceClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ServiceClient(_ServiceClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test that we can use @client decorators to customize client side code structure, such as: diff --git a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/aio/_client.py b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/aio/_client.py index f839fface2..6f030b714d 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Union -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import ServiceClientConfiguration from .operations import BarOperations, BazOperations, FooOperations, QuxOperations, _ServiceClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ServiceClient(_ServiceClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test that we can use @client decorators to customize client side code structure, such as: diff --git a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/aio/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/models/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-default/pyproject.toml b/packages/typespec-python/tests/generated/azure/client-structure-default/pyproject.toml index 8ee8246ae0..a8a068e338 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-default/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/client-structure-default/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_client.py b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_client.py index 0754cd63c5..d2cbac20a4 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Union -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._operations import _ClientAClientOperationsMixin, _ClientBClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClientAClient(_ClientAClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """ClientAClient. diff --git a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_client.py b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_client.py index c0caa421db..ee7c58995e 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Union -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import ClientAClientConfiguration, ClientBClientConfiguration from ._operations import _ClientAClientOperationsMixin, _ClientBClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClientAClient(_ClientAClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """ClientAClient. diff --git a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/models/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/pyproject.toml b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/pyproject.toml index 6b8d434add..361f3f0b34 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_client.py b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_client.py index e82ad01b4e..91d0344df1 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Union -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import GroupOperations, _RenamedOperationClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RenamedOperationClient( _RenamedOperationClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_client.py b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_client.py index 3b0a7f3ffa..cddbff13bc 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Union -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import RenamedOperationClientConfiguration from .operations import GroupOperations, _RenamedOperationClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RenamedOperationClient( _RenamedOperationClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/models/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/pyproject.toml b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/pyproject.toml index 45ae8884c4..3d164b720e 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_client.py b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_client.py index 70e2eca45c..9e2320a5e7 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Union -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import Group1Operations, Group2Operations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class TwoOperationGroupClient: # pylint: disable=client-accepts-api-version-keyword """TwoOperationGroupClient. diff --git a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_client.py b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_client.py index cc483e5523..265da0355d 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Union -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import TwoOperationGroupClientConfiguration from .operations import Group1Operations, Group2Operations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class TwoOperationGroupClient: # pylint: disable=client-accepts-api-version-keyword """TwoOperationGroupClient. diff --git a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/models/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/pyproject.toml b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/pyproject.toml index 73c94b3b31..0721a0ca11 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_client.py b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_client.py index 67be983dad..05c3bd12a0 100644 --- a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_client.py +++ b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .property.operations import PropertyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ArrayClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on array. diff --git a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_patch.py b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/aio/_client.py b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/aio/_client.py index daefc42540..ff8830c62e 100644 --- a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ..property.aio.operations import PropertyOperations from ._configuration import ArrayClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ArrayClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on array. diff --git a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/aio/_patch.py b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/models/_patch.py b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/property/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/property/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/property/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/property/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/property/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/property/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/property/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/property/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-array/pyproject.toml b/packages/typespec-python/tests/generated/azure/encode-array/pyproject.toml index 7b107ab8aa..657d70b808 100644 --- a/packages/typespec-python/tests/generated/azure/encode-array/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/encode-array/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_client.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_client.py index 804a4e5fb2..d2364c8ae2 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_client.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -22,6 +22,11 @@ from .requestbody.operations import RequestBodyOperations from .responsebody.operations import ResponseBodyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BytesClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on bytes. diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_patch.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/aio/_client.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/aio/_client.py index a5417e1463..14f5004e13 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -22,6 +22,11 @@ from ..responsebody.aio.operations import ResponseBodyOperations from ._configuration import BytesClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BytesClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on bytes. diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/aio/_patch.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/header/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/header/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/header/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/header/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/header/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/header/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/header/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/header/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/models/_patch.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/property/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/property/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/property/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/property/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/property/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/property/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/property/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/property/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/query/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/query/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/query/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/query/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/query/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/query/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/query/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/query/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/requestbody/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/requestbody/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/requestbody/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/requestbody/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/requestbody/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/requestbody/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/requestbody/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/requestbody/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/responsebody/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/responsebody/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/responsebody/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/responsebody/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/responsebody/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/responsebody/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/responsebody/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/responsebody/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/pyproject.toml b/packages/typespec-python/tests/generated/azure/encode-bytes/pyproject.toml index 09a6886fd7..11e758e62a 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_client.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_client.py index 75e498112a..a0c23cfb22 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_client.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -21,6 +21,11 @@ from .query.operations import QueryOperations from .responseheader.operations import ResponseHeaderOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DatetimeClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on datetime. diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_patch.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/aio/_client.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/aio/_client.py index fdc3587ba2..564306e305 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -21,6 +21,11 @@ from ..responseheader.aio.operations import ResponseHeaderOperations from ._configuration import DatetimeClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DatetimeClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on datetime. diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/aio/_patch.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/header/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/header/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/header/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/header/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/header/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/header/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/header/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/header/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/models/_patch.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/property/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/property/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/property/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/property/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/property/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/property/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/property/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/property/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/query/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/query/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/query/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/query/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/query/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/query/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/query/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/query/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/responseheader/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/responseheader/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/responseheader/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/responseheader/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/pyproject.toml b/packages/typespec-python/tests/generated/azure/encode-datetime/pyproject.toml index c57df8896b..b64a64a599 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_client.py b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_client.py index eaa36842d9..d42c017368 100644 --- a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_client.py +++ b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HeaderOperations, PropertyOperations, QueryOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DurationClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on duration. diff --git a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_patch.py b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/aio/_client.py b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/aio/_client.py index f67866d4be..6991ececba 100644 --- a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import DurationClientConfiguration from .operations import HeaderOperations, PropertyOperations, QueryOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DurationClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on duration. diff --git a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/aio/_patch.py b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/models/_patch.py b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-duration/pyproject.toml b/packages/typespec-python/tests/generated/azure/encode-duration/pyproject.toml index 671ea883b0..cfacfacc95 100644 --- a/packages/typespec-python/tests/generated/azure/encode-duration/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/encode-duration/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_client.py b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_client.py index 72bca37699..ad04eed490 100644 --- a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_client.py +++ b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PropertyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NumericClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on integer. diff --git a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_patch.py b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/aio/_client.py b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/aio/_client.py index abe2021768..b1afaeaa44 100644 --- a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import NumericClientConfiguration from .operations import PropertyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NumericClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on integer. diff --git a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/aio/_patch.py b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/models/_patch.py b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-numeric/pyproject.toml b/packages/typespec-python/tests/generated/azure/encode-numeric/pyproject.toml index b69fd548fc..dffe466030 100644 --- a/packages/typespec-python/tests/generated/azure/encode-numeric/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/encode-numeric/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_client.py b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_client.py index a22a131850..3d217450cd 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_client.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _RecursiveClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RecursiveClient(_RecursiveClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates inheritance recursion. diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_patch.py b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_patch.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/aio/_client.py b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/aio/_client.py index 87d2e92a38..da020e78de 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import RecursiveClientConfiguration from ._operations import _RecursiveClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RecursiveClient(_RecursiveClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates inheritance recursion. diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/aio/_patch.py b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/models/_patch.py b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir/pyproject.toml b/packages/typespec-python/tests/generated/azure/generation-subdir/pyproject.toml index 10545f549e..28afd8f809 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/generation-subdir/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_client.py b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_client.py index 2887b6ea13..56c48a8f70 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_client.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import InterfaceV2Operations, _AddedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AddedClient(_AddedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@added`` decorator. diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_patch.py b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_patch.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/aio/_client.py b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/aio/_client.py index 051eb6a46c..72163edc53 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AddedClientConfiguration from .operations import InterfaceV2Operations, _AddedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AddedClient(_AddedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@added`` decorator. diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/aio/_patch.py b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/models/_patch.py b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/operations/_patch.py b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir2/pyproject.toml b/packages/typespec-python/tests/generated/azure/generation-subdir2/pyproject.toml index 75062ec7b7..515ad289d2 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir2/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/generation-subdir2/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_client.py b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_client.py index 183a28836d..f246a0af87 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_client.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _VisibilityClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VisibilityClient(_VisibilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates models with visibility properties. diff --git a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_patch.py b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_patch.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_client.py b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_client.py index 2bd3027bb3..1216228de3 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import VisibilityClientConfiguration from ._operations import _VisibilityClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VisibilityClient(_VisibilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates models with visibility properties. diff --git a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_patch.py b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/models/_patch.py b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/pyproject.toml b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/pyproject.toml index 07b3436f48..18bb93d42e 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_client.py b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_client.py index 183a28836d..f246a0af87 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_client.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _VisibilityClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VisibilityClient(_VisibilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates models with visibility properties. diff --git a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_patch.py b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_patch.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/aio/_client.py b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/aio/_client.py index 2bd3027bb3..1216228de3 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import VisibilityClientConfiguration from ._operations import _VisibilityClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VisibilityClient(_VisibilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates models with visibility properties. diff --git a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/aio/_patch.py b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/models/_patch.py b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/headasbooleantrue/pyproject.toml b/packages/typespec-python/tests/generated/azure/headasbooleantrue/pyproject.toml index b41f5854d1..3191eecc66 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleantrue/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/headasbooleantrue/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_client.py b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_client.py index a7ec55a26d..e84955b834 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_client.py +++ b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ExplicitBodyOperations, ImplicitBodyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BasicClient: # pylint: disable=client-accepts-api-version-keyword """Test for basic parameters cases. diff --git a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/aio/_client.py b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/aio/_client.py index 37dde67925..bbe28545c4 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import BasicClientConfiguration from .operations import ExplicitBodyOperations, ImplicitBodyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BasicClient: # pylint: disable=client-accepts-api-version-keyword """Test for basic parameters cases. diff --git a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/aio/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/models/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-basic/pyproject.toml b/packages/typespec-python/tests/generated/azure/parameters-basic/pyproject.toml index 01d4e56ccd..b7ff6a05b6 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-basic/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/parameters-basic/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_client.py b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_client.py index c7b1bb740a..1ce951bbb4 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_client.py +++ b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .optionalexplicit.operations import OptionalExplicitOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BodyOptionalityClient( _BodyOptionalityClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_client.py b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_client.py index 58b2dac665..e39c8ae570 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import BodyOptionalityClientConfiguration from ._operations import _BodyOptionalityClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BodyOptionalityClient( _BodyOptionalityClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/models/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/pyproject.toml b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/pyproject.toml index dc008d40b7..669bd4bba3 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_client.py b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_client.py index bd0638069d..96700e3782 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_client.py +++ b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from .header.operations import HeaderOperations from .query.operations import QueryOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class CollectionFormatClient: # pylint: disable=client-accepts-api-version-keyword """Test for collectionFormat. diff --git a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/aio/_client.py b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/aio/_client.py index bb984ca39e..943bf289bd 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ..query.aio.operations import QueryOperations from ._configuration import CollectionFormatClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class CollectionFormatClient: # pylint: disable=client-accepts-api-version-keyword """Test for collectionFormat. diff --git a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/aio/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-collection-format/pyproject.toml b/packages/typespec-python/tests/generated/azure/parameters-collection-format/pyproject.toml index 3e22ae85a0..39a03ebd23 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-collection-format/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/parameters-collection-format/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_client.py b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_client.py index 701fad8981..4f22ca98b8 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_client.py +++ b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _PathClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PathClient(_PathClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for path parameters cases. diff --git a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/aio/_client.py b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/aio/_client.py index 0a5b8febb1..a99cee2821 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import PathClientConfiguration from ._operations import _PathClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PathClient(_PathClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for path parameters cases. diff --git a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/aio/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-path/pyproject.toml b/packages/typespec-python/tests/generated/azure/parameters-path/pyproject.toml index e1fda47747..326bc0490f 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-path/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/parameters-path/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_client.py b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_client.py index e5b151a63f..566b689ddd 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_client.py +++ b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ConstantOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class QueryClient: # pylint: disable=client-accepts-api-version-keyword """Test for query parameter cases. diff --git a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/aio/_client.py b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/aio/_client.py index f5dff68396..6508a43f56 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import QueryClientConfiguration from .operations import ConstantOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class QueryClient: # pylint: disable=client-accepts-api-version-keyword """Test for query parameter cases. diff --git a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/aio/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-query/pyproject.toml b/packages/typespec-python/tests/generated/azure/parameters-query/pyproject.toml index 86bc87ae78..7195a5207f 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-query/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/parameters-query/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_client.py b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_client.py index e33cf068f4..5329d59b77 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_client.py +++ b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import AliasOperations, ModelOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SpreadClient: # pylint: disable=client-accepts-api-version-keyword """Test for the spread operator. diff --git a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/aio/_client.py b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/aio/_client.py index 1fe65ba263..e76248fd4b 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import SpreadClientConfiguration from .operations import AliasOperations, ModelOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SpreadClient: # pylint: disable=client-accepts-api-version-keyword """Test for the spread operator. diff --git a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/aio/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/models/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-spread/pyproject.toml b/packages/typespec-python/tests/generated/azure/parameters-spread/pyproject.toml index 136dcdbce8..5d2df804a2 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-spread/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/parameters-spread/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_client.py b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_client.py index 7065690fe7..c819d87b53 100644 --- a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_client.py +++ b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DifferentBodyOperations, SameBodyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ContentNegotiationClient: # pylint: disable=client-accepts-api-version-keyword """Test describing optionality of the request body. diff --git a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_patch.py b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/_client.py b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/_client.py index 5880c31f1a..da6aaf36de 100644 --- a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ContentNegotiationClientConfiguration from .operations import DifferentBodyOperations, SameBodyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ContentNegotiationClient: # pylint: disable=client-accepts-api-version-keyword """Test describing optionality of the request body. diff --git a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/_patch.py b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/models/_patch.py b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/pyproject.toml b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/pyproject.toml index 2846526318..c14da5e477 100644 --- a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_client.py b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_client.py index e975940a8b..9012f9dd61 100644 --- a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_client.py +++ b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _JsonMergePatchClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class JsonMergePatchClient(_JsonMergePatchClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for merge-patch+json content-type. diff --git a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_patch.py b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_client.py b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_client.py index 97340c807f..f57ee7276a 100644 --- a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import JsonMergePatchClientConfiguration from ._operations import _JsonMergePatchClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class JsonMergePatchClient(_JsonMergePatchClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for merge-patch+json content-type. diff --git a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_patch.py b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/models/_patch.py b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/pyproject.toml b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/pyproject.toml index cf2a6588e7..b849a41724 100644 --- a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_client.py b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_client.py index 9caa9feb5b..966e5d8f1b 100644 --- a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_client.py +++ b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .stringbody.operations import StringBodyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MediaTypeClient: # pylint: disable=client-accepts-api-version-keyword """Test the payload with different media types and different types of the payload itself. diff --git a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_patch.py b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/aio/_client.py b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/aio/_client.py index 79c18ef862..659e1a8593 100644 --- a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ..stringbody.aio.operations import StringBodyOperations from ._configuration import MediaTypeClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MediaTypeClient: # pylint: disable=client-accepts-api-version-keyword """Test the payload with different media types and different types of the payload itself. diff --git a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/aio/_patch.py b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/stringbody/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/stringbody/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/stringbody/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/stringbody/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-media-type/pyproject.toml b/packages/typespec-python/tests/generated/azure/payload-media-type/pyproject.toml index 623293a346..269f8a2c96 100644 --- a/packages/typespec-python/tests/generated/azure/payload-media-type/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/payload-media-type/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_client.py b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_client.py index 96dedc4fa3..455583c1b9 100644 --- a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_client.py +++ b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import FormDataOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MultiPartClient: # pylint: disable=client-accepts-api-version-keyword """Test for multipart. diff --git a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_patch.py b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_utils/utils.py b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_utils/utils.py index bd821750f4..707b7d8fac 100644 --- a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_utils/utils.py +++ b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_utils/utils.py @@ -10,7 +10,6 @@ from .._utils.model_base import Model, SdkJSONEncoder - # file-like tuple could be `(filename, IO (or bytes))` or `(filename, IO (or bytes), content_type)` FileContent = Union[str, bytes, IO[str], IO[bytes]] diff --git a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/aio/_client.py b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/aio/_client.py index 2405f08bb7..93d0bffeff 100644 --- a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import MultiPartClientConfiguration from .operations import FormDataOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MultiPartClient: # pylint: disable=client-accepts-api-version-keyword """Test for multipart. diff --git a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/aio/_patch.py b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/models/_patch.py b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-multipart/pyproject.toml b/packages/typespec-python/tests/generated/azure/payload-multipart/pyproject.toml index fdf885caf8..73f2e36899 100644 --- a/packages/typespec-python/tests/generated/azure/payload-multipart/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/payload-multipart/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_client.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_client.py index 20b9cdc7b9..cad55d85fe 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_client.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -20,6 +20,11 @@ from .serverdrivenpagination.operations import ServerDrivenPaginationOperations from .xmlpagination.operations import XmlPaginationOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PageableClient: # pylint: disable=client-accepts-api-version-keyword """Test for pageable payload. diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/aio/_client.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/aio/_client.py index c25cf8b3cc..076ecffd29 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -20,6 +20,11 @@ from ..xmlpagination.aio.operations import XmlPaginationOperations from ._configuration import PageableClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PageableClient: # pylint: disable=client-accepts-api-version-keyword """Test for pageable payload. diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/aio/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/aio/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/models/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/pagesize/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/pagesize/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/pagesize/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/pagesize/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/pagesize/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/pagesize/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/pagesize/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/pagesize/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/models/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/models/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/models/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/xmlpagination/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/xmlpagination/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/xmlpagination/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/xmlpagination/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/xmlpagination/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/xmlpagination/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/xmlpagination/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/xmlpagination/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/pyproject.toml b/packages/typespec-python/tests/generated/azure/payload-pageable/pyproject.toml index 1dfed7d8ec..f24b501875 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_client.py b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_client.py index ace3cc0b6a..d9ebb100fe 100644 --- a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_client.py +++ b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -45,6 +45,11 @@ XmlErrorValueOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class XmlClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Sends and receives bodies in XML format. diff --git a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_patch.py b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_utils/model_base.py index eef4e52ed1..76b48f9a84 100644 --- a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1129,7 +1130,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/aio/_client.py b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/aio/_client.py index f714d4a975..705ef85c90 100644 --- a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -45,6 +45,11 @@ XmlErrorValueOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class XmlClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Sends and receives bodies in XML format. diff --git a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/aio/_patch.py b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/models/_patch.py b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-xml/pyproject.toml b/packages/typespec-python/tests/generated/azure/payload-xml/pyproject.toml index cc316147fe..958fec5292 100644 --- a/packages/typespec-python/tests/generated/azure/payload-xml/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/payload-xml/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/pyproject.toml b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/pyproject.toml index 9c512865c6..c8efc8d12c 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_client.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_client.py index 10de6e65b1..7f88989c62 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_client.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _ResiliencyServiceDrivenClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ResiliencyServiceDrivenClient(_ResiliencyServiceDrivenClientOperationsMixin): """Test that we can grow up a service spec and service deployment into a multi-versioned service diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_patch.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_patch.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_client.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_client.py index 909f9e6e9c..1a77f8e802 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ResiliencyServiceDrivenClientConfiguration from ._operations import _ResiliencyServiceDrivenClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ResiliencyServiceDrivenClient(_ResiliencyServiceDrivenClientOperationsMixin): """Test that we can grow up a service spec and service deployment into a multi-versioned service diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_patch.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/pyproject.toml b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/pyproject.toml index f2483a8818..d35ee8bfa4 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_client.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_client.py index 1e59d598ef..dc593131bc 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_client.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _ResiliencyServiceDrivenClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ResiliencyServiceDrivenClient(_ResiliencyServiceDrivenClientOperationsMixin): """Test that we can grow up a service spec and service deployment into a multi-versioned service diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_patch.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_patch.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_client.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_client.py index 57e53556b8..556d61f5a2 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ResiliencyServiceDrivenClientConfiguration from ._operations import _ResiliencyServiceDrivenClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ResiliencyServiceDrivenClient(_ResiliencyServiceDrivenClientOperationsMixin): """Test that we can grow up a service spec and service deployment into a multi-versioned service diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_patch.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/response-status-code-range/pyproject.toml b/packages/typespec-python/tests/generated/azure/response-status-code-range/pyproject.toml index f4e712b218..4c973278fd 100644 --- a/packages/typespec-python/tests/generated/azure/response-status-code-range/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/response-status-code-range/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_client.py b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_client.py index 274f01d865..62d80271d5 100644 --- a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_client.py +++ b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _StatusCodeRangeClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class StatusCodeRangeClient( _StatusCodeRangeClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_patch.py b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_patch.py +++ b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/aio/_client.py b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/aio/_client.py index 471d0b3f3a..8e51872b53 100644 --- a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import StatusCodeRangeClientConfiguration from ._operations import _StatusCodeRangeClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class StatusCodeRangeClient( _StatusCodeRangeClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/aio/_patch.py b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/models/_patch.py b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/pyproject.toml b/packages/typespec-python/tests/generated/azure/routes/pyproject.toml index e77e758219..d07e7524e0 100644 --- a/packages/typespec-python/tests/generated/azure/routes/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/routes/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/_client.py b/packages/typespec-python/tests/generated/azure/routes/routes/_client.py index ea84f981a1..e24770820c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/_client.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -20,6 +20,11 @@ from .pathparameters.operations import PathParametersOperations from .queryparameters.operations import QueryParametersOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RoutesClient(_RoutesClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Define scenario in building the http route/uri. diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/routes/routes/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/routes/routes/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/aio/_client.py b/packages/typespec-python/tests/generated/azure/routes/routes/aio/_client.py index 7ca64d8eb7..f10aea7d28 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -20,6 +20,11 @@ from ._configuration import RoutesClientConfiguration from .operations import InInterfaceOperations, _RoutesClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RoutesClient(_RoutesClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Define scenario in building the http route/uri. diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/aio/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/reservedexpansion/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/reservedexpansion/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/reservedexpansion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/reservedexpansion/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/pyproject.toml b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/pyproject.toml index 355a45fd14..5b9d45a40f 100644 --- a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_client.py b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_client.py index f64752e55e..308d6eedf9 100644 --- a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_client.py +++ b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PropertyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class JsonClient: # pylint: disable=client-accepts-api-version-keyword """Encoded names. diff --git a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_patch.py b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_patch.py +++ b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/_client.py b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/_client.py index 2501049d66..63e0f71f91 100644 --- a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import JsonClientConfiguration from .operations import PropertyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class JsonClient: # pylint: disable=client-accepts-api-version-keyword """Encoded names. diff --git a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/_patch.py b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/models/_patch.py b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/operations/_patch.py b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/pyproject.toml b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/pyproject.toml index c2ae08dbc9..0cd8a1a721 100644 --- a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_client.py b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_client.py index 5c189762ff..63fa721a75 100644 --- a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_client.py +++ b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _NotDefinedClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NotDefinedClient(_NotDefinedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates server doesn't define endpoint. Client should automatically add an endpoint to let diff --git a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_client.py b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_client.py index a46421e934..17b562b48b 100644 --- a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import NotDefinedClientConfiguration from ._operations import _NotDefinedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NotDefinedClient(_NotDefinedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates server doesn't define endpoint. Client should automatically add an endpoint to let diff --git a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-path-multiple/pyproject.toml b/packages/typespec-python/tests/generated/azure/server-path-multiple/pyproject.toml index f2e5c9eec4..5a72365a56 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-multiple/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/server-path-multiple/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_client.py b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_client.py index dcdf9d6037..ec244d5f85 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_client.py +++ b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _MultipleClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MultipleClient(_MultipleClientOperationsMixin): """MultipleClient. diff --git a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_patch.py b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/aio/_client.py b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/aio/_client.py index 3fcd2b7d47..0e00b3e43b 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import MultipleClientConfiguration from ._operations import _MultipleClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MultipleClient(_MultipleClientOperationsMixin): """MultipleClient. diff --git a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/aio/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/aio/_patch.py b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/models/_patch.py b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-path-single/pyproject.toml b/packages/typespec-python/tests/generated/azure/server-path-single/pyproject.toml index adbba47403..a25c659cde 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-single/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/server-path-single/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_client.py b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_client.py index c3d23264a3..22a3ee6215 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_client.py +++ b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _SingleClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SingleClient(_SingleClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates server with a single path parameter @server. diff --git a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_patch.py b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/aio/_client.py b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/aio/_client.py index a641b5c056..2202147d1b 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import SingleClientConfiguration from ._operations import _SingleClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SingleClient(_SingleClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates server with a single path parameter @server. diff --git a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/aio/_patch.py b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/pyproject.toml b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/pyproject.toml index f88748c8a0..324ba3752c 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_client.py b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_client.py index 33023825a2..70e55acb65 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_client.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _NotVersionedClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NotVersionedClient(_NotVersionedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates not-versioned server. diff --git a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_patch.py b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_client.py b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_client.py index cb7d8cfb99..460135c2b9 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import NotVersionedClientConfiguration from ._operations import _NotVersionedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NotVersionedClient(_NotVersionedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates not-versioned server. diff --git a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_patch.py b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-versions-versioned/pyproject.toml b/packages/typespec-python/tests/generated/azure/server-versions-versioned/pyproject.toml index e11b3fe96d..1a9c37f714 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-versioned/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/server-versions-versioned/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_client.py b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_client.py index fb2758217a..0b51634658 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_client.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _VersionedClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VersionedClient(_VersionedClientOperationsMixin): """Illustrates versioned server. diff --git a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_patch.py b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/aio/_client.py b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/aio/_client.py index 247aa9a0f4..b0af349ce1 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import VersionedClientConfiguration from ._operations import _VersionedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VersionedClient(_VersionedClientOperationsMixin): """Illustrates versioned server. diff --git a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/aio/_patch.py b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/service-multi-service/pyproject.toml b/packages/typespec-python/tests/generated/azure/service-multi-service/pyproject.toml index c3462a8e10..9f19b51445 100644 --- a/packages/typespec-python/tests/generated/azure/service-multi-service/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/service-multi-service/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_client.py b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_client.py index 6dd0d05fca..3949b6c5dd 100644 --- a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_client.py +++ b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import BarOperations, FooOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class CombinedClient: # pylint: disable=client-accepts-api-version-keyword """CombinedClient. diff --git a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_patch.py b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_patch.py +++ b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/aio/_client.py b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/aio/_client.py index 7294b6625b..7bb1cc9c4c 100644 --- a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import CombinedClientConfiguration from .operations import BarOperations, FooOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class CombinedClient: # pylint: disable=client-accepts-api-version-keyword """CombinedClient. diff --git a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/aio/_patch.py b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/models/_patch.py b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/operations/_patch.py b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setup.py b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setup.py index 617246b295..bd6f06f00b 100644 --- a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setup.py +++ b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setup.py @@ -11,7 +11,6 @@ import re from setuptools import setup, find_packages - PACKAGE_NAME = "setuppy-authentication-union" PACKAGE_PPRINT_NAME = "Setuppy Authentication Union" PACKAGE_NAMESPACE = "setuppy.authentication.union" @@ -43,7 +42,6 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", @@ -68,5 +66,5 @@ "azure-core>=1.37.0", "typing-extensions>=4.6.0", ], - python_requires=">=3.9", + python_requires=">=3.10", ) diff --git a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_client.py b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_client.py index 667dadb9ad..d885b938a6 100644 --- a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_client.py +++ b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, TYPE_CHECKING, Union -from typing_extensions import Self from azure.core import PipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._operations import _UnionClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_patch.py b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_patch.py +++ b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_client.py b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_client.py index 7bcbfc2c01..5b6e205f2a 100644 --- a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, TYPE_CHECKING, Union -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._configuration import UnionClientConfiguration from ._operations import _UnionClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_patch.py b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/pyproject.toml b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/pyproject.toml index a0471155a4..d4e8c21dff 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_client.py b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_client.py index 7d6c08d8b9..4191b40b9f 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_client.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _ConditionalRequestClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ConditionalRequestClient( _ConditionalRequestClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_patch.py b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_patch.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_client.py b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_client.py index 6ea0db7a32..05b3561f7d 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ConditionalRequestClientConfiguration from ._operations import _ConditionalRequestClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ConditionalRequestClient( _ConditionalRequestClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_patch.py b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/pyproject.toml b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/pyproject.toml index 15a71cf361..f6fe56670f 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_client.py b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_client.py index 18016f4375..622c9f85b0 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_client.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _RepeatabilityClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RepeatabilityClient(_RepeatabilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates OASIS repeatability headers. diff --git a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_patch.py b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_patch.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_client.py b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_client.py index 45a02c2e57..a94c36e530 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import RepeatabilityClientConfiguration from ._operations import _RepeatabilityClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RepeatabilityClient(_RepeatabilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates OASIS repeatability headers. diff --git a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_patch.py b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/special-words/pyproject.toml b/packages/typespec-python/tests/generated/azure/special-words/pyproject.toml index b1a342ba3f..68d3ec30e2 100644 --- a/packages/typespec-python/tests/generated/azure/special-words/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/special-words/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/special-words/specialwords/_client.py b/packages/typespec-python/tests/generated/azure/special-words/specialwords/_client.py index 3a9facdb11..e19976b0cb 100644 --- a/packages/typespec-python/tests/generated/azure/special-words/specialwords/_client.py +++ b/packages/typespec-python/tests/generated/azure/special-words/specialwords/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -24,6 +24,11 @@ ParametersOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SpecialWordsClient: # pylint: disable=client-accepts-api-version-keyword """Scenarios to verify that reserved words can be used in service and generators will handle it diff --git a/packages/typespec-python/tests/generated/azure/special-words/specialwords/_patch.py b/packages/typespec-python/tests/generated/azure/special-words/specialwords/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/special-words/specialwords/_patch.py +++ b/packages/typespec-python/tests/generated/azure/special-words/specialwords/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/special-words/specialwords/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/special-words/specialwords/_utils/model_base.py index eef4e52ed1..76b48f9a84 100644 --- a/packages/typespec-python/tests/generated/azure/special-words/specialwords/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/special-words/specialwords/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1129,7 +1130,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/special-words/specialwords/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/special-words/specialwords/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/special-words/specialwords/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/special-words/specialwords/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/special-words/specialwords/aio/_client.py b/packages/typespec-python/tests/generated/azure/special-words/specialwords/aio/_client.py index 0be36300c4..ec6e263c63 100644 --- a/packages/typespec-python/tests/generated/azure/special-words/specialwords/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/special-words/specialwords/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -24,6 +24,11 @@ ParametersOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SpecialWordsClient: # pylint: disable=client-accepts-api-version-keyword """Scenarios to verify that reserved words can be used in service and generators will handle it diff --git a/packages/typespec-python/tests/generated/azure/special-words/specialwords/aio/_patch.py b/packages/typespec-python/tests/generated/azure/special-words/specialwords/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/special-words/specialwords/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/special-words/specialwords/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/special-words/specialwords/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/special-words/specialwords/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/special-words/specialwords/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/special-words/specialwords/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/special-words/specialwords/models/_patch.py b/packages/typespec-python/tests/generated/azure/special-words/specialwords/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/special-words/specialwords/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/special-words/specialwords/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/special-words/specialwords/operations/_patch.py b/packages/typespec-python/tests/generated/azure/special-words/specialwords/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/special-words/specialwords/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/special-words/specialwords/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/specs-documentation/pyproject.toml b/packages/typespec-python/tests/generated/azure/specs-documentation/pyproject.toml index d6283af7bd..d97a520074 100644 --- a/packages/typespec-python/tests/generated/azure/specs-documentation/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/specs-documentation/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_client.py b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_client.py index b852921b76..5a5b121ef5 100644 --- a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_client.py +++ b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ListsOperations, TextFormattingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DocumentationClient: # pylint: disable=client-accepts-api-version-keyword """Illustrates documentation generation and formatting features. diff --git a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_patch.py b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_patch.py +++ b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/aio/_client.py b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/aio/_client.py index f20313142f..32138ee3d0 100644 --- a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import DocumentationClientConfiguration from .operations import ListsOperations, TextFormattingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DocumentationClient: # pylint: disable=client-accepts-api-version-keyword """Illustrates documentation generation and formatting features. diff --git a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/aio/_patch.py b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/models/_patch.py b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/operations/_patch.py b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/streaming-jsonl/pyproject.toml b/packages/typespec-python/tests/generated/azure/streaming-jsonl/pyproject.toml index b7886d6785..600f163f20 100644 --- a/packages/typespec-python/tests/generated/azure/streaming-jsonl/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/streaming-jsonl/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_client.py b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_client.py index ebb26214dd..254098e05e 100644 --- a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_client.py +++ b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .basic.operations import BasicOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class JsonlClient: # pylint: disable=client-accepts-api-version-keyword """Test of jsonl streaming. diff --git a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_patch.py b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_patch.py +++ b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/aio/_client.py b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/aio/_client.py index 481fc5aa1e..5777e2a0ec 100644 --- a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ..basic.aio.operations import BasicOperations from ._configuration import JsonlClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class JsonlClient: # pylint: disable=client-accepts-api-version-keyword """Test of jsonl streaming. diff --git a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/aio/_patch.py b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/basic/models/_patch.py b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/basic/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/basic/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/basic/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-array/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-array/pyproject.toml index c1d972c8a5..2b248546f0 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-array/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-array/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_client.py b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_client.py index 030f534ce8..1c9d0d930b 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -33,6 +33,11 @@ UnknownValueOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ArrayClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates various types of arrays. diff --git a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/aio/_client.py index 2012baab7a..7698ded2c5 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -33,6 +33,11 @@ UnknownValueOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ArrayClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates various types of arrays. diff --git a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-dictionary/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-dictionary/pyproject.toml index c17c8fab28..74724aa7ab 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-dictionary/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-dictionary/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_client.py b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_client.py index 393c329d4b..705b5ae776 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -30,6 +30,11 @@ UnknownValueOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DictionaryClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates various of dictionaries. diff --git a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/aio/_client.py index f48f157063..72681a6c33 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -30,6 +30,11 @@ UnknownValueOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DictionaryClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates various of dictionaries. diff --git a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/pyproject.toml index 48a6efdd15..a5ca63c170 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_client.py b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_client.py index d66fd90ed0..8388fbb7fd 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import EnvelopeOperations, NoEnvelopeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DiscriminatedClient: # pylint: disable=client-accepts-api-version-keyword """Describe scenarios for discriminated unions. diff --git a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/_client.py index 16a4710987..b644fb0409 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import DiscriminatedClientConfiguration from .operations import EnvelopeOperations, NoEnvelopeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DiscriminatedClient: # pylint: disable=client-accepts-api-version-keyword """Describe scenarios for discriminated unions. diff --git a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/pyproject.toml index fb250105f4..2909f0b277 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_client.py b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_client.py index 19c0cf5248..7160555cff 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import StringOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ExtensibleClient: # pylint: disable=client-accepts-api-version-keyword """ExtensibleClient. diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/_client.py index 933280b471..d4b4e185cf 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ExtensibleClientConfiguration from .operations import StringOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ExtensibleClient: # pylint: disable=client-accepts-api-version-keyword """ExtensibleClient. diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/pyproject.toml index 49b0e7ba0b..51537f411a 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_client.py b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_client.py index 5d64b8956b..f3ed352f1c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import StringOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class FixedClient: # pylint: disable=client-accepts-api-version-keyword """FixedClient. diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/_client.py index dcca3ee6ef..b38340f49f 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import FixedClientConfiguration from .operations import StringOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class FixedClient: # pylint: disable=client-accepts-api-version-keyword """FixedClient. diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-empty/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-model-empty/pyproject.toml index d300c4d9f1..22800e8b57 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-empty/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-model-empty/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_client.py index 039ed2e25a..36501df6b5 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _EmptyClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class EmptyClient(_EmptyClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates usage of empty model used in operation's parameters and responses. diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/aio/_client.py index 8c0444249d..7d6592cb04 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import EmptyClientConfiguration from ._operations import _EmptyClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class EmptyClient(_EmptyClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates usage of empty model used in operation's parameters and responses. diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/pyproject.toml index ca7b1b964b..7ce21d4aa1 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_client.py index 24bc34b4ba..227a42d351 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _EnumDiscriminatorClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class EnumDiscriminatorClient( _EnumDiscriminatorClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_client.py index 77f63be385..a8e482c627 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import EnumDiscriminatorClientConfiguration from ._operations import _EnumDiscriminatorClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class EnumDiscriminatorClient( _EnumDiscriminatorClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/pyproject.toml index d56b8c4e63..d5744413cc 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_client.py index f461034080..73f00e621e 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _NestedDiscriminatorClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NestedDiscriminatorClient( _NestedDiscriminatorClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_client.py index 189454a56d..2cf56f3ce1 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import NestedDiscriminatorClientConfiguration from ._operations import _NestedDiscriminatorClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NestedDiscriminatorClient( _NestedDiscriminatorClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/pyproject.toml index 9485d03eba..0011233d98 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_client.py index 9dbee25b99..d7ef2a7b2f 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _NotDiscriminatedClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NotDiscriminatedClient( _NotDiscriminatedClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_client.py index fdd16ab8c3..4c92331966 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import NotDiscriminatedClientConfiguration from ._operations import _NotDiscriminatedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NotDiscriminatedClient( _NotDiscriminatedClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/pyproject.toml index 4a07e1b375..965483487c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_client.py index a22a131850..3d217450cd 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _RecursiveClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RecursiveClient(_RecursiveClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates inheritance recursion. diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_client.py index 87d2e92a38..da020e78de 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import RecursiveClientConfiguration from ._operations import _RecursiveClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RecursiveClient(_RecursiveClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates inheritance recursion. diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/pyproject.toml index aae6673f03..d685d72a8c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_client.py index e3a002c68e..148a0ce620 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _SingleDiscriminatorClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SingleDiscriminatorClient( _SingleDiscriminatorClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_client.py index cf1247fd5b..99db70d4bb 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import SingleDiscriminatorClientConfiguration from ._operations import _SingleDiscriminatorClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SingleDiscriminatorClient( _SingleDiscriminatorClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-usage/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-model-usage/pyproject.toml index 1343079242..7167143838 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-usage/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-model-usage/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_client.py index 0d20263c03..0c89427f01 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _UsageClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class UsageClient(_UsageClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates usage of Record in different places(Operation parameters, return type or both). diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/aio/_client.py index 581fb9ce43..c0c86a1c19 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import UsageClientConfiguration from ._operations import _UsageClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class UsageClient(_UsageClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates usage of Record in different places(Operation parameters, return type or both). diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/pyproject.toml index f080f99d7c..f9b7a12661 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_client.py index 183a28836d..f246a0af87 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _VisibilityClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VisibilityClient(_VisibilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates models with visibility properties. diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_client.py index 2bd3027bb3..1216228de3 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import VisibilityClientConfiguration from ._operations import _VisibilityClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VisibilityClient(_VisibilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates models with visibility properties. diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/pyproject.toml index d0920564b6..ca73fe8b62 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_client.py b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_client.py index e727c1f0ac..ed7b0201bf 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -50,6 +50,11 @@ SpreadStringOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AdditionalPropertiesClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Tests for additional properties of models. diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_client.py index 1afeb43acc..71bf01605f 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -50,6 +50,11 @@ SpreadStringOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AdditionalPropertiesClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Tests for additional properties of models. diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/pyproject.toml index 1edbd021b8..087e4554c1 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_client.py b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_client.py index f7015c5969..e84bc433e7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -26,6 +26,11 @@ StringOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NullableClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates models with nullable properties. diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/_client.py index 3ae4a7daab..dc8449eab5 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -26,6 +26,11 @@ StringOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NullableClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates models with nullable properties. diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-optional/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-property-optional/pyproject.toml index b513ac5ef3..47b00e2d54 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-optional/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-property-optional/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_client.py b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_client.py index b06efb80a5..2a7c1de64c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -35,6 +35,11 @@ UnionStringLiteralOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class OptionalClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates models with optional properties. diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/aio/_client.py index 504284f11f..3e82ebb445 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -35,6 +35,11 @@ UnionStringLiteralOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class OptionalClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates models with optional properties. diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/pyproject.toml index 6f40eaccf7..4692d5ef50 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_client.py b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_client.py index e284c7ec2e..48c6de4448 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -48,6 +48,11 @@ UnknownStringOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ValueTypesClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates various property types for models. diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/_client.py index 1b455c9c8a..5877eeed5c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -48,6 +48,11 @@ UnknownStringOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ValueTypesClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates various property types for models. diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-scalar/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-scalar/pyproject.toml index b37d18805c..18f7d4cb4d 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-scalar/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-scalar/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_client.py b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_client.py index 1d3f74d18d..d51c5ec680 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -26,6 +26,11 @@ UnknownOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ScalarClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """ScalarClient. diff --git a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/aio/_client.py index 488eac03d3..07e9de3dea 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -26,6 +26,11 @@ UnknownOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ScalarClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """ScalarClient. diff --git a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-union/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-union/pyproject.toml index c85924899f..ed91415e85 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-union/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-union/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_client.py b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_client.py index 8863b50c81..0bca43587d 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -29,6 +29,11 @@ StringsOnlyOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class UnionClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Describe scenarios for various combinations of unions. diff --git a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/aio/_client.py index 1b43016396..c7059d7210 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -29,6 +29,11 @@ StringsOnlyOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class UnionClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Describe scenarios for various combinations of unions. diff --git a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/models/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-added/pyproject.toml b/packages/typespec-python/tests/generated/azure/versioning-added/pyproject.toml index 44c6835764..23d3bce7e2 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-added/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/versioning-added/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_client.py b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_client.py index f613be489e..f9efe3b76a 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_client.py +++ b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import InterfaceV2Operations, _AddedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AddedClient(_AddedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@added`` decorator. diff --git a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/aio/_client.py b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/aio/_client.py index 3121d534a1..63a517a4d3 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AddedClientConfiguration from .operations import InterfaceV2Operations, _AddedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AddedClient(_AddedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@added`` decorator. diff --git a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/aio/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/models/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/operations/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/pyproject.toml b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/pyproject.toml index dbdaed46fe..9a4cac941d 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_client.py b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_client.py index 6839ee13d8..379c255335 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_client.py +++ b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _MadeOptionalClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MadeOptionalClient(_MadeOptionalClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@madeOptional`` decorator. diff --git a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_client.py b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_client.py index 8650cf7ea0..c22285756e 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import MadeOptionalClientConfiguration from ._operations import _MadeOptionalClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MadeOptionalClient(_MadeOptionalClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@madeOptional`` decorator. diff --git a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/models/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-removed/pyproject.toml b/packages/typespec-python/tests/generated/azure/versioning-removed/pyproject.toml index fb005f8382..45fe86465d 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-removed/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/versioning-removed/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_client.py b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_client.py index e7419674d8..4a9769a93b 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_client.py +++ b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _RemovedClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RemovedClient(_RemovedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@removed`` decorator. diff --git a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/aio/_client.py b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/aio/_client.py index fa156c6f3d..a1fda175ed 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import RemovedClientConfiguration from ._operations import _RemovedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RemovedClient(_RemovedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@removed`` decorator. diff --git a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/aio/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/models/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/pyproject.toml b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/pyproject.toml index f8a49f40b5..750a3143a3 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_client.py b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_client.py index fbb7c1bcc3..8df234c4bb 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_client.py +++ b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import NewInterfaceOperations, _RenamedFromClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RenamedFromClient(_RenamedFromClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@renamedFrom`` decorator. diff --git a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/_client.py b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/_client.py index 205c94f231..b27d2b4028 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import RenamedFromClientConfiguration from .operations import NewInterfaceOperations, _RenamedFromClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RenamedFromClient(_RenamedFromClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@renamedFrom`` decorator. diff --git a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/models/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/operations/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/pyproject.toml b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/pyproject.toml index af855d2231..00744a792e 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_client.py b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_client.py index 137f4a598d..517cc2fbf1 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_client.py +++ b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _ReturnTypeChangedFromClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ReturnTypeChangedFromClient( _ReturnTypeChangedFromClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_client.py b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_client.py index 94c0d1b6fd..67d0f86711 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ReturnTypeChangedFromClientConfiguration from ._operations import _ReturnTypeChangedFromClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ReturnTypeChangedFromClient( _ReturnTypeChangedFromClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/models/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/pyproject.toml b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/pyproject.toml index 81735c2174..0be623bdae 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_client.py b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_client.py index 8091f28a82..557c79b467 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_client.py +++ b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _TypeChangedFromClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class TypeChangedFromClient( _TypeChangedFromClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_utils/model_base.py index db24930fdc..e388041e45 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_utils/serialization.py index 81ec1de592..954bf7ebff 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_client.py b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_client.py index 38383e658e..9357d92982 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import TypeChangedFromClientConfiguration from ._operations import _TypeChangedFromClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class TypeChangedFromClient( _TypeChangedFromClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/models/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/models/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_client.py b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_client.py index 39c3789576..f8317bcde8 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.credentials import ServiceKeyCredential from corehttp.rest import HttpRequest, HttpResponse @@ -12,6 +12,11 @@ from ._operations import _ApiKeyClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ApiKeyClient(_ApiKeyClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with ApiKey authentication. diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_operations/_patch.py index fc4fac79b3..8391c35e9d 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List from ._operations import _ApiKeyClientOperationsMixin as Generated diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/aio/_client.py index 77cc728a36..614bffb94a 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.credentials import ServiceKeyCredential from corehttp.rest import AsyncHttpResponse, HttpRequest @@ -12,6 +12,11 @@ from ._configuration import ApiKeyClientConfiguration from ._operations import _ApiKeyClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ApiKeyClient(_ApiKeyClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with ApiKey authentication. diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/aio/_operations/_patch.py index fc4fac79b3..8391c35e9d 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List from ._operations import _ApiKeyClientOperationsMixin as Generated diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/pyproject.toml index bded6e6b36..a3dff40269 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_client.py b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_client.py index e783ba8641..ceb80565b8 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.credentials import ServiceKeyCredential from corehttp.rest import HttpRequest, HttpResponse @@ -12,6 +12,11 @@ from ._operations import _CustomClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class CustomClient(_CustomClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with generic HTTP auth. diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_client.py index f2c2c91339..0fbc4f4f6a 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.credentials import ServiceKeyCredential from corehttp.rest import AsyncHttpResponse, HttpRequest @@ -12,6 +12,11 @@ from ._configuration import CustomClientConfiguration from ._operations import _CustomClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class CustomClient(_CustomClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with generic HTTP auth. diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/pyproject.toml index a10b8d16ae..8d9373ed53 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_client.py b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_client.py index 5761b53175..e1e127bd1c 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _UnionClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from corehttp.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_operations/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_client.py index 5e1fb2b7f5..a66390d82c 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import UnionClientConfiguration from ._operations import _UnionClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from corehttp.credentials import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_operations/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/pyproject.toml index c67a3d3ce6..eda5789e71 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_client.py b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_client.py index b6c2f221e7..b869708003 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, TYPE_CHECKING -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _OAuth2ClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from corehttp.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_client.py index 378fb98eda..7de2f6fee7 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import OAuth2ClientConfiguration from ._operations import _OAuth2ClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from corehttp.credentials import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/pyproject.toml index 174f0b242b..f7872e2910 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_client.py b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_client.py index 171a71a4f5..95f49ffa7b 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, TYPE_CHECKING, Union -from typing_extensions import Self from corehttp.credentials import ServiceKeyCredential from corehttp.rest import HttpRequest, HttpResponse @@ -12,6 +12,11 @@ from ._operations import _UnionClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from corehttp.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/aio/_client.py index 0ee916f541..a68a59458d 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable, TYPE_CHECKING, Union -from typing_extensions import Self from corehttp.credentials import ServiceKeyCredential from corehttp.rest import AsyncHttpResponse, HttpRequest @@ -12,6 +12,11 @@ from ._configuration import UnionClientConfiguration from ._operations import _UnionClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from corehttp.credentials import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-union/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/authentication-union/pyproject.toml index 49f7c43207..27e808c510 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-union/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/authentication-union/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_client.py b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_client.py index f86a047460..9ad00c5d1e 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .property.operations import PropertyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ArrayClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on array. diff --git a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/aio/_client.py index d878331c5d..3416d114f1 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ..property.aio.operations import PropertyOperations from ._configuration import ArrayClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ArrayClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on array. diff --git a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/aio/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/aio/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/models/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/models/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/property/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/property/aio/operations/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/property/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/property/aio/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/property/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/property/operations/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/property/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/property/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-array/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/encode-array/pyproject.toml index 55d69be7b3..8a2a14005e 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-array/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/encode-array/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_client.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_client.py index b3ef717467..c9bec7770d 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -15,6 +15,11 @@ from .requestbody.operations import RequestBodyOperations from .responsebody.operations import ResponseBodyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BytesClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on bytes. diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/aio/_client.py index 0ddad29adb..f2fc6e3355 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -15,6 +15,11 @@ from ..responsebody.aio.operations import ResponseBodyOperations from ._configuration import BytesClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BytesClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on bytes. diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/header/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/header/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/header/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/header/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/header/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/header/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/header/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/header/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/property/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/property/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/property/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/property/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/property/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/property/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/property/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/property/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/query/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/query/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/query/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/query/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/query/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/query/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/query/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/query/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/requestbody/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/requestbody/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/requestbody/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/requestbody/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/requestbody/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/requestbody/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/requestbody/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/requestbody/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/responsebody/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/responsebody/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/responsebody/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/responsebody/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/responsebody/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/responsebody/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/responsebody/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/responsebody/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/encode-bytes/pyproject.toml index ccfcb0137f..6e72db998e 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_client.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_client.py index e30653f26a..248759b4b0 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -14,6 +14,11 @@ from .query.operations import QueryOperations from .responseheader.operations import ResponseHeaderOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DatetimeClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on datetime. diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/aio/_client.py index 9cc99d98c7..ee6f58cac9 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -14,6 +14,11 @@ from ..responseheader.aio.operations import ResponseHeaderOperations from ._configuration import DatetimeClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DatetimeClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on datetime. diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/header/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/header/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/header/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/header/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/header/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/header/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/header/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/header/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/property/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/property/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/property/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/property/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/property/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/property/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/property/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/property/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/query/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/query/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/query/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/query/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/query/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/query/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/query/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/query/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/responseheader/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/responseheader/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/responseheader/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/responseheader/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/encode-datetime/pyproject.toml index 5d19f1ff5b..b54be7c6b7 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_client.py b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_client.py index 10feef8b77..2deedb900d 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -13,6 +13,11 @@ from .property.operations import PropertyOperations from .query.operations import QueryOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DurationClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on duration. diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/aio/_client.py index b24a09c6f3..d5ce7657a0 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -13,6 +13,11 @@ from ..query.aio.operations import QueryOperations from ._configuration import DurationClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DurationClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on duration. diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/header/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/header/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/header/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/header/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/header/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/header/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/header/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/header/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/property/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/property/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/property/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/property/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/property/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/property/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/property/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/property/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/property/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/property/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/property/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/property/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/query/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/query/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/query/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/query/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/query/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/query/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/query/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/query/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/encode-duration/pyproject.toml index 9392503fb1..80959aaf24 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_client.py b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_client.py index ae39adff41..97b0d4ea02 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .property.operations import PropertyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NumericClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on integer. diff --git a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/aio/_client.py index 0afca9d019..3e6ae70939 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ..property.aio.operations import PropertyOperations from ._configuration import NumericClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NumericClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on integer. diff --git a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/property/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/property/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/property/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/property/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/property/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/property/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/property/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/property/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/property/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/property/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/property/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/property/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-numeric/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/encode-numeric/pyproject.toml index 4c6927193d..39fc7b735c 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-numeric/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/encode-numeric/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_client.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_client.py index d75669f2e3..c0f898c8ec 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _RecursiveClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RecursiveClient(_RecursiveClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates inheritance recursion. diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_patch.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/aio/_client.py index 67a5ba7469..88a14a58a1 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import RecursiveClientConfiguration from ._operations import _RecursiveClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RecursiveClient(_RecursiveClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates inheritance recursion. diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/generation-subdir/pyproject.toml index 8e6b6146aa..3a8f74061f 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_client.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_client.py index 280d95dd77..38439bb195 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import InterfaceV2Operations, _AddedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AddedClient(_AddedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@added`` decorator. diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_patch.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/aio/_client.py index d4ddb5f9ad..815f896830 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import AddedClientConfiguration from .operations import InterfaceV2Operations, _AddedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AddedClient(_AddedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@added`` decorator. diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/aio/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/aio/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/aio/operations/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/aio/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/models/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/models/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/operations/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/pyproject.toml index 150e1d42cc..487fe99786 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_client.py b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_client.py index caef522b8f..f207443c59 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _VisibilityClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VisibilityClient(_VisibilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates models with visibility properties. diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_patch.py b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_client.py index 0e56f7b7be..ad48920bab 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import VisibilityClientConfiguration from ._operations import _VisibilityClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VisibilityClient(_VisibilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates models with visibility properties. diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/pyproject.toml index 289f871f52..4b4aecb5e2 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_client.py b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_client.py index caef522b8f..f207443c59 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _VisibilityClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VisibilityClient(_VisibilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates models with visibility properties. diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_patch.py b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_client.py index 0e56f7b7be..ad48920bab 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import VisibilityClientConfiguration from ._operations import _VisibilityClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VisibilityClient(_VisibilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates models with visibility properties. diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/pyproject.toml index c72808cef7..292f5b43b9 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_client.py b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_client.py index c6f0c505e8..71dce673a5 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -12,6 +12,11 @@ from .explicitbody.operations import ExplicitBodyOperations from .implicitbody.operations import ImplicitBodyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BasicClient: # pylint: disable=client-accepts-api-version-keyword """Test for basic parameters cases. diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/aio/_client.py index 129562a9cf..706198ab1d 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -12,6 +12,11 @@ from ..implicitbody.aio.operations import ImplicitBodyOperations from ._configuration import BasicClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BasicClient: # pylint: disable=client-accepts-api-version-keyword """Test for basic parameters cases. diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/explicitbody/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/explicitbody/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/explicitbody/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/explicitbody/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/explicitbody/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/explicitbody/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/explicitbody/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/explicitbody/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/explicitbody/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/explicitbody/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/explicitbody/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/explicitbody/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/implicitbody/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/implicitbody/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/implicitbody/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/implicitbody/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/implicitbody/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/implicitbody/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/implicitbody/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/implicitbody/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-basic/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/parameters-basic/pyproject.toml index bfbf7c0e1f..88bfa62d96 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-basic/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/parameters-basic/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_client.py b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_client.py index b9f179a036..a8ece0871a 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -12,6 +12,11 @@ from ._utils.serialization import Deserializer, Serializer from .optionalexplicit.operations import OptionalExplicitOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BodyOptionalityClient( _BodyOptionalityClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_client.py index 053836c3ca..d306cd5f4f 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -12,6 +12,11 @@ from ._configuration import BodyOptionalityClientConfiguration from ._operations import _BodyOptionalityClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BodyOptionalityClient( _BodyOptionalityClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/pyproject.toml index 4837fc2c28..39fb182748 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_client.py b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_client.py index 11a2623f9b..3c6917b1a3 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -12,6 +12,11 @@ from .header.operations import HeaderOperations from .query.operations import QueryOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class CollectionFormatClient: # pylint: disable=client-accepts-api-version-keyword """Test for collectionFormat. diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/aio/_client.py index e58a9c2157..d8433a986e 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -12,6 +12,11 @@ from ..query.aio.operations import QueryOperations from ._configuration import CollectionFormatClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class CollectionFormatClient: # pylint: disable=client-accepts-api-version-keyword """Test for collectionFormat. diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/pyproject.toml index 73b14cf812..950933d444 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_client.py b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_client.py index 6f1e48f191..b9aa720f25 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _PathClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PathClient(_PathClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for path parameters cases. diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/aio/_client.py index 78bdc4af9c..a9b3fe9588 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import PathClientConfiguration from ._operations import _PathClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PathClient(_PathClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for path parameters cases. diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-path/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/parameters-path/pyproject.toml index a0dadd4896..292395fb03 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-path/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/parameters-path/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_client.py b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_client.py index b2e753b414..a4bb9e32ce 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ConstantOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class QueryClient: # pylint: disable=client-accepts-api-version-keyword """Test for query parameter cases. diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/aio/_client.py index 4b2b6c630f..bf9583fa41 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import QueryClientConfiguration from .operations import ConstantOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class QueryClient: # pylint: disable=client-accepts-api-version-keyword """Test for query parameter cases. diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/aio/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/aio/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/aio/operations/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/aio/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/operations/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-query/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/parameters-query/pyproject.toml index 8626a2a989..5b1ca92a2d 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-query/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/parameters-query/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_client.py b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_client.py index 65ea261490..92b11200c4 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -12,6 +12,11 @@ from .alias.operations import AliasOperations from .model.operations import ModelOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SpreadClient: # pylint: disable=client-accepts-api-version-keyword """Test for the spread operator. diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/aio/_client.py index fd96b553be..bc632ac441 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -12,6 +12,11 @@ from ..model.aio.operations import ModelOperations from ._configuration import SpreadClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SpreadClient: # pylint: disable=client-accepts-api-version-keyword """Test for the spread operator. diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/alias/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/alias/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/alias/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/alias/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/alias/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/alias/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/alias/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/alias/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/model/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/model/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/model/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/model/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/model/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/model/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/model/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/model/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/model/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/model/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/model/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/model/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-spread/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/parameters-spread/pyproject.toml index 344d1a8c25..efc5e45914 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-spread/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/parameters-spread/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_client.py b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_client.py index 3dc6c6dc51..417ae946c4 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -12,6 +12,11 @@ from .differentbody.operations import DifferentBodyOperations from .samebody.operations import SameBodyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ContentNegotiationClient: # pylint: disable=client-accepts-api-version-keyword """Test describing optionality of the request body. diff --git a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/aio/_client.py index 46f3edf440..78bc65d2f4 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -12,6 +12,11 @@ from ..samebody.aio.operations import SameBodyOperations from ._configuration import ContentNegotiationClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ContentNegotiationClient: # pylint: disable=client-accepts-api-version-keyword """Test describing optionality of the request body. diff --git a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/samebody/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/samebody/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/samebody/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/samebody/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/samebody/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/samebody/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/samebody/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/samebody/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/pyproject.toml index 2542ede916..2c4d25c987 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_client.py b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_client.py index 57e104964f..c31728d420 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _JsonMergePatchClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class JsonMergePatchClient(_JsonMergePatchClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for merge-patch+json content-type. diff --git a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_client.py index a0f2cf55a9..1b615ca703 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import JsonMergePatchClientConfiguration from ._operations import _JsonMergePatchClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class JsonMergePatchClient(_JsonMergePatchClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for merge-patch+json content-type. diff --git a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/pyproject.toml index d98f4e5f4d..a3505f3a8e 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_client.py b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_client.py index 90dadced1c..945f49c151 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .stringbody.operations import StringBodyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MediaTypeClient: # pylint: disable=client-accepts-api-version-keyword """Test the payload with different media types and different types of the payload itself. diff --git a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/aio/_client.py index f35d7df40b..d47623f510 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ..stringbody.aio.operations import StringBodyOperations from ._configuration import MediaTypeClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MediaTypeClient: # pylint: disable=client-accepts-api-version-keyword """Test the payload with different media types and different types of the payload itself. diff --git a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/stringbody/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/stringbody/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/stringbody/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/stringbody/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-media-type/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/payload-media-type/pyproject.toml index fa5fa184c3..9a86ee621d 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-media-type/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/payload-media-type/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_client.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_client.py index 6ea2b329db..09d354a876 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .formdata.operations import FormDataOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MultiPartClient: # pylint: disable=client-accepts-api-version-keyword """Test for multipart. diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_utils/utils.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_utils/utils.py index ac0302f596..4df01ac7bf 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_utils/utils.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_utils/utils.py @@ -3,7 +3,6 @@ from .._utils.model_base import Model, SdkJSONEncoder - # file-like tuple could be `(filename, IO (or bytes))` or `(filename, IO (or bytes), content_type)` FileContent = Union[str, bytes, IO[str], IO[bytes]] diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/aio/_client.py index cfc5b1fe28..c3fbac9e1e 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ..formdata.aio.operations import FormDataOperations from ._configuration import MultiPartClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MultiPartClient: # pylint: disable=client-accepts-api-version-keyword """Test for multipart. diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/file/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/file/aio/operations/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/file/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/file/aio/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/file/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/file/models/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/file/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/file/models/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/file/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/file/operations/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/file/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/file/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/contenttype/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/contenttype/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/contenttype/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/contenttype/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/contenttype/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/contenttype/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/contenttype/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/contenttype/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/payload-multipart/pyproject.toml index 006319a118..64dc4754a3 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_client.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_client.py index dc031a8f67..f0e09be3d6 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -13,6 +13,11 @@ from .serverdrivenpagination.operations import ServerDrivenPaginationOperations from .xmlpagination.operations import XmlPaginationOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PageableClient: # pylint: disable=client-accepts-api-version-keyword """Test for pageable payload. diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_operations/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/aio/_client.py index ad05d7bcea..ee6be0ce73 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -13,6 +13,11 @@ from ..xmlpagination.aio.operations import XmlPaginationOperations from ._configuration import PageableClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PageableClient: # pylint: disable=client-accepts-api-version-keyword """Test for pageable payload. diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/aio/_operations/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/aio/_operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/pagesize/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/pagesize/aio/operations/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/pagesize/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/pagesize/aio/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/pagesize/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/pagesize/operations/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/pagesize/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/pagesize/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/aio/operations/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/aio/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/models/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/models/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/operations/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/xmlpagination/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/xmlpagination/aio/operations/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/xmlpagination/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/xmlpagination/aio/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/xmlpagination/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/xmlpagination/operations/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/xmlpagination/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/xmlpagination/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/payload-pageable/pyproject.toml index 2a39c3fdf3..a13b3e420f 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_client.py b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_client.py index c10596c721..198e940d5e 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -38,6 +38,11 @@ XmlErrorValueOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class XmlClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Sends and receives bodies in XML format. diff --git a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_utils/model_base.py index 4bce0460ec..1ec76185f4 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1123,7 +1124,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/aio/_client.py index 0b10891acd..82a6676f29 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -38,6 +38,11 @@ XmlErrorValueOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class XmlClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Sends and receives bodies in XML format. diff --git a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-xml/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/payload-xml/pyproject.toml index a95dd09089..7c8c79c9aa 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-xml/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/payload-xml/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/pyproject.toml index 9100428b3f..ef2a1de0e8 100644 --- a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_client.py b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_client.py index 1c4006cb1d..164fecaec2 100644 --- a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _StatusCodeRangeClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class StatusCodeRangeClient( _StatusCodeRangeClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_patch.py b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_client.py index 7025f6c0f8..94e110fee0 100644 --- a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import StatusCodeRangeClientConfiguration from ._operations import _StatusCodeRangeClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class StatusCodeRangeClient( _StatusCodeRangeClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/routes/pyproject.toml index f38b571949..05b15249b9 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/routes/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/_client.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/_client.py index 5774cd376f..c01a9e6ea0 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -13,6 +13,11 @@ from .pathparameters.operations import PathParametersOperations from .queryparameters.operations import QueryParametersOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RoutesClient(_RoutesClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Define scenario in building the http route/uri. diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/aio/_client.py index 5c5ec1bf12..dc4a0ef65c 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -13,6 +13,11 @@ from ._configuration import RoutesClientConfiguration from .operations import InInterfaceOperations, _RoutesClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RoutesClient(_RoutesClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Define scenario in building the http route/uri. diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/reservedexpansion/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/reservedexpansion/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/reservedexpansion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/reservedexpansion/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/pyproject.toml index f1f07a96d9..800a3d9707 100644 --- a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_client.py b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_client.py index 4aff34de05..db25ad433c 100644 --- a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .property.operations import PropertyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class JsonClient: # pylint: disable=client-accepts-api-version-keyword """Encoded names. diff --git a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_patch.py b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/aio/_client.py index 3c73b23acb..eacb1ab0bf 100644 --- a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ..property.aio.operations import PropertyOperations from ._configuration import JsonClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class JsonClient: # pylint: disable=client-accepts-api-version-keyword """Encoded names. diff --git a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/pyproject.toml index d1ff2cd2a8..0893efe98f 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_client.py b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_client.py index 1548cdef03..e59ebce3c2 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _NotDefinedClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NotDefinedClient(_NotDefinedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates server doesn't define endpoint. Client should automatically add an endpoint to let diff --git a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_client.py index 199fa63785..2031a741b0 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import NotDefinedClientConfiguration from ._operations import _NotDefinedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NotDefinedClient(_NotDefinedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates server doesn't define endpoint. Client should automatically add an endpoint to let diff --git a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/pyproject.toml index 490fd04d82..0b2f492462 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_client.py b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_client.py index 2691f62283..9a4f8c6fa8 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _MultipleClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MultipleClient(_MultipleClientOperationsMixin): """MultipleClient. diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/aio/_client.py index 9d67004365..f55f6d00e7 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import MultipleClientConfiguration from ._operations import _MultipleClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MultipleClient(_MultipleClientOperationsMixin): """MultipleClient. diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-single/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/server-path-single/pyproject.toml index 844f1c4446..d1d04757d3 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-single/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/server-path-single/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_client.py b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_client.py index cc9e78bcf6..869d307122 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _SingleClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SingleClient(_SingleClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates server with a single path parameter @server. diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/aio/_client.py index ea72d5bb06..7ad99ceaf7 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import SingleClientConfiguration from ._operations import _SingleClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SingleClient(_SingleClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates server with a single path parameter @server. diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/pyproject.toml index 255ec4c121..64ffd63928 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_client.py b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_client.py index 05919a4440..4d0af04d9c 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _NotVersionedClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NotVersionedClient(_NotVersionedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates not-versioned server. diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_client.py index fd416b17d6..c860076f51 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import NotVersionedClientConfiguration from ._operations import _NotVersionedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NotVersionedClient(_NotVersionedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates not-versioned server. diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/pyproject.toml index ec8037eb2b..6fcae26ae7 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_client.py b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_client.py index a1c6b700de..d138215c41 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _VersionedClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VersionedClient(_VersionedClientOperationsMixin): """Illustrates versioned server. diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_client.py index 0fb9efb66b..43ee6a3949 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import VersionedClientConfiguration from ._operations import _VersionedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VersionedClient(_VersionedClientOperationsMixin): """Illustrates versioned server. diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setup.py b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setup.py index f18e1fd4ca..a60e187b46 100644 --- a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setup.py +++ b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setup.py @@ -5,7 +5,6 @@ import re from setuptools import setup, find_packages - PACKAGE_NAME = "setuppy-authentication-union" PACKAGE_PPRINT_NAME = "Setuppy Authentication Union" PACKAGE_NAMESPACE = "setuppy.authentication.union" @@ -34,7 +33,6 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", @@ -59,5 +57,5 @@ "corehttp[requests]>=1.0.0b6", "typing-extensions>=4.6.0", ], - python_requires=">=3.9", + python_requires=">=3.10", ) diff --git a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_client.py b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_client.py index 171a71a4f5..95f49ffa7b 100644 --- a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, TYPE_CHECKING, Union -from typing_extensions import Self from corehttp.credentials import ServiceKeyCredential from corehttp.rest import HttpRequest, HttpResponse @@ -12,6 +12,11 @@ from ._operations import _UnionClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from corehttp.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_patch.py b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_client.py index 0ee916f541..a68a59458d 100644 --- a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable, TYPE_CHECKING, Union -from typing_extensions import Self from corehttp.credentials import ServiceKeyCredential from corehttp.rest import AsyncHttpResponse, HttpRequest @@ -12,6 +12,11 @@ from ._configuration import UnionClientConfiguration from ._operations import _UnionClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from corehttp.credentials import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/pyproject.toml index a67788908a..83ee64aeed 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_client.py b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_client.py index 79ac424bd6..9393cc6c2e 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _ConditionalRequestClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ConditionalRequestClient( _ConditionalRequestClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_client.py index d563574451..22b26d7538 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import ConditionalRequestClientConfiguration from ._operations import _ConditionalRequestClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ConditionalRequestClient( _ConditionalRequestClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/pyproject.toml index 32fe401c23..fa712cba24 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_client.py b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_client.py index 9acb382959..16b0b37884 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _RepeatabilityClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RepeatabilityClient(_RepeatabilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates OASIS repeatability headers. diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_client.py index ea79e646a9..657207d6b7 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import RepeatabilityClientConfiguration from ._operations import _RepeatabilityClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RepeatabilityClient(_RepeatabilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates OASIS repeatability headers. diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/special-words/pyproject.toml index 5ce5e77992..fa7b25b434 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/special-words/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_client.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_client.py index bb4763d92f..bae36e85ec 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -14,6 +14,11 @@ from .models.operations import ModelsOperations from .operations import Operations, ParametersOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SpecialWordsClient: # pylint: disable=client-accepts-api-version-keyword """Scenarios to verify that reserved words can be used in service and generators will handle it diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_utils/model_base.py index 4bce0460ec..1ec76185f4 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1123,7 +1124,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/aio/_client.py index df7d3d3e65..6e122475e7 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -14,6 +14,11 @@ from ._configuration import SpecialWordsClientConfiguration from .operations import Operations, ParametersOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SpecialWordsClient: # pylint: disable=client-accepts-api-version-keyword """Scenarios to verify that reserved words can be used in service and generators will handle it diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/extensiblestrings/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/extensiblestrings/aio/operations/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/extensiblestrings/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/extensiblestrings/aio/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/extensiblestrings/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/extensiblestrings/models/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/extensiblestrings/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/extensiblestrings/models/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/extensiblestrings/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/extensiblestrings/operations/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/extensiblestrings/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/extensiblestrings/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/modelproperties/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/modelproperties/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/modelproperties/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/modelproperties/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/modelproperties/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/modelproperties/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/modelproperties/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/modelproperties/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/modelproperties/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/modelproperties/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/modelproperties/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/modelproperties/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/models/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/models/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/models/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/models/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/models/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/models/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/models/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/models/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/models/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/models/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/models/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/models/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/specs-documentation/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/specs-documentation/pyproject.toml index d416e872f7..5bf059ca3c 100644 --- a/packages/typespec-python/tests/generated/unbranded/specs-documentation/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/specs-documentation/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_client.py b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_client.py index b1e72ea577..88d9d7daac 100644 --- a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ListsOperations, TextFormattingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DocumentationClient: # pylint: disable=client-accepts-api-version-keyword """Illustrates documentation generation and formatting features. diff --git a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_patch.py b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/aio/_client.py index 3670430e95..eff8841192 100644 --- a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import DocumentationClientConfiguration from .operations import ListsOperations, TextFormattingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DocumentationClient: # pylint: disable=client-accepts-api-version-keyword """Illustrates documentation generation and formatting features. diff --git a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/aio/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/aio/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/aio/operations/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/aio/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/models/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/models/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/operations/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/pyproject.toml index 706e00e5b3..7232bd6ddd 100644 --- a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_client.py b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_client.py index feb3d65ac5..94cb915f1b 100644 --- a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .basic.operations import BasicOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class JsonlClient: # pylint: disable=client-accepts-api-version-keyword """Test of jsonl streaming. diff --git a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_patch.py b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/aio/_client.py index f0123acbc4..b08ee96cc2 100644 --- a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ..basic.aio.operations import BasicOperations from ._configuration import JsonlClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class JsonlClient: # pylint: disable=client-accepts-api-version-keyword """Test of jsonl streaming. diff --git a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/models/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/models/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-array/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-array/pyproject.toml index 079ed8b243..e083038c87 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-array/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-array/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_client.py index 08e71e15c1..1c0f5d977b 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -26,6 +26,11 @@ UnknownValueOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ArrayClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates various types of arrays. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/aio/_client.py index 19c24fc645..fdb25ad8d8 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -26,6 +26,11 @@ UnknownValueOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ArrayClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates various types of arrays. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/pyproject.toml index d58a94fd49..ba82dee206 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_client.py index 5fad49ebd0..ac57f82e6a 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -23,6 +23,11 @@ UnknownValueOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DictionaryClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates various of dictionaries. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/_client.py index a01df3d4f6..1e0cd303be 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -23,6 +23,11 @@ UnknownValueOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DictionaryClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates various of dictionaries. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/pyproject.toml index de6898e982..b381e57d24 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_client.py index 8e553bd635..2f9d20c194 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import EnvelopeOperations, NoEnvelopeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DiscriminatedClient: # pylint: disable=client-accepts-api-version-keyword """Describe scenarios for discriminated unions. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/_client.py index 542cf464f6..2187cd687b 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import DiscriminatedClientConfiguration from .operations import EnvelopeOperations, NoEnvelopeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DiscriminatedClient: # pylint: disable=client-accepts-api-version-keyword """Describe scenarios for discriminated unions. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/operations/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/models/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/models/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/operations/_patch.py index bbe39eaf69..b208fb11fb 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/pyproject.toml index af2e373fc0..7ecff2ccf9 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_client.py index 41ba859312..9bfb6f08a5 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import StringOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ExtensibleClient: # pylint: disable=client-accepts-api-version-keyword """ExtensibleClient. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/_client.py index 9fb7f42219..229073d7cb 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import ExtensibleClientConfiguration from .operations import StringOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ExtensibleClient: # pylint: disable=client-accepts-api-version-keyword """ExtensibleClient. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/pyproject.toml index f19fd75c35..e7a4d7cc78 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_client.py index 9796efb373..c1e9d97263 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import StringOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class FixedClient: # pylint: disable=client-accepts-api-version-keyword """FixedClient. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/_client.py index b816e9c312..1213b870a1 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import FixedClientConfiguration from .operations import StringOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class FixedClient: # pylint: disable=client-accepts-api-version-keyword """FixedClient. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/pyproject.toml index 879dc35df0..8865ac1ce5 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_client.py index 73ecb42119..529036719a 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _EmptyClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class EmptyClient(_EmptyClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates usage of empty model used in operation's parameters and responses. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_client.py index c9a467bf4d..ac2a21d366 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import EmptyClientConfiguration from ._operations import _EmptyClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class EmptyClient(_EmptyClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates usage of empty model used in operation's parameters and responses. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/pyproject.toml index 982a4a38e3..712344271a 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_client.py index f330becebc..6588440484 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _EnumDiscriminatorClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class EnumDiscriminatorClient( _EnumDiscriminatorClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_client.py index 317b394862..94bb9bebe9 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import EnumDiscriminatorClientConfiguration from ._operations import _EnumDiscriminatorClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class EnumDiscriminatorClient( _EnumDiscriminatorClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/pyproject.toml index f7426f1c97..e5dff82c64 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_client.py index ceb015ca6f..d5438cca4a 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _NestedDiscriminatorClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NestedDiscriminatorClient( _NestedDiscriminatorClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_client.py index 5ef38d0184..b6c6c29df8 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import NestedDiscriminatorClientConfiguration from ._operations import _NestedDiscriminatorClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NestedDiscriminatorClient( _NestedDiscriminatorClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/pyproject.toml index 1ecb07a32a..bcec7140bf 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_client.py index 8a1be48f02..95a446200a 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _NotDiscriminatedClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NotDiscriminatedClient( _NotDiscriminatedClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_client.py index 5e79ac2220..22d0a9c0f6 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import NotDiscriminatedClientConfiguration from ._operations import _NotDiscriminatedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NotDiscriminatedClient( _NotDiscriminatedClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/pyproject.toml index b05394033b..b5db0b394e 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_client.py index d75669f2e3..c0f898c8ec 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _RecursiveClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RecursiveClient(_RecursiveClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates inheritance recursion. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_client.py index 67a5ba7469..88a14a58a1 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import RecursiveClientConfiguration from ._operations import _RecursiveClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RecursiveClient(_RecursiveClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates inheritance recursion. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/pyproject.toml index a1b2143ea7..bb04ce600e 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_client.py index eb5a824a77..cdfef7009b 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _SingleDiscriminatorClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SingleDiscriminatorClient( _SingleDiscriminatorClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_client.py index 91952d03f1..8c5c8bca88 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import SingleDiscriminatorClientConfiguration from ._operations import _SingleDiscriminatorClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SingleDiscriminatorClient( _SingleDiscriminatorClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/pyproject.toml index 0c54c59093..3f493fac8d 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_client.py index fbf27f47c7..e8dd4f5ff9 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _UsageClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class UsageClient(_UsageClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates usage of Record in different places(Operation parameters, return type or both). diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_client.py index 3e83a457d9..5afd7fc0bb 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import UsageClientConfiguration from ._operations import _UsageClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class UsageClient(_UsageClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates usage of Record in different places(Operation parameters, return type or both). diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/pyproject.toml index 35bdb60fb3..146830b529 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_client.py index caef522b8f..f207443c59 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _VisibilityClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VisibilityClient(_VisibilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates models with visibility properties. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_client.py index 0e56f7b7be..ad48920bab 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import VisibilityClientConfiguration from ._operations import _VisibilityClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VisibilityClient(_VisibilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates models with visibility properties. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/pyproject.toml index ab0106266f..c7fa8b58b5 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_client.py index 3c9588ace3..9bc9679666 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -43,6 +43,11 @@ SpreadStringOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AdditionalPropertiesClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Tests for additional properties of models. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_client.py index 944cc1e831..eea3ae6c75 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -43,6 +43,11 @@ SpreadStringOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AdditionalPropertiesClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Tests for additional properties of models. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/pyproject.toml index 04631d2588..271a3ff524 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_client.py index 8e6bd43067..114ddfd098 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -19,6 +19,11 @@ StringOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NullableClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates models with nullable properties. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/_client.py index 541493385a..7e8c35ef6f 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -19,6 +19,11 @@ StringOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NullableClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates models with nullable properties. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/pyproject.toml index ac2ccfec2e..f59adf70bd 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_client.py index 82b4163b38..72a58ec052 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -28,6 +28,11 @@ UnionStringLiteralOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class OptionalClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates models with optional properties. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/_client.py index 39870a4ba8..b643ca5a80 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -28,6 +28,11 @@ UnionStringLiteralOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class OptionalClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates models with optional properties. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/pyproject.toml index 06a9e35cc1..c3456d8c5c 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_client.py index 920e91040c..a013896eb5 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -41,6 +41,11 @@ UnknownStringOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ValueTypesClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates various property types for models. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/_client.py index 529c61c49a..edc747e065 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -41,6 +41,11 @@ UnknownStringOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ValueTypesClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates various property types for models. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/pyproject.toml index 6ec6aa804d..c40f41e696 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_client.py index 5fb6ec4709..3e3ca844bb 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -19,6 +19,11 @@ UnknownOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ScalarClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """ScalarClient. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/aio/_client.py index 1d795579c1..54b9aa979e 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -19,6 +19,11 @@ UnknownOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ScalarClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """ScalarClient. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-union/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-union/pyproject.toml index 6eb17fe34b..b9b86fead9 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-union/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-union/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_client.py index 433896cf63..3d8e3bb9fe 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -22,6 +22,11 @@ StringsOnlyOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class UnionClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Describe scenarios for various combinations of unions. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/aio/_client.py index c99bcdd149..42ff0d8a85 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -22,6 +22,11 @@ StringsOnlyOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class UnionClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Describe scenarios for various combinations of unions. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-added/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/versioning-added/pyproject.toml index 335bc99c83..f8b12c5ed5 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-added/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/versioning-added/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_client.py b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_client.py index 37acafcf3b..75182a2237 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import InterfaceV2Operations, _AddedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AddedClient(_AddedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@added`` decorator. diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/aio/_client.py index 8cd0849bcb..d0137f4f3f 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import AddedClientConfiguration from .operations import InterfaceV2Operations, _AddedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AddedClient(_AddedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@added`` decorator. diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/pyproject.toml index d6bd0b8dc1..ca345631d4 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_client.py b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_client.py index b462f38cff..90567a6c48 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _MadeOptionalClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MadeOptionalClient(_MadeOptionalClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@madeOptional`` decorator. diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_client.py index 06badd8d45..a194f3b67f 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import MadeOptionalClientConfiguration from ._operations import _MadeOptionalClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MadeOptionalClient(_MadeOptionalClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@madeOptional`` decorator. diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-removed/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/versioning-removed/pyproject.toml index 9cb6d36eca..a5d3b82d1f 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-removed/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/versioning-removed/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_client.py b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_client.py index f09f933a73..f11b0c20bd 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _RemovedClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RemovedClient(_RemovedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@removed`` decorator. diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/aio/_client.py index ce606c775c..d5b46ff4b6 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import RemovedClientConfiguration from ._operations import _RemovedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RemovedClient(_RemovedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@removed`` decorator. diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/pyproject.toml index 972cfdbd2a..b3e2f1903c 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_client.py b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_client.py index 2fa7744c2e..1689fc0f91 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import NewInterfaceOperations, _RenamedFromClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RenamedFromClient(_RenamedFromClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@renamedFrom`` decorator. diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/_client.py index 0441277ba5..f100404c83 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import RenamedFromClientConfiguration from .operations import NewInterfaceOperations, _RenamedFromClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RenamedFromClient(_RenamedFromClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@renamedFrom`` decorator. diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/pyproject.toml index f8effa7387..af6124d382 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_client.py b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_client.py index b891b5f779..0bfeacc72e 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _ReturnTypeChangedFromClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ReturnTypeChangedFromClient( _ReturnTypeChangedFromClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_client.py index 7bb83ab5c9..e29699d26e 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import ReturnTypeChangedFromClientConfiguration from ._operations import _ReturnTypeChangedFromClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ReturnTypeChangedFromClient( _ReturnTypeChangedFromClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/pyproject.toml index fe18e1598b..bb2f3e6a80 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_client.py b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_client.py index 29c9ba9d7e..bd71ee50b7 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _TypeChangedFromClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class TypeChangedFromClient( _TypeChangedFromClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_utils/model_base.py index 93c61bab85..9322982728 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_utils/serialization.py index 029256399e..f1eb13d978 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_client.py index f812b0ef7b..dc9a4026ad 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import TypeChangedFromClientConfiguration from ._operations import _TypeChangedFromClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class TypeChangedFromClient( _TypeChangedFromClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_operations/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/models/_patch.py index 894b28a174..e9ae928351 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level From dd31096d9315df7a1f5f4ebc42be2addd0585496 Mon Sep 17 00:00:00 2001 From: AutoPrFromHttpClientPython Date: Wed, 29 Apr 2026 07:18:57 +0000 Subject: [PATCH 6/9] Regenerate for autorest.python (2026-04-29 07:18:57) --- packages/autorest.python/autorest/__init__.py | 1 - packages/autorest.python/autorest/codegen.py | 1 - packages/autorest.python/autorest/jsonrpc/localapi.py | 1 - packages/autorest.python/autorest/jsonrpc/server.py | 1 - packages/autorest.python/autorest/jsonrpc/stdstream.py | 1 - packages/autorest.python/autorest/m2r.py | 2 +- .../autorest.python/autorest/m4reformatter/__init__.py | 2 +- packages/autorest.python/autorest/preprocess.py | 1 + .../azure-mgmt-pyproject/azure/mgmt/pyproject/_patch.py | 1 + .../azure/mgmt/pyproject/_pyproject_mgmt_client.py | 7 ++++++- .../azure/mgmt/pyproject/_utils/serialization.py | 6 +++++- .../azure/mgmt/pyproject/aio/_patch.py | 1 + .../azure/mgmt/pyproject/aio/_pyproject_mgmt_client.py | 7 ++++++- .../azure/mgmt/pyproject/aio/operations/_patch.py | 1 + .../azure/mgmt/pyproject/operations/_patch.py | 1 + .../test/azure-mgmt-pyproject/pyproject.toml | 3 +-- .../azure/mgmt/test/_auto_rest_head_test_service.py | 7 ++++++- .../test/azure-mgmt-test/azure/mgmt/test/_patch.py | 1 + .../azure/mgmt/test/_utils/serialization.py | 6 +++++- .../azure/mgmt/test/aio/_auto_rest_head_test_service.py | 7 ++++++- .../test/azure-mgmt-test/azure/mgmt/test/aio/_patch.py | 1 + .../azure/mgmt/test/aio/operations/_patch.py | 1 + .../azure-mgmt-test/azure/mgmt/test/operations/_patch.py | 1 + .../azure-mgmt-test/test/azure-mgmt-test/setup.py | 4 +--- .../test/azure-test/azure/test/_generated/_client.py | 7 ++++++- .../test/azure-test/azure/test/_generated/_patch.py | 1 + .../azure/test/_generated/_utils/serialization.py | 6 +++++- .../test/azure-test/azure/test/_generated/aio/_client.py | 7 ++++++- .../test/azure-test/azure/test/_generated/aio/_patch.py | 1 + .../azure/test/_generated/aio/operations/_patch.py | 1 + .../test/azure-test/azure/test/_generated/models/_patch.py | 1 + .../azure-test/azure/test/_generated/operations/_patch.py | 1 + .../generated/azure/key/credential/sample/_client.py | 7 ++++++- .../generated/azure/key/credential/sample/_patch.py | 1 + .../azure/key/credential/sample/_utils/serialization.py | 6 +++++- .../generated/azure/key/credential/sample/aio/_client.py | 7 ++++++- .../generated/azure/key/credential/sample/aio/_patch.py | 1 + .../azure/key/credential/sample/aio/operations/_patch.py | 1 + .../azure/key/credential/sample/operations/_patch.py | 1 + .../specification/azure_key_credential/generated/setup.py | 1 - .../basic/generated/azure/basic/sample/_client.py | 7 ++++++- .../basic/generated/azure/basic/sample/_patch.py | 1 + .../generated/azure/basic/sample/_utils/serialization.py | 6 +++++- .../basic/generated/azure/basic/sample/aio/_client.py | 7 ++++++- .../basic/generated/azure/basic/sample/aio/_patch.py | 1 + .../generated/azure/basic/sample/aio/operations/_patch.py | 1 + .../generated/azure/basic/sample/operations/_patch.py | 1 + .../samples/specification/basic/generated/setup.py | 1 - .../generated/azure/directives/sample/_client.py | 7 ++++++- .../azure/directives/sample/_operations/_patch.py | 1 + .../directives/generated/azure/directives/sample/_patch.py | 1 + .../azure/directives/sample/_utils/serialization.py | 6 +++++- .../generated/azure/directives/sample/aio/_client.py | 7 ++++++- .../azure/directives/sample/aio/_operations/_patch.py | 1 + .../generated/azure/directives/sample/aio/_patch.py | 1 + .../samples/specification/directives/generated/setup.py | 1 - .../azure/mgmt/sample/_auto_rest_head_test_service.py | 7 ++++++- .../management/generated/azure/mgmt/sample/_patch.py | 1 + .../generated/azure/mgmt/sample/_utils/serialization.py | 6 +++++- .../azure/mgmt/sample/aio/_auto_rest_head_test_service.py | 7 ++++++- .../management/generated/azure/mgmt/sample/aio/_patch.py | 1 + .../generated/azure/mgmt/sample/aio/operations/_patch.py | 1 + .../generated/azure/mgmt/sample/operations/_patch.py | 1 + .../samples/specification/management/generated/setup.py | 1 - packages/autorest.python/scripts/venvtools.py | 1 - packages/autorest.python/setup.py | 1 - .../azure/legacy/AcceptanceTests/asynctests/test_lro.py | 1 - .../test/azure/legacy/AcceptanceTests/conftest.py | 1 - .../test/azure/legacy/AcceptanceTests/test_lro.py | 1 - .../bodyduration/_auto_rest_duration_test_service.py | 7 ++++++- .../AzureBodyDuration/bodyduration/_patch.py | 1 + .../AzureBodyDuration/bodyduration/_utils/serialization.py | 6 +++++- .../bodyduration/aio/_auto_rest_duration_test_service.py | 7 ++++++- .../AzureBodyDuration/bodyduration/aio/_patch.py | 1 + .../bodyduration/aio/operations/_patch.py | 1 + .../AzureBodyDuration/bodyduration/models/_patch.py | 1 + .../AzureBodyDuration/bodyduration/operations/_patch.py | 1 + .../Expected/AcceptanceTests/AzureBodyDuration/setup.py | 1 - .../_auto_rest_parameter_grouping_test_service.py | 7 ++++++- .../azureparametergrouping/_patch.py | 1 + .../aio/_auto_rest_parameter_grouping_test_service.py | 7 ++++++- .../azureparametergrouping/aio/_patch.py | 1 + .../azureparametergrouping/aio/operations/_patch.py | 1 + .../azureparametergrouping/models/_patch.py | 1 + .../azureparametergrouping/operations/_patch.py | 1 + .../AcceptanceTests/AzureParameterGrouping/setup.py | 1 - .../azurereport/_auto_rest_report_service_for_azure.py | 7 ++++++- .../AcceptanceTests/AzureReport/azurereport/_patch.py | 1 + .../AzureReport/azurereport/_utils/serialization.py | 6 +++++- .../azurereport/aio/_auto_rest_report_service_for_azure.py | 7 ++++++- .../AcceptanceTests/AzureReport/azurereport/aio/_patch.py | 1 + .../AzureReport/azurereport/aio/operations/_patch.py | 1 + .../AzureReport/azurereport/models/_patch.py | 1 + .../AzureReport/azurereport/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/AzureReport/setup.py | 1 - .../_auto_rest_azure_special_parameters_test_client.py | 7 ++++++- .../AzureSpecials/azurespecialproperties/_patch.py | 1 + .../aio/_auto_rest_azure_special_parameters_test_client.py | 7 ++++++- .../AzureSpecials/azurespecialproperties/aio/_patch.py | 1 + .../azurespecialproperties/aio/operations/_patch.py | 1 + .../AzureSpecials/azurespecialproperties/models/_patch.py | 1 + .../azurespecialproperties/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/AzureSpecials/setup.py | 1 - .../_auto_rest_parameterized_host_test_client.py | 7 ++++++- .../AcceptanceTests/CustomBaseUri/custombaseurl/_patch.py | 1 + .../aio/_auto_rest_parameterized_host_test_client.py | 7 ++++++- .../CustomBaseUri/custombaseurl/aio/_patch.py | 1 + .../CustomBaseUri/custombaseurl/aio/operations/_patch.py | 1 + .../CustomBaseUri/custombaseurl/models/_patch.py | 1 + .../CustomBaseUri/custombaseurl/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py | 1 - .../custompollerpager/_auto_rest_paging_test_service.py | 7 ++++++- .../CustomPollerPager/custompollerpager/_patch.py | 1 + .../custompollerpager/_utils/serialization.py | 6 +++++- .../aio/_auto_rest_paging_test_service.py | 7 ++++++- .../CustomPollerPager/custompollerpager/aio/_patch.py | 1 + .../custompollerpager/aio/operations/_patch.py | 1 + .../CustomPollerPager/custompollerpager/models/_patch.py | 1 + .../custompollerpager/operations/_patch.py | 1 + .../Expected/AcceptanceTests/CustomPollerPager/setup.py | 1 - .../_auto_rest_parameterized_host_test_paging_client.py | 7 ++++++- .../CustomUrlPaging/custombaseurlpaging/_patch.py | 1 + .../custombaseurlpaging/_utils/serialization.py | 6 +++++- .../_auto_rest_parameterized_host_test_paging_client.py | 7 ++++++- .../CustomUrlPaging/custombaseurlpaging/aio/_patch.py | 1 + .../custombaseurlpaging/aio/operations/_patch.py | 1 + .../CustomUrlPaging/custombaseurlpaging/models/_patch.py | 1 + .../custombaseurlpaging/operations/_patch.py | 1 + .../Expected/AcceptanceTests/CustomUrlPaging/setup.py | 1 - .../Head/head/_auto_rest_head_test_service.py | 7 ++++++- .../legacy/Expected/AcceptanceTests/Head/head/_patch.py | 1 + .../AcceptanceTests/Head/head/_utils/serialization.py | 6 +++++- .../Head/head/aio/_auto_rest_head_test_service.py | 7 ++++++- .../Expected/AcceptanceTests/Head/head/aio/_patch.py | 1 + .../AcceptanceTests/Head/head/aio/operations/_patch.py | 1 + .../AcceptanceTests/Head/head/operations/_patch.py | 1 + .../azure/legacy/Expected/AcceptanceTests/Head/setup.py | 1 - .../_auto_rest_head_exception_test_service.py | 7 ++++++- .../HeadExceptions/headexceptions/_patch.py | 1 + .../HeadExceptions/headexceptions/_utils/serialization.py | 6 +++++- .../aio/_auto_rest_head_exception_test_service.py | 7 ++++++- .../HeadExceptions/headexceptions/aio/_patch.py | 1 + .../HeadExceptions/headexceptions/aio/operations/_patch.py | 1 + .../HeadExceptions/headexceptions/operations/_patch.py | 1 + .../Expected/AcceptanceTests/HeadExceptions/setup.py | 1 - .../_auto_rest_head_test_service.py | 7 ++++++- .../headwithazurekeycredentialpolicy/_patch.py | 1 + .../_utils/serialization.py | 6 +++++- .../aio/_auto_rest_head_test_service.py | 7 ++++++- .../headwithazurekeycredentialpolicy/aio/_patch.py | 1 + .../aio/operations/_patch.py | 1 + .../headwithazurekeycredentialpolicy/operations/_patch.py | 1 + .../HeadWithAzureKeyCredentialPolicy/setup.py | 1 - .../lro/_auto_rest_long_running_operation_test_service.py | 7 ++++++- .../legacy/Expected/AcceptanceTests/Lro/lro/_patch.py | 1 + .../AcceptanceTests/Lro/lro/_utils/serialization.py | 6 +++++- .../aio/_auto_rest_long_running_operation_test_service.py | 7 ++++++- .../legacy/Expected/AcceptanceTests/Lro/lro/aio/_patch.py | 1 + .../AcceptanceTests/Lro/lro/aio/operations/_patch.py | 1 + .../Expected/AcceptanceTests/Lro/lro/models/_patch.py | 1 + .../Expected/AcceptanceTests/Lro/lro/operations/_patch.py | 1 + .../azure/legacy/Expected/AcceptanceTests/Lro/setup.py | 1 - .../_lro_with_paramaterized_endpoints.py | 7 ++++++- .../lrowithparameterizedendpoints/_patch.py | 1 + .../lrowithparameterizedendpoints/_utils/serialization.py | 6 +++++- .../aio/_lro_with_paramaterized_endpoints.py | 7 ++++++- .../lrowithparameterizedendpoints/aio/_patch.py | 1 + .../lrowithparameterizedendpoints/aio/operations/_patch.py | 1 + .../lrowithparameterizedendpoints/models/_patch.py | 1 + .../lrowithparameterizedendpoints/operations/_patch.py | 1 + .../AcceptanceTests/LroWithParameterizedEndpoints/setup.py | 1 - .../mixedapiversion/_mixed_api_version_client.py | 7 ++++++- .../MixedApiVersion/mixedapiversion/_patch.py | 1 + .../mixedapiversion/_utils/serialization.py | 6 +++++- .../mixedapiversion/aio/_mixed_api_version_client.py | 7 ++++++- .../MixedApiVersion/mixedapiversion/aio/_patch.py | 1 + .../mixedapiversion/aio/operations/_patch.py | 1 + .../MixedApiVersion/mixedapiversion/models/_patch.py | 1 + .../MixedApiVersion/mixedapiversion/operations/_patch.py | 1 + .../Expected/AcceptanceTests/MixedApiVersion/setup.py | 1 - .../azure/packagemode/batch/head/_head_client.py | 7 ++++++- .../azure/packagemode/batch/head/_patch.py | 1 + .../azure/packagemode/batch/head/_utils/serialization.py | 6 +++++- .../azure/packagemode/batch/head/aio/_head_client.py | 7 ++++++- .../azure/packagemode/batch/head/aio/_patch.py | 1 + .../azure/packagemode/batch/head/aio/operations/_patch.py | 1 + .../azure/packagemode/batch/head/operations/_patch.py | 1 + .../azure/packagemode/batch/paging/_paging_client.py | 7 ++++++- .../azure/packagemode/batch/paging/_patch.py | 1 + .../azure/packagemode/batch/paging/_utils/serialization.py | 6 +++++- .../azure/packagemode/batch/paging/aio/_paging_client.py | 7 ++++++- .../azure/packagemode/batch/paging/aio/_patch.py | 1 + .../packagemode/batch/paging/aio/operations/_patch.py | 1 + .../azure/packagemode/batch/paging/models/_patch.py | 1 + .../azure/packagemode/batch/paging/operations/_patch.py | 1 + .../AcceptanceTests/PackageModeBatch/pyproject.toml | 3 +-- .../packagemode/customize/_auto_rest_head_test_service.py | 7 ++++++- .../azure/packagemode/customize/_patch.py | 1 + .../azure/packagemode/customize/_utils/serialization.py | 6 +++++- .../customize/aio/_auto_rest_head_test_service.py | 7 ++++++- .../azure/packagemode/customize/aio/_patch.py | 1 + .../azure/packagemode/customize/aio/operations/_patch.py | 1 + .../azure/packagemode/customize/operations/_patch.py | 1 + .../Expected/AcceptanceTests/PackageModeCustomize/setup.py | 1 - .../packagemode/dataplane/_auto_rest_head_test_service.py | 7 ++++++- .../azure/packagemode/dataplane/_patch.py | 1 + .../azure/packagemode/dataplane/_utils/serialization.py | 6 +++++- .../dataplane/aio/_auto_rest_head_test_service.py | 7 ++++++- .../azure/packagemode/dataplane/aio/_patch.py | 1 + .../azure/packagemode/dataplane/aio/operations/_patch.py | 1 + .../azure/packagemode/dataplane/operations/_patch.py | 1 + .../AcceptanceTests/PackageModeDataPlane/pyproject.toml | 3 +-- .../azure/package/mode/_auto_rest_head_test_service.py | 7 ++++++- .../PackageModeMgmtPlane/azure/package/mode/_patch.py | 1 + .../azure/package/mode/_utils/serialization.py | 6 +++++- .../azure/package/mode/aio/_auto_rest_head_test_service.py | 7 ++++++- .../PackageModeMgmtPlane/azure/package/mode/aio/_patch.py | 1 + .../azure/package/mode/aio/operations/_patch.py | 1 + .../azure/package/mode/operations/_patch.py | 1 + .../AcceptanceTests/PackageModeMgmtPlane/pyproject.toml | 3 +-- .../Paging/paging/_auto_rest_paging_test_service.py | 7 ++++++- .../Expected/AcceptanceTests/Paging/paging/_patch.py | 1 + .../AcceptanceTests/Paging/paging/_utils/serialization.py | 6 +++++- .../Paging/paging/aio/_auto_rest_paging_test_service.py | 7 ++++++- .../Expected/AcceptanceTests/Paging/paging/aio/_patch.py | 1 + .../AcceptanceTests/Paging/paging/aio/operations/_patch.py | 1 + .../AcceptanceTests/Paging/paging/models/_patch.py | 1 + .../AcceptanceTests/Paging/paging/operations/_patch.py | 1 + .../azure/legacy/Expected/AcceptanceTests/Paging/setup.py | 1 - .../securityaadswagger/_autorest_security_aad.py | 7 ++++++- .../SecurityAadSwagger/securityaadswagger/_patch.py | 1 + .../securityaadswagger/_utils/serialization.py | 6 +++++- .../securityaadswagger/aio/_autorest_security_aad.py | 7 ++++++- .../SecurityAadSwagger/securityaadswagger/aio/_patch.py | 1 + .../securityaadswagger/aio/operations/_patch.py | 1 + .../securityaadswagger/operations/_patch.py | 1 + .../Expected/AcceptanceTests/SecurityAadSwagger/setup.py | 1 - .../securitykeyswagger/_autorest_security_key.py | 7 ++++++- .../SecurityKeySwagger/securitykeyswagger/_patch.py | 1 + .../securitykeyswagger/_utils/serialization.py | 6 +++++- .../securitykeyswagger/aio/_autorest_security_key.py | 7 ++++++- .../SecurityKeySwagger/securitykeyswagger/aio/_patch.py | 1 + .../securitykeyswagger/aio/operations/_patch.py | 1 + .../securitykeyswagger/operations/_patch.py | 1 + .../Expected/AcceptanceTests/SecurityKeySwagger/setup.py | 1 - .../AcceptanceTests/StorageManagementClient/setup.py | 1 - .../StorageManagementClient/storage/_patch.py | 1 + .../storage/_storage_management_client.py | 7 ++++++- .../storage/_utils/serialization.py | 6 +++++- .../StorageManagementClient/storage/aio/_patch.py | 1 + .../storage/aio/_storage_management_client.py | 7 ++++++- .../storage/aio/operations/_patch.py | 1 + .../StorageManagementClient/storage/models/_patch.py | 1 + .../StorageManagementClient/storage/operations/_patch.py | 1 + .../AcceptanceTests/SubscriptionIdApiVersion/setup.py | 1 - .../subscriptionidapiversion/_microsoft_azure_test_url.py | 7 ++++++- .../subscriptionidapiversion/_patch.py | 1 + .../subscriptionidapiversion/_utils/serialization.py | 6 +++++- .../aio/_microsoft_azure_test_url.py | 7 ++++++- .../subscriptionidapiversion/aio/_patch.py | 1 + .../subscriptionidapiversion/aio/operations/_patch.py | 1 + .../subscriptionidapiversion/models/_patch.py | 1 + .../subscriptionidapiversion/operations/_patch.py | 1 + .../AcceptanceTests/asynctests/test_lro.py | 1 - .../azure/version-tolerant/AcceptanceTests/conftest.py | 1 - .../azure/version-tolerant/AcceptanceTests/test_lro.py | 1 - .../bodydurationversiontolerant/_client.py | 7 ++++++- .../bodydurationversiontolerant/_patch.py | 1 + .../bodydurationversiontolerant/_utils/serialization.py | 6 +++++- .../bodydurationversiontolerant/aio/_client.py | 7 ++++++- .../bodydurationversiontolerant/aio/_patch.py | 1 + .../bodydurationversiontolerant/aio/operations/_patch.py | 1 + .../bodydurationversiontolerant/operations/_patch.py | 1 + .../AzureBodyDurationVersionTolerant/setup.py | 1 - .../azureparametergroupingversiontolerant/_client.py | 7 ++++++- .../azureparametergroupingversiontolerant/_patch.py | 1 + .../_utils/serialization.py | 6 +++++- .../azureparametergroupingversiontolerant/aio/_client.py | 7 ++++++- .../azureparametergroupingversiontolerant/aio/_patch.py | 1 + .../aio/operations/_patch.py | 1 + .../operations/_patch.py | 1 + .../AzureParameterGroupingVersionTolerant/setup.py | 1 - .../azurereportversiontolerant/_client.py | 7 ++++++- .../azurereportversiontolerant/_operations/_patch.py | 1 + .../azurereportversiontolerant/_patch.py | 1 + .../azurereportversiontolerant/_utils/serialization.py | 6 +++++- .../azurereportversiontolerant/aio/_client.py | 7 ++++++- .../azurereportversiontolerant/aio/_operations/_patch.py | 1 + .../azurereportversiontolerant/aio/_patch.py | 1 + .../AcceptanceTests/AzureReportVersionTolerant/setup.py | 1 - .../azurespecialpropertiesversiontolerant/_client.py | 7 ++++++- .../azurespecialpropertiesversiontolerant/_patch.py | 1 + .../_utils/serialization.py | 6 +++++- .../azurespecialpropertiesversiontolerant/aio/_client.py | 7 ++++++- .../azurespecialpropertiesversiontolerant/aio/_patch.py | 1 + .../aio/operations/_patch.py | 1 + .../operations/_patch.py | 1 + .../AcceptanceTests/AzureSpecialsVersionTolerant/setup.py | 1 - .../custombaseurlversiontolerant/_client.py | 7 ++++++- .../custombaseurlversiontolerant/_patch.py | 1 + .../custombaseurlversiontolerant/_utils/serialization.py | 6 +++++- .../custombaseurlversiontolerant/aio/_client.py | 7 ++++++- .../custombaseurlversiontolerant/aio/_patch.py | 1 + .../custombaseurlversiontolerant/aio/operations/_patch.py | 1 + .../custombaseurlversiontolerant/operations/_patch.py | 1 + .../AcceptanceTests/CustomBaseUriVersionTolerant/setup.py | 1 - .../custompollerpagerversiontolerant/_client.py | 7 ++++++- .../custompollerpagerversiontolerant/_patch.py | 1 + .../_utils/serialization.py | 6 +++++- .../custompollerpagerversiontolerant/aio/_client.py | 7 ++++++- .../custompollerpagerversiontolerant/aio/_patch.py | 1 + .../aio/operations/_patch.py | 1 + .../custompollerpagerversiontolerant/operations/_patch.py | 1 + .../CustomPollerPagerVersionTolerant/setup.py | 1 - .../custombaseurlpagingversiontolerant/_client.py | 7 ++++++- .../custombaseurlpagingversiontolerant/_patch.py | 1 + .../_utils/serialization.py | 6 +++++- .../custombaseurlpagingversiontolerant/aio/_client.py | 7 ++++++- .../custombaseurlpagingversiontolerant/aio/_patch.py | 1 + .../aio/operations/_patch.py | 1 + .../operations/_patch.py | 1 + .../CustomUrlPagingVersionTolerant/setup.py | 1 - .../headexceptionsversiontolerant/_client.py | 7 ++++++- .../headexceptionsversiontolerant/_patch.py | 1 + .../headexceptionsversiontolerant/_utils/serialization.py | 6 +++++- .../headexceptionsversiontolerant/aio/_client.py | 7 ++++++- .../headexceptionsversiontolerant/aio/_patch.py | 1 + .../headexceptionsversiontolerant/aio/operations/_patch.py | 1 + .../headexceptionsversiontolerant/operations/_patch.py | 1 + .../AcceptanceTests/HeadExceptionsVersionTolerant/setup.py | 1 - .../HeadVersionTolerant/headversiontolerant/_client.py | 7 ++++++- .../HeadVersionTolerant/headversiontolerant/_patch.py | 1 + .../headversiontolerant/_utils/serialization.py | 6 +++++- .../HeadVersionTolerant/headversiontolerant/aio/_client.py | 7 ++++++- .../HeadVersionTolerant/headversiontolerant/aio/_patch.py | 1 + .../headversiontolerant/aio/operations/_patch.py | 1 + .../headversiontolerant/operations/_patch.py | 1 + .../Expected/AcceptanceTests/HeadVersionTolerant/setup.py | 1 - .../lropagingversiontolerant/_client.py | 7 ++++++- .../lropagingversiontolerant/_patch.py | 1 + .../lropagingversiontolerant/_utils/serialization.py | 6 +++++- .../lropagingversiontolerant/aio/_client.py | 7 ++++++- .../lropagingversiontolerant/aio/_patch.py | 1 + .../lropagingversiontolerant/aio/operations/_patch.py | 1 + .../lropagingversiontolerant/operations/_patch.py | 1 + .../AcceptanceTests/LroPagingVersionTolerant/setup.py | 1 - .../LroVersionTolerant/lroversiontolerant/_client.py | 7 ++++++- .../LroVersionTolerant/lroversiontolerant/_patch.py | 1 + .../lroversiontolerant/_utils/serialization.py | 6 +++++- .../LroVersionTolerant/lroversiontolerant/aio/_client.py | 7 ++++++- .../LroVersionTolerant/lroversiontolerant/aio/_patch.py | 1 + .../lroversiontolerant/aio/operations/_patch.py | 1 + .../lroversiontolerant/operations/_patch.py | 1 + .../Expected/AcceptanceTests/LroVersionTolerant/setup.py | 1 - .../_client.py | 7 ++++++- .../_operations/_patch.py | 1 + .../lrowithparameterizedendpointsversiontolerant/_patch.py | 1 + .../_utils/serialization.py | 6 +++++- .../aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 + .../aio/_patch.py | 1 + .../LroWithParameterizedEndpointsVersionTolerant/setup.py | 1 - .../PagingVersionTolerant/pagingversiontolerant/_client.py | 7 ++++++- .../PagingVersionTolerant/pagingversiontolerant/_patch.py | 1 + .../pagingversiontolerant/_utils/serialization.py | 6 +++++- .../pagingversiontolerant/aio/_client.py | 7 ++++++- .../pagingversiontolerant/aio/_patch.py | 1 + .../pagingversiontolerant/aio/operations/_patch.py | 1 + .../pagingversiontolerant/operations/_patch.py | 1 + .../AcceptanceTests/PagingVersionTolerant/setup.py | 1 - .../StorageManagementClientVersionTolerant/setup.py | 1 - .../storageversiontolerant/_client.py | 7 ++++++- .../storageversiontolerant/_patch.py | 1 + .../storageversiontolerant/_utils/serialization.py | 6 +++++- .../storageversiontolerant/aio/_client.py | 7 ++++++- .../storageversiontolerant/aio/_patch.py | 1 + .../storageversiontolerant/aio/operations/_patch.py | 1 + .../storageversiontolerant/operations/_patch.py | 1 + .../SubscriptionIdApiVersionVersionTolerant/setup.py | 1 - .../subscriptionidapiversionversiontolerant/_client.py | 7 ++++++- .../subscriptionidapiversionversiontolerant/_patch.py | 1 + .../_utils/serialization.py | 6 +++++- .../subscriptionidapiversionversiontolerant/aio/_client.py | 7 ++++++- .../subscriptionidapiversionversiontolerant/aio/_patch.py | 1 + .../aio/operations/_patch.py | 1 + .../operations/_patch.py | 1 + .../dpgcustomizationcustomizedversiontolerant/_client.py | 7 ++++++- .../_operations/_patch.py | 1 + .../dpgcustomizationcustomizedversiontolerant/_patch.py | 1 + .../_utils/serialization.py | 6 +++++- .../aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 + .../aio/_patch.py | 1 + .../DPGCustomizationCustomizedVersionTolerant/setup.py | 1 - .../dpgcustomizationinitialversiontolerant/_client.py | 7 ++++++- .../_operations/_patch.py | 1 + .../dpgcustomizationinitialversiontolerant/_patch.py | 1 + .../_utils/serialization.py | 6 +++++- .../dpgcustomizationinitialversiontolerant/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 + .../dpgcustomizationinitialversiontolerant/aio/_patch.py | 1 + .../DPGCustomizationInitialVersionTolerant/setup.py | 1 - .../dpgservicedriveninitialversiontolerant/_client.py | 7 ++++++- .../dpgservicedriveninitialversiontolerant/_patch.py | 1 + .../_utils/serialization.py | 6 +++++- .../dpgservicedriveninitialversiontolerant/aio/_client.py | 7 ++++++- .../dpgservicedriveninitialversiontolerant/aio/_patch.py | 1 + .../aio/operations/_patch.py | 1 + .../operations/_patch.py | 1 + .../DPGServiceDrivenInitialVersionTolerant/setup.py | 1 - .../dpgservicedrivenupdateoneversiontolerant/_client.py | 7 ++++++- .../dpgservicedrivenupdateoneversiontolerant/_patch.py | 1 + .../_utils/serialization.py | 6 +++++- .../aio/_client.py | 7 ++++++- .../dpgservicedrivenupdateoneversiontolerant/aio/_patch.py | 1 + .../aio/operations/_patch.py | 1 + .../operations/_patch.py | 1 + .../DPGServiceDrivenUpdateOneVersionTolerant/setup.py | 1 - .../dpgtestmodelsversiontolerant/_client.py | 7 ++++++- .../dpgtestmodelsversiontolerant/_operations/_patch.py | 1 + .../dpgtestmodelsversiontolerant/_patch.py | 1 + .../dpgtestmodelsversiontolerant/_utils/serialization.py | 6 +++++- .../dpgtestmodelsversiontolerant/aio/_client.py | 7 ++++++- .../dpgtestmodelsversiontolerant/aio/_operations/_patch.py | 1 + .../dpgtestmodelsversiontolerant/aio/_patch.py | 1 + .../dpgtestmodelsversiontolerant/models/_patch.py | 1 + .../AcceptanceTests/DPGTestModelsVersionTolerant/setup.py | 1 - .../test/unittests/storage_models/serialization.py | 6 +++++- packages/autorest.python/test/unittests/test_m2r.py | 1 - .../legacy/AcceptanceTests/asynctests/test_header.py | 2 +- .../vanilla/legacy/AcceptanceTests/asynctests/test_url.py | 4 ++-- .../test/vanilla/legacy/AcceptanceTests/conftest.py | 1 - .../test/vanilla/legacy/AcceptanceTests/test_header.py | 2 +- .../test/vanilla/legacy/AcceptanceTests/test_url.py | 4 ++-- .../additionalproperties/_additional_properties_client.py | 7 ++++++- .../AdditionalProperties/additionalproperties/_patch.py | 1 + .../additionalproperties/_utils/serialization.py | 6 +++++- .../aio/_additional_properties_client.py | 7 ++++++- .../additionalproperties/aio/_patch.py | 1 + .../additionalproperties/aio/operations/_patch.py | 1 + .../additionalproperties/models/_patch.py | 1 + .../additionalproperties/operations/_patch.py | 1 + .../Expected/AcceptanceTests/AdditionalProperties/setup.py | 1 - .../AcceptanceTests/Anything/anything/_anything_client.py | 7 ++++++- .../Expected/AcceptanceTests/Anything/anything/_patch.py | 1 + .../Anything/anything/_utils/serialization.py | 6 +++++- .../Anything/anything/aio/_anything_client.py | 7 ++++++- .../AcceptanceTests/Anything/anything/aio/_patch.py | 1 + .../Anything/anything/aio/operations/_patch.py | 1 + .../AcceptanceTests/Anything/anything/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/Anything/setup.py | 1 - .../bodyarray/_auto_rest_swagger_bat_array_service.py | 7 ++++++- .../Expected/AcceptanceTests/BodyArray/bodyarray/_patch.py | 1 + .../BodyArray/bodyarray/_utils/serialization.py | 6 +++++- .../bodyarray/aio/_auto_rest_swagger_bat_array_service.py | 7 ++++++- .../AcceptanceTests/BodyArray/bodyarray/aio/_patch.py | 1 + .../BodyArray/bodyarray/aio/operations/_patch.py | 1 + .../AcceptanceTests/BodyArray/bodyarray/models/_patch.py | 1 + .../BodyArray/bodyarray/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/BodyArray/setup.py | 1 - .../AcceptanceTests/BodyArrayWithNamespaceFolders/setup.py | 1 - .../body/array/_auto_rest_swagger_bat_array_service.py | 7 ++++++- .../vanilla/body/array/_patch.py | 1 + .../vanilla/body/array/_utils/serialization.py | 6 +++++- .../body/array/aio/_auto_rest_swagger_bat_array_service.py | 7 ++++++- .../vanilla/body/array/aio/_patch.py | 1 + .../vanilla/body/array/aio/operations/_patch.py | 1 + .../vanilla/body/array/models/_patch.py | 1 + .../vanilla/body/array/operations/_patch.py | 1 + .../_binary_with_content_type_application_json.py | 7 ++++++- .../AcceptanceTests/BodyBinary/bodybinary/_patch.py | 1 + .../BodyBinary/bodybinary/_utils/serialization.py | 6 +++++- .../aio/_binary_with_content_type_application_json.py | 7 ++++++- .../AcceptanceTests/BodyBinary/bodybinary/aio/_patch.py | 1 + .../BodyBinary/bodybinary/aio/operations/_patch.py | 1 + .../AcceptanceTests/BodyBinary/bodybinary/models/_patch.py | 1 + .../BodyBinary/bodybinary/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/BodyBinary/setup.py | 1 - .../bodyboolean/_auto_rest_bool_test_service.py | 7 ++++++- .../AcceptanceTests/BodyBoolean/bodyboolean/_patch.py | 1 + .../BodyBoolean/bodyboolean/_utils/serialization.py | 6 +++++- .../bodyboolean/aio/_auto_rest_bool_test_service.py | 7 ++++++- .../AcceptanceTests/BodyBoolean/bodyboolean/aio/_patch.py | 1 + .../BodyBoolean/bodyboolean/aio/operations/_patch.py | 1 + .../BodyBoolean/bodyboolean/models/_patch.py | 1 + .../BodyBoolean/bodyboolean/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/BodyBoolean/setup.py | 1 - .../bodybyte/_auto_rest_swagger_bat_byte_service.py | 7 ++++++- .../Expected/AcceptanceTests/BodyByte/bodybyte/_patch.py | 1 + .../BodyByte/bodybyte/_utils/serialization.py | 6 +++++- .../bodybyte/aio/_auto_rest_swagger_bat_byte_service.py | 7 ++++++- .../AcceptanceTests/BodyByte/bodybyte/aio/_patch.py | 1 + .../BodyByte/bodybyte/aio/operations/_patch.py | 1 + .../AcceptanceTests/BodyByte/bodybyte/models/_patch.py | 1 + .../AcceptanceTests/BodyByte/bodybyte/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/BodyByte/setup.py | 1 - .../bodybytewithpackagename/_class_name.py | 7 ++++++- .../bodybytewithpackagename/_patch.py | 1 + .../bodybytewithpackagename/_utils/serialization.py | 6 +++++- .../bodybytewithpackagename/aio/_class_name.py | 7 ++++++- .../bodybytewithpackagename/aio/_patch.py | 1 + .../bodybytewithpackagename/aio/operations/_patch.py | 1 + .../bodybytewithpackagename/models/_patch.py | 1 + .../bodybytewithpackagename/operations/_patch.py | 1 + .../AcceptanceTests/BodyByteWithPackageName/setup.py | 1 - .../bodycomplex/_auto_rest_complex_test_service.py | 7 ++++++- .../AcceptanceTests/BodyComplex/bodycomplex/_patch.py | 1 + .../bodycomplex/aio/_auto_rest_complex_test_service.py | 7 ++++++- .../AcceptanceTests/BodyComplex/bodycomplex/aio/_patch.py | 1 + .../BodyComplex/bodycomplex/aio/operations/_patch.py | 1 + .../BodyComplex/bodycomplex/models/_patch.py | 1 + .../BodyComplex/bodycomplex/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/BodyComplex/setup.py | 1 - .../BodyDate/bodydate/_auto_rest_date_test_service.py | 7 ++++++- .../Expected/AcceptanceTests/BodyDate/bodydate/_patch.py | 1 + .../BodyDate/bodydate/_utils/serialization.py | 6 +++++- .../BodyDate/bodydate/aio/_auto_rest_date_test_service.py | 7 ++++++- .../AcceptanceTests/BodyDate/bodydate/aio/_patch.py | 1 + .../BodyDate/bodydate/aio/operations/_patch.py | 1 + .../AcceptanceTests/BodyDate/bodydate/models/_patch.py | 1 + .../AcceptanceTests/BodyDate/bodydate/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/BodyDate/setup.py | 1 - .../bodydatetime/_auto_rest_date_time_test_service.py | 7 ++++++- .../AcceptanceTests/BodyDateTime/bodydatetime/_patch.py | 1 + .../BodyDateTime/bodydatetime/_utils/serialization.py | 6 +++++- .../bodydatetime/aio/_auto_rest_date_time_test_service.py | 7 ++++++- .../BodyDateTime/bodydatetime/aio/_patch.py | 1 + .../BodyDateTime/bodydatetime/aio/operations/_patch.py | 1 + .../BodyDateTime/bodydatetime/models/_patch.py | 1 + .../BodyDateTime/bodydatetime/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/BodyDateTime/setup.py | 1 - .../_auto_rest_rfc1123_date_time_test_service.py | 7 ++++++- .../BodyDateTimeRfc1123/bodydatetimerfc1123/_patch.py | 1 + .../bodydatetimerfc1123/_utils/serialization.py | 6 +++++- .../aio/_auto_rest_rfc1123_date_time_test_service.py | 7 ++++++- .../BodyDateTimeRfc1123/bodydatetimerfc1123/aio/_patch.py | 1 + .../bodydatetimerfc1123/aio/operations/_patch.py | 1 + .../bodydatetimerfc1123/models/_patch.py | 1 + .../bodydatetimerfc1123/operations/_patch.py | 1 + .../Expected/AcceptanceTests/BodyDateTimeRfc1123/setup.py | 1 - .../_auto_rest_swagger_bat_dictionary_service.py | 7 ++++++- .../BodyDictionary/bodydictionary/_patch.py | 1 + .../BodyDictionary/bodydictionary/_utils/serialization.py | 6 +++++- .../aio/_auto_rest_swagger_bat_dictionary_service.py | 7 ++++++- .../BodyDictionary/bodydictionary/aio/_patch.py | 1 + .../BodyDictionary/bodydictionary/aio/operations/_patch.py | 1 + .../BodyDictionary/bodydictionary/models/_patch.py | 1 + .../BodyDictionary/bodydictionary/operations/_patch.py | 1 + .../Expected/AcceptanceTests/BodyDictionary/setup.py | 1 - .../bodyduration/_auto_rest_duration_test_service.py | 7 ++++++- .../AcceptanceTests/BodyDuration/bodyduration/_patch.py | 1 + .../BodyDuration/bodyduration/_utils/serialization.py | 6 +++++- .../bodyduration/aio/_auto_rest_duration_test_service.py | 7 ++++++- .../BodyDuration/bodyduration/aio/_patch.py | 1 + .../BodyDuration/bodyduration/aio/operations/_patch.py | 1 + .../BodyDuration/bodyduration/models/_patch.py | 1 + .../BodyDuration/bodyduration/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/BodyDuration/setup.py | 1 - .../bodyfile/_auto_rest_swagger_bat_file_service.py | 7 ++++++- .../Expected/AcceptanceTests/BodyFile/bodyfile/_patch.py | 1 + .../BodyFile/bodyfile/_utils/serialization.py | 6 +++++- .../bodyfile/aio/_auto_rest_swagger_bat_file_service.py | 7 ++++++- .../AcceptanceTests/BodyFile/bodyfile/aio/_patch.py | 1 + .../BodyFile/bodyfile/aio/operations/_patch.py | 1 + .../AcceptanceTests/BodyFile/bodyfile/models/_patch.py | 1 + .../AcceptanceTests/BodyFile/bodyfile/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/BodyFile/setup.py | 1 - .../_auto_rest_swagger_bat_form_data_service.py | 7 ++++++- .../AcceptanceTests/BodyFormData/bodyformdata/_patch.py | 1 + .../BodyFormData/bodyformdata/_utils/serialization.py | 6 +++++- .../aio/_auto_rest_swagger_bat_form_data_service.py | 7 ++++++- .../BodyFormData/bodyformdata/aio/_patch.py | 1 + .../BodyFormData/bodyformdata/aio/operations/_patch.py | 1 + .../BodyFormData/bodyformdata/models/_patch.py | 1 + .../BodyFormData/bodyformdata/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/BodyFormData/setup.py | 1 - .../bodyformurlencodeddata/_body_forms_data_url_encoded.py | 7 ++++++- .../bodyformurlencodeddata/_patch.py | 1 + .../bodyformurlencodeddata/_utils/serialization.py | 6 +++++- .../aio/_body_forms_data_url_encoded.py | 7 ++++++- .../bodyformurlencodeddata/aio/_patch.py | 1 + .../bodyformurlencodeddata/aio/operations/_patch.py | 1 + .../bodyformurlencodeddata/models/_patch.py | 1 + .../bodyformurlencodeddata/operations/_patch.py | 1 + .../AcceptanceTests/BodyFormUrlEncodedData/setup.py | 1 - .../bodyinteger/_auto_rest_integer_test_service.py | 7 ++++++- .../AcceptanceTests/BodyInteger/bodyinteger/_patch.py | 1 + .../BodyInteger/bodyinteger/_utils/serialization.py | 6 +++++- .../bodyinteger/aio/_auto_rest_integer_test_service.py | 7 ++++++- .../AcceptanceTests/BodyInteger/bodyinteger/aio/_patch.py | 1 + .../BodyInteger/bodyinteger/aio/operations/_patch.py | 1 + .../BodyInteger/bodyinteger/models/_patch.py | 1 + .../BodyInteger/bodyinteger/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/BodyInteger/setup.py | 1 - .../bodynumber/_auto_rest_number_test_service.py | 7 ++++++- .../AcceptanceTests/BodyNumber/bodynumber/_patch.py | 1 + .../BodyNumber/bodynumber/_utils/serialization.py | 6 +++++- .../bodynumber/aio/_auto_rest_number_test_service.py | 7 ++++++- .../AcceptanceTests/BodyNumber/bodynumber/aio/_patch.py | 1 + .../BodyNumber/bodynumber/aio/operations/_patch.py | 1 + .../AcceptanceTests/BodyNumber/bodynumber/models/_patch.py | 1 + .../BodyNumber/bodynumber/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/BodyNumber/setup.py | 1 - .../bodystring/_auto_rest_swagger_bat_service.py | 7 ++++++- .../BodyString/bodystring/_utils/serialization.py | 6 +++++- .../bodystring/aio/_auto_rest_swagger_bat_service.py | 7 ++++++- .../AcceptanceTests/BodyString/bodystring/aio/_patch.py | 1 + .../BodyString/bodystring/aio/operations/_patch.py | 1 + .../AcceptanceTests/BodyString/bodystring/models/_patch.py | 1 + .../BodyString/bodystring/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/BodyString/setup.py | 1 - .../BodyTime/bodytime/_auto_rest_time_test_service.py | 7 ++++++- .../Expected/AcceptanceTests/BodyTime/bodytime/_patch.py | 1 + .../BodyTime/bodytime/_utils/serialization.py | 6 +++++- .../BodyTime/bodytime/aio/_auto_rest_time_test_service.py | 7 ++++++- .../AcceptanceTests/BodyTime/bodytime/aio/_patch.py | 1 + .../BodyTime/bodytime/aio/operations/_patch.py | 1 + .../AcceptanceTests/BodyTime/bodytime/models/_patch.py | 1 + .../AcceptanceTests/BodyTime/bodytime/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/BodyTime/setup.py | 1 - .../ClientEnum/clientenum/_client_with_enum.py | 7 ++++++- .../AcceptanceTests/ClientEnum/clientenum/_patch.py | 1 + .../ClientEnum/clientenum/_utils/serialization.py | 6 +++++- .../ClientEnum/clientenum/aio/_client_with_enum.py | 7 ++++++- .../AcceptanceTests/ClientEnum/clientenum/aio/_patch.py | 1 + .../ClientEnum/clientenum/aio/operations/_patch.py | 1 + .../AcceptanceTests/ClientEnum/clientenum/models/_patch.py | 1 + .../ClientEnum/clientenum/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/ClientEnum/setup.py | 1 - .../constants/_auto_rest_swagger_constant_service.py | 7 ++++++- .../Expected/AcceptanceTests/Constants/constants/_patch.py | 1 + .../Constants/constants/_utils/serialization.py | 6 +++++- .../constants/aio/_auto_rest_swagger_constant_service.py | 7 ++++++- .../AcceptanceTests/Constants/constants/aio/_patch.py | 1 + .../Constants/constants/aio/operations/_patch.py | 1 + .../AcceptanceTests/Constants/constants/models/_patch.py | 1 + .../Constants/constants/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/Constants/setup.py | 1 - .../_auto_rest_parameterized_host_test_client.py | 7 ++++++- .../AcceptanceTests/CustomBaseUri/custombaseurl/_patch.py | 1 + .../aio/_auto_rest_parameterized_host_test_client.py | 7 ++++++- .../CustomBaseUri/custombaseurl/aio/_patch.py | 1 + .../CustomBaseUri/custombaseurl/aio/operations/_patch.py | 1 + .../CustomBaseUri/custombaseurl/models/_patch.py | 1 + .../CustomBaseUri/custombaseurl/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py | 1 - .../_auto_rest_parameterized_custom_host_test_client.py | 7 ++++++- .../custombaseurlmoreoptions/_patch.py | 1 + .../custombaseurlmoreoptions/_utils/serialization.py | 6 +++++- .../_auto_rest_parameterized_custom_host_test_client.py | 7 ++++++- .../custombaseurlmoreoptions/aio/_patch.py | 1 + .../custombaseurlmoreoptions/aio/operations/_patch.py | 1 + .../custombaseurlmoreoptions/models/_patch.py | 1 + .../custombaseurlmoreoptions/operations/_patch.py | 1 + .../AcceptanceTests/CustomBaseUriMoreOptions/setup.py | 1 - .../errorwithsecrets/_error_with_secrets.py | 7 ++++++- .../ErrorWithSecrets/errorwithsecrets/_patch.py | 1 + .../errorwithsecrets/_utils/serialization.py | 6 +++++- .../errorwithsecrets/aio/_error_with_secrets.py | 7 ++++++- .../ErrorWithSecrets/errorwithsecrets/aio/_patch.py | 1 + .../errorwithsecrets/aio/operations/_patch.py | 1 + .../ErrorWithSecrets/errorwithsecrets/models/_patch.py | 1 + .../ErrorWithSecrets/errorwithsecrets/operations/_patch.py | 1 + .../Expected/AcceptanceTests/ErrorWithSecrets/setup.py | 1 - .../ExtensibleEnums/extensibleenumsswagger/_patch.py | 1 + .../extensibleenumsswagger/_pet_store_inc.py | 7 ++++++- .../extensibleenumsswagger/_utils/serialization.py | 6 +++++- .../ExtensibleEnums/extensibleenumsswagger/aio/_patch.py | 1 + .../extensibleenumsswagger/aio/_pet_store_inc.py | 7 ++++++- .../extensibleenumsswagger/aio/operations/_patch.py | 1 + .../extensibleenumsswagger/models/_patch.py | 1 + .../extensibleenumsswagger/operations/_patch.py | 1 + .../Expected/AcceptanceTests/ExtensibleEnums/setup.py | 1 - .../Header/header/_auto_rest_swagger_bat_header_service.py | 7 ++++++- .../Expected/AcceptanceTests/Header/header/_patch.py | 1 + .../AcceptanceTests/Header/header/_utils/serialization.py | 6 +++++- .../header/aio/_auto_rest_swagger_bat_header_service.py | 7 ++++++- .../Expected/AcceptanceTests/Header/header/aio/_patch.py | 1 + .../AcceptanceTests/Header/header/aio/operations/_patch.py | 1 + .../AcceptanceTests/Header/header/models/_patch.py | 1 + .../AcceptanceTests/Header/header/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/Header/setup.py | 1 - .../_auto_rest_http_infrastructure_test_service.py | 7 ++++++- .../AcceptanceTests/Http/httpinfrastructure/_patch.py | 1 + .../Http/httpinfrastructure/_utils/serialization.py | 6 +++++- .../aio/_auto_rest_http_infrastructure_test_service.py | 7 ++++++- .../AcceptanceTests/Http/httpinfrastructure/aio/_patch.py | 1 + .../Http/httpinfrastructure/aio/operations/_patch.py | 1 + .../Http/httpinfrastructure/models/_patch.py | 1 + .../Http/httpinfrastructure/operations/_patch.py | 1 + .../vanilla/legacy/Expected/AcceptanceTests/Http/setup.py | 1 - .../_incorrect_returned_error_model.py | 7 ++++++- .../incorrecterrorresponse/_patch.py | 1 + .../incorrecterrorresponse/_utils/serialization.py | 6 +++++- .../aio/_incorrect_returned_error_model.py | 7 ++++++- .../incorrecterrorresponse/aio/_patch.py | 1 + .../incorrecterrorresponse/aio/operations/_patch.py | 1 + .../incorrecterrorresponse/models/_patch.py | 1 + .../incorrecterrorresponse/operations/_patch.py | 1 + .../AcceptanceTests/IncorrectErrorResponse/setup.py | 1 - .../internaloperation/_media_types_client.py | 7 ++++++- .../InternalOperation/internaloperation/_patch.py | 1 + .../internaloperation/_utils/serialization.py | 6 +++++- .../internaloperation/aio/_media_types_client.py | 7 ++++++- .../InternalOperation/internaloperation/aio/_patch.py | 1 + .../internaloperation/aio/operations/_patch.py | 1 + .../InternalOperation/internaloperation/models/_patch.py | 1 + .../internaloperation/operations/_patch.py | 1 + .../AcceptanceTests/InternalOperation/pyproject.toml | 3 +-- .../MediaTypes/mediatypes/_media_types_client.py | 7 ++++++- .../AcceptanceTests/MediaTypes/mediatypes/_patch.py | 1 + .../MediaTypes/mediatypes/_utils/serialization.py | 6 +++++- .../MediaTypes/mediatypes/aio/_media_types_client.py | 7 ++++++- .../AcceptanceTests/MediaTypes/mediatypes/aio/_patch.py | 1 + .../MediaTypes/mediatypes/aio/operations/_patch.py | 1 + .../AcceptanceTests/MediaTypes/mediatypes/models/_patch.py | 1 + .../MediaTypes/mediatypes/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/MediaTypes/setup.py | 1 - .../mergepatchjson/_merge_patch_json_client.py | 7 ++++++- .../MergePatchJson/mergepatchjson/_patch.py | 1 + .../MergePatchJson/mergepatchjson/_utils/serialization.py | 6 +++++- .../mergepatchjson/aio/_merge_patch_json_client.py | 7 ++++++- .../MergePatchJson/mergepatchjson/aio/_patch.py | 1 + .../MergePatchJson/mergepatchjson/aio/operations/_patch.py | 1 + .../MergePatchJson/mergepatchjson/operations/_patch.py | 1 + .../Expected/AcceptanceTests/MergePatchJson/setup.py | 1 - .../_auto_rest_resource_flattening_test_service.py | 7 ++++++- .../ModelFlattening/modelflattening/_patch.py | 1 + .../modelflattening/_utils/serialization.py | 6 +++++- .../aio/_auto_rest_resource_flattening_test_service.py | 7 ++++++- .../ModelFlattening/modelflattening/aio/_patch.py | 1 + .../modelflattening/aio/operations/_patch.py | 1 + .../ModelFlattening/modelflattening/models/_patch.py | 1 + .../ModelFlattening/modelflattening/operations/_patch.py | 1 + .../Expected/AcceptanceTests/ModelFlattening/setup.py | 1 - .../_multiple_inheritance_service_client.py | 7 ++++++- .../MultipleInheritance/multipleinheritance/_patch.py | 1 + .../multipleinheritance/_utils/serialization.py | 6 +++++- .../aio/_multiple_inheritance_service_client.py | 7 ++++++- .../MultipleInheritance/multipleinheritance/aio/_patch.py | 1 + .../multipleinheritance/aio/operations/_patch.py | 1 + .../multipleinheritance/models/_patch.py | 1 + .../multipleinheritance/operations/_patch.py | 1 + .../Expected/AcceptanceTests/MultipleInheritance/setup.py | 1 - .../AcceptanceTests/NoOperations/nooperations/_patch.py | 1 + .../NoOperations/nooperations/_utils/serialization.py | 6 +++++- .../NoOperations/nooperations/models/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/NoOperations/setup.py | 1 - .../nonstringenums/_non_string_enums_client.py | 7 ++++++- .../NonStringEnums/nonstringenums/_patch.py | 1 + .../NonStringEnums/nonstringenums/_utils/serialization.py | 6 +++++- .../nonstringenums/aio/_non_string_enums_client.py | 7 ++++++- .../NonStringEnums/nonstringenums/aio/_patch.py | 1 + .../NonStringEnums/nonstringenums/aio/operations/_patch.py | 1 + .../NonStringEnums/nonstringenums/models/_patch.py | 1 + .../NonStringEnums/nonstringenums/operations/_patch.py | 1 + .../Expected/AcceptanceTests/NonStringEnums/setup.py | 1 - .../ObjectType/objecttype/_object_type_client.py | 7 ++++++- .../AcceptanceTests/ObjectType/objecttype/_patch.py | 1 + .../ObjectType/objecttype/_utils/serialization.py | 6 +++++- .../ObjectType/objecttype/aio/_object_type_client.py | 7 ++++++- .../AcceptanceTests/ObjectType/objecttype/aio/_patch.py | 1 + .../ObjectType/objecttype/aio/operations/_patch.py | 1 + .../ObjectType/objecttype/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/ObjectType/setup.py | 1 - .../PackageModeDataPlane/packagemode/_anything_client.py | 7 ++++++- .../PackageModeDataPlane/packagemode/_patch.py | 1 + .../packagemode/_utils/serialization.py | 6 +++++- .../packagemode/aio/_anything_client.py | 7 ++++++- .../PackageModeDataPlane/packagemode/aio/_patch.py | 1 + .../packagemode/aio/operations/_patch.py | 1 + .../PackageModeDataPlane/packagemode/operations/_patch.py | 1 + .../AcceptanceTests/PackageModeDataPlane/pyproject.toml | 3 +-- .../parameterflattening/_auto_rest_parameter_flattening.py | 7 ++++++- .../ParameterFlattening/parameterflattening/_patch.py | 1 + .../parameterflattening/_utils/serialization.py | 6 +++++- .../aio/_auto_rest_parameter_flattening.py | 7 ++++++- .../ParameterFlattening/parameterflattening/aio/_patch.py | 1 + .../parameterflattening/aio/operations/_patch.py | 1 + .../parameterflattening/models/_patch.py | 1 + .../parameterflattening/operations/_patch.py | 1 + .../Expected/AcceptanceTests/ParameterFlattening/setup.py | 1 - .../parameterizedendpoint/_parmaterized_endpoint_client.py | 7 ++++++- .../ParameterizedEndpoint/parameterizedendpoint/_patch.py | 1 + .../parameterizedendpoint/_utils/serialization.py | 6 +++++- .../aio/_parmaterized_endpoint_client.py | 7 ++++++- .../parameterizedendpoint/aio/_patch.py | 1 + .../parameterizedendpoint/aio/operations/_patch.py | 1 + .../parameterizedendpoint/operations/_patch.py | 1 + .../AcceptanceTests/ParameterizedEndpoint/setup.py | 1 - .../Report/report/_auto_rest_report_service.py | 7 ++++++- .../Expected/AcceptanceTests/Report/report/_patch.py | 1 + .../AcceptanceTests/Report/report/_utils/serialization.py | 6 +++++- .../Report/report/aio/_auto_rest_report_service.py | 7 ++++++- .../Expected/AcceptanceTests/Report/report/aio/_patch.py | 1 + .../AcceptanceTests/Report/report/aio/operations/_patch.py | 1 + .../AcceptanceTests/Report/report/models/_patch.py | 1 + .../AcceptanceTests/Report/report/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/Report/setup.py | 1 - .../_auto_rest_required_optional_test_service.py | 7 ++++++- .../RequiredOptional/requiredoptional/_patch.py | 1 + .../aio/_auto_rest_required_optional_test_service.py | 7 ++++++- .../RequiredOptional/requiredoptional/aio/_patch.py | 1 + .../requiredoptional/aio/operations/_patch.py | 1 + .../RequiredOptional/requiredoptional/models/_patch.py | 1 + .../RequiredOptional/requiredoptional/operations/_patch.py | 1 + .../Expected/AcceptanceTests/RequiredOptional/setup.py | 1 - .../AcceptanceTests/ReservedWords/reservedwords/_patch.py | 1 + .../ReservedWords/reservedwords/_reserved_words_client.py | 7 ++++++- .../ReservedWords/reservedwords/_utils/serialization.py | 6 +++++- .../ReservedWords/reservedwords/aio/_patch.py | 1 + .../reservedwords/aio/_reserved_words_client.py | 7 ++++++- .../ReservedWords/reservedwords/aio/operations/_patch.py | 1 + .../ReservedWords/reservedwords/models/_patch.py | 1 + .../ReservedWords/reservedwords/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/ReservedWords/setup.py | 1 - .../securityaadswagger/_autorest_security_aad.py | 7 ++++++- .../SecurityAadSwagger/securityaadswagger/_patch.py | 1 + .../securityaadswagger/_utils/serialization.py | 6 +++++- .../securityaadswagger/aio/_autorest_security_aad.py | 7 ++++++- .../SecurityAadSwagger/securityaadswagger/aio/_patch.py | 1 + .../securityaadswagger/aio/operations/_patch.py | 1 + .../securityaadswagger/operations/_patch.py | 1 + .../Expected/AcceptanceTests/SecurityAadSwagger/setup.py | 1 - .../securityaadswaggercredentialflag/_patch.py | 1 + .../_security_aad_swagger_credential_flag.py | 7 ++++++- .../_utils/serialization.py | 6 +++++- .../securityaadswaggercredentialflag/aio/_patch.py | 1 + .../aio/_security_aad_swagger_credential_flag.py | 7 ++++++- .../aio/operations/_patch.py | 1 + .../securityaadswaggercredentialflag/operations/_patch.py | 1 + .../SecurityAadSwaggerCredentialFlag/setup.py | 1 - .../securitykeyswagger/_autorest_security_key.py | 7 ++++++- .../SecurityKeySwagger/securitykeyswagger/_patch.py | 1 + .../securitykeyswagger/_utils/serialization.py | 6 +++++- .../securitykeyswagger/aio/_autorest_security_key.py | 7 ++++++- .../SecurityKeySwagger/securitykeyswagger/aio/_patch.py | 1 + .../securitykeyswagger/aio/operations/_patch.py | 1 + .../securitykeyswagger/operations/_patch.py | 1 + .../Expected/AcceptanceTests/SecurityKeySwagger/setup.py | 1 - .../securitykeyswaggercredentialflag/_patch.py | 1 + .../_security_key_swagger_credential_flag.py | 7 ++++++- .../_utils/serialization.py | 6 +++++- .../securitykeyswaggercredentialflag/aio/_patch.py | 1 + .../aio/_security_key_swagger_credential_flag.py | 7 ++++++- .../aio/operations/_patch.py | 1 + .../securitykeyswaggercredentialflag/operations/_patch.py | 1 + .../SecurityKeySwaggerCredentialFlag/setup.py | 1 - .../vanilla/legacy/Expected/AcceptanceTests/Url/setup.py | 1 - .../AcceptanceTests/Url/url/_auto_rest_url_test_service.py | 7 ++++++- .../legacy/Expected/AcceptanceTests/Url/url/_patch.py | 1 + .../Url/url/aio/_auto_rest_url_test_service.py | 7 ++++++- .../legacy/Expected/AcceptanceTests/Url/url/aio/_patch.py | 1 + .../AcceptanceTests/Url/url/aio/operations/_patch.py | 1 + .../Expected/AcceptanceTests/Url/url/models/_patch.py | 1 + .../Expected/AcceptanceTests/Url/url/operations/_patch.py | 1 + .../AcceptanceTests/UrlMultiCollectionFormat/setup.py | 1 - .../_auto_rest_url_mutli_collection_format_test_service.py | 7 ++++++- .../urlmulticollectionformat/_patch.py | 1 + .../urlmulticollectionformat/_utils/serialization.py | 6 +++++- .../_auto_rest_url_mutli_collection_format_test_service.py | 7 ++++++- .../urlmulticollectionformat/aio/_patch.py | 1 + .../urlmulticollectionformat/aio/operations/_patch.py | 1 + .../urlmulticollectionformat/models/_patch.py | 1 + .../urlmulticollectionformat/operations/_patch.py | 1 + .../legacy/Expected/AcceptanceTests/Validation/setup.py | 1 - .../Validation/validation/_auto_rest_validation_test.py | 7 ++++++- .../AcceptanceTests/Validation/validation/_patch.py | 1 + .../validation/aio/_auto_rest_validation_test.py | 7 ++++++- .../AcceptanceTests/Validation/validation/aio/_patch.py | 1 + .../Validation/validation/aio/operations/_patch.py | 1 + .../AcceptanceTests/Validation/validation/models/_patch.py | 1 + .../Validation/validation/operations/_patch.py | 1 + .../vanilla/legacy/Expected/AcceptanceTests/Xml/setup.py | 1 - .../Xml/xmlservice/_auto_rest_swagger_batxml_service.py | 7 ++++++- .../Expected/AcceptanceTests/Xml/xmlservice/_patch.py | 1 + .../AcceptanceTests/Xml/xmlservice/_utils/serialization.py | 6 +++++- .../xmlservice/aio/_auto_rest_swagger_batxml_service.py | 7 ++++++- .../Expected/AcceptanceTests/Xml/xmlservice/aio/_patch.py | 1 + .../Xml/xmlservice/aio/operations/_patch.py | 1 + .../AcceptanceTests/Xml/xmlservice/models/_patch.py | 1 + .../AcceptanceTests/Xml/xmlservice/operations/_patch.py | 1 + .../Expected/AcceptanceTests/XmsErrorResponse/setup.py | 1 - .../XmsErrorResponse/xmserrorresponse/_patch.py | 1 + .../xmserrorresponse/_utils/serialization.py | 6 +++++- .../xmserrorresponse/_xms_error_response_extensions.py | 7 ++++++- .../XmsErrorResponse/xmserrorresponse/aio/_patch.py | 1 + .../xmserrorresponse/aio/_xms_error_response_extensions.py | 7 ++++++- .../xmserrorresponse/aio/operations/_patch.py | 1 + .../XmsErrorResponse/xmserrorresponse/models/_patch.py | 1 + .../XmsErrorResponse/xmserrorresponse/operations/_patch.py | 1 + .../AcceptanceTests/asynctests/test_header.py | 2 +- .../AcceptanceTests/asynctests/test_url.py | 4 ++-- .../vanilla/version-tolerant/AcceptanceTests/conftest.py | 1 - .../version-tolerant/AcceptanceTests/test_header.py | 2 +- .../vanilla/version-tolerant/AcceptanceTests/test_url.py | 4 ++-- .../additionalpropertiesversiontolerant/_client.py | 7 ++++++- .../additionalpropertiesversiontolerant/_patch.py | 1 + .../_utils/serialization.py | 6 +++++- .../additionalpropertiesversiontolerant/aio/_client.py | 7 ++++++- .../additionalpropertiesversiontolerant/aio/_patch.py | 1 + .../aio/operations/_patch.py | 1 + .../operations/_patch.py | 1 + .../AdditionalPropertiesVersionTolerant/setup.py | 1 - .../anythingversiontolerant/_client.py | 7 ++++++- .../anythingversiontolerant/_operations/_patch.py | 1 + .../anythingversiontolerant/_patch.py | 1 + .../anythingversiontolerant/_utils/serialization.py | 6 +++++- .../anythingversiontolerant/aio/_client.py | 7 ++++++- .../anythingversiontolerant/aio/_operations/_patch.py | 1 + .../anythingversiontolerant/aio/_patch.py | 1 + .../AcceptanceTests/AnythingVersionTolerant/setup.py | 1 - .../bodyarrayversiontolerant/_client.py | 7 ++++++- .../bodyarrayversiontolerant/_patch.py | 1 + .../bodyarrayversiontolerant/_utils/serialization.py | 6 +++++- .../bodyarrayversiontolerant/aio/_client.py | 7 ++++++- .../bodyarrayversiontolerant/aio/_patch.py | 1 + .../bodyarrayversiontolerant/aio/operations/_patch.py | 1 + .../bodyarrayversiontolerant/operations/_patch.py | 1 + .../AcceptanceTests/BodyArrayVersionTolerant/setup.py | 1 - .../bodybinaryversiontolerant/_client.py | 7 ++++++- .../bodybinaryversiontolerant/_patch.py | 1 + .../bodybinaryversiontolerant/_utils/serialization.py | 6 +++++- .../bodybinaryversiontolerant/aio/_client.py | 7 ++++++- .../bodybinaryversiontolerant/aio/_patch.py | 1 + .../bodybinaryversiontolerant/aio/operations/_patch.py | 1 + .../bodybinaryversiontolerant/operations/_patch.py | 1 + .../AcceptanceTests/BodyBinaryVersionTolerant/setup.py | 1 - .../bodybooleanversiontolerant/_client.py | 7 ++++++- .../bodybooleanversiontolerant/_patch.py | 1 + .../bodybooleanversiontolerant/_utils/serialization.py | 6 +++++- .../bodybooleanversiontolerant/aio/_client.py | 7 ++++++- .../bodybooleanversiontolerant/aio/_patch.py | 1 + .../bodybooleanversiontolerant/aio/operations/_patch.py | 1 + .../bodybooleanversiontolerant/operations/_patch.py | 1 + .../AcceptanceTests/BodyBooleanVersionTolerant/setup.py | 1 - .../bodybyteversiontolerant/_client.py | 7 ++++++- .../bodybyteversiontolerant/_patch.py | 1 + .../bodybyteversiontolerant/_utils/serialization.py | 6 +++++- .../bodybyteversiontolerant/aio/_client.py | 7 ++++++- .../bodybyteversiontolerant/aio/_patch.py | 1 + .../bodybyteversiontolerant/aio/operations/_patch.py | 1 + .../bodybyteversiontolerant/operations/_patch.py | 1 + .../AcceptanceTests/BodyByteVersionTolerant/setup.py | 1 - .../bodycomplexversiontolerant/_client.py | 7 ++++++- .../bodycomplexversiontolerant/_patch.py | 1 + .../bodycomplexversiontolerant/_utils/serialization.py | 6 +++++- .../bodycomplexversiontolerant/aio/_client.py | 7 ++++++- .../bodycomplexversiontolerant/aio/_patch.py | 1 + .../bodycomplexversiontolerant/aio/operations/_patch.py | 1 + .../bodycomplexversiontolerant/operations/_patch.py | 1 + .../AcceptanceTests/BodyComplexVersionTolerant/setup.py | 1 - .../bodydatetimerfc1123versiontolerant/_client.py | 7 ++++++- .../bodydatetimerfc1123versiontolerant/_patch.py | 1 + .../_utils/serialization.py | 6 +++++- .../bodydatetimerfc1123versiontolerant/aio/_client.py | 7 ++++++- .../bodydatetimerfc1123versiontolerant/aio/_patch.py | 1 + .../aio/operations/_patch.py | 1 + .../operations/_patch.py | 1 + .../BodyDateTimeRfc1123VersionTolerant/setup.py | 1 - .../bodydatetimeversiontolerant/_client.py | 7 ++++++- .../bodydatetimeversiontolerant/_patch.py | 1 + .../bodydatetimeversiontolerant/_utils/serialization.py | 6 +++++- .../bodydatetimeversiontolerant/aio/_client.py | 7 ++++++- .../bodydatetimeversiontolerant/aio/_patch.py | 1 + .../bodydatetimeversiontolerant/aio/operations/_patch.py | 1 + .../bodydatetimeversiontolerant/operations/_patch.py | 1 + .../AcceptanceTests/BodyDateTimeVersionTolerant/setup.py | 1 - .../bodydateversiontolerant/_client.py | 7 ++++++- .../bodydateversiontolerant/_patch.py | 1 + .../bodydateversiontolerant/_utils/serialization.py | 6 +++++- .../bodydateversiontolerant/aio/_client.py | 7 ++++++- .../bodydateversiontolerant/aio/_patch.py | 1 + .../bodydateversiontolerant/aio/operations/_patch.py | 1 + .../bodydateversiontolerant/operations/_patch.py | 1 + .../AcceptanceTests/BodyDateVersionTolerant/setup.py | 1 - .../bodydictionaryversiontolerant/_client.py | 7 ++++++- .../bodydictionaryversiontolerant/_patch.py | 1 + .../bodydictionaryversiontolerant/_utils/serialization.py | 6 +++++- .../bodydictionaryversiontolerant/aio/_client.py | 7 ++++++- .../bodydictionaryversiontolerant/aio/_patch.py | 1 + .../bodydictionaryversiontolerant/aio/operations/_patch.py | 1 + .../bodydictionaryversiontolerant/operations/_patch.py | 1 + .../AcceptanceTests/BodyDictionaryVersionTolerant/setup.py | 1 - .../bodydurationversiontolerant/_client.py | 7 ++++++- .../bodydurationversiontolerant/_patch.py | 1 + .../bodydurationversiontolerant/_utils/serialization.py | 6 +++++- .../bodydurationversiontolerant/aio/_client.py | 7 ++++++- .../bodydurationversiontolerant/aio/_patch.py | 1 + .../bodydurationversiontolerant/aio/operations/_patch.py | 1 + .../bodydurationversiontolerant/operations/_patch.py | 1 + .../AcceptanceTests/BodyDurationVersionTolerant/setup.py | 1 - .../bodyfileversiontolerant/_client.py | 7 ++++++- .../bodyfileversiontolerant/_patch.py | 1 + .../bodyfileversiontolerant/_utils/serialization.py | 6 +++++- .../bodyfileversiontolerant/aio/_client.py | 7 ++++++- .../bodyfileversiontolerant/aio/_patch.py | 1 + .../bodyfileversiontolerant/aio/operations/_patch.py | 1 + .../bodyfileversiontolerant/operations/_patch.py | 1 + .../AcceptanceTests/BodyFileVersionTolerant/setup.py | 1 - .../bodyformdataversiontolerant/_client.py | 7 ++++++- .../bodyformdataversiontolerant/_patch.py | 1 + .../bodyformdataversiontolerant/_utils/serialization.py | 6 +++++- .../bodyformdataversiontolerant/aio/_client.py | 7 ++++++- .../bodyformdataversiontolerant/aio/_patch.py | 1 + .../bodyformdataversiontolerant/aio/operations/_patch.py | 1 + .../bodyformdataversiontolerant/operations/_patch.py | 1 + .../AcceptanceTests/BodyFormDataVersionTolerant/setup.py | 1 - .../bodyformurlencodeddataversiontolerant/_client.py | 7 ++++++- .../bodyformurlencodeddataversiontolerant/_patch.py | 1 + .../_utils/serialization.py | 6 +++++- .../bodyformurlencodeddataversiontolerant/aio/_client.py | 7 ++++++- .../bodyformurlencodeddataversiontolerant/aio/_patch.py | 1 + .../aio/operations/_patch.py | 1 + .../operations/_patch.py | 1 + .../BodyFormUrlEncodedDataVersionTolerant/setup.py | 1 - .../bodyintegerversiontolerant/_client.py | 7 ++++++- .../bodyintegerversiontolerant/_patch.py | 1 + .../bodyintegerversiontolerant/_utils/serialization.py | 6 +++++- .../bodyintegerversiontolerant/aio/_client.py | 7 ++++++- .../bodyintegerversiontolerant/aio/_patch.py | 1 + .../bodyintegerversiontolerant/aio/operations/_patch.py | 1 + .../bodyintegerversiontolerant/operations/_patch.py | 1 + .../AcceptanceTests/BodyIntegerVersionTolerant/setup.py | 1 - .../bodynumberversiontolerant/_client.py | 7 ++++++- .../bodynumberversiontolerant/_patch.py | 1 + .../bodynumberversiontolerant/_utils/serialization.py | 6 +++++- .../bodynumberversiontolerant/aio/_client.py | 7 ++++++- .../bodynumberversiontolerant/aio/_patch.py | 1 + .../bodynumberversiontolerant/aio/operations/_patch.py | 1 + .../bodynumberversiontolerant/operations/_patch.py | 1 + .../AcceptanceTests/BodyNumberVersionTolerant/setup.py | 1 - .../bodystringversiontolerant/_client.py | 7 ++++++- .../bodystringversiontolerant/_patch.py | 1 + .../bodystringversiontolerant/_utils/serialization.py | 6 +++++- .../bodystringversiontolerant/aio/_client.py | 7 ++++++- .../bodystringversiontolerant/aio/_patch.py | 1 + .../bodystringversiontolerant/aio/operations/_patch.py | 1 + .../bodystringversiontolerant/operations/_patch.py | 1 + .../AcceptanceTests/BodyStringVersionTolerant/setup.py | 1 - .../bodytimeversiontolerant/_client.py | 7 ++++++- .../bodytimeversiontolerant/_patch.py | 1 + .../bodytimeversiontolerant/_utils/serialization.py | 6 +++++- .../bodytimeversiontolerant/aio/_client.py | 7 ++++++- .../bodytimeversiontolerant/aio/_patch.py | 1 + .../bodytimeversiontolerant/aio/operations/_patch.py | 1 + .../bodytimeversiontolerant/operations/_patch.py | 1 + .../AcceptanceTests/BodyTimeVersionTolerant/setup.py | 1 - .../clientenumversiontolerant/_client.py | 7 ++++++- .../clientenumversiontolerant/_operations/_patch.py | 1 + .../clientenumversiontolerant/_patch.py | 1 + .../clientenumversiontolerant/_utils/serialization.py | 6 +++++- .../clientenumversiontolerant/aio/_client.py | 7 ++++++- .../clientenumversiontolerant/aio/_operations/_patch.py | 1 + .../clientenumversiontolerant/aio/_patch.py | 1 + .../clientenumversiontolerant/models/_patch.py | 1 + .../AcceptanceTests/ClientEnumVersionTolerant/setup.py | 1 - .../constantsversiontolerant/_client.py | 7 ++++++- .../constantsversiontolerant/_patch.py | 1 + .../constantsversiontolerant/_utils/serialization.py | 6 +++++- .../constantsversiontolerant/aio/_client.py | 7 ++++++- .../constantsversiontolerant/aio/_patch.py | 1 + .../constantsversiontolerant/aio/operations/_patch.py | 1 + .../constantsversiontolerant/operations/_patch.py | 1 + .../AcceptanceTests/ConstantsVersionTolerant/setup.py | 1 - .../custombaseurlmoreoptionsversiontolerant/_client.py | 7 ++++++- .../custombaseurlmoreoptionsversiontolerant/_patch.py | 1 + .../_utils/serialization.py | 6 +++++- .../custombaseurlmoreoptionsversiontolerant/aio/_client.py | 7 ++++++- .../custombaseurlmoreoptionsversiontolerant/aio/_patch.py | 1 + .../aio/operations/_patch.py | 1 + .../operations/_patch.py | 1 + .../CustomBaseUriMoreOptionsVersionTolerant/setup.py | 1 - .../custombaseurlversiontolerant/_client.py | 7 ++++++- .../custombaseurlversiontolerant/_patch.py | 1 + .../custombaseurlversiontolerant/_utils/serialization.py | 6 +++++- .../custombaseurlversiontolerant/aio/_client.py | 7 ++++++- .../custombaseurlversiontolerant/aio/_patch.py | 1 + .../custombaseurlversiontolerant/aio/operations/_patch.py | 1 + .../custombaseurlversiontolerant/operations/_patch.py | 1 + .../AcceptanceTests/CustomBaseUriVersionTolerant/setup.py | 1 - .../errorwithsecretsversiontolerant/_client.py | 7 ++++++- .../errorwithsecretsversiontolerant/_operations/_patch.py | 1 + .../errorwithsecretsversiontolerant/_patch.py | 1 + .../_utils/serialization.py | 6 +++++- .../errorwithsecretsversiontolerant/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 + .../errorwithsecretsversiontolerant/aio/_patch.py | 1 + .../ErrorWithSecretsVersionTolerant/setup.py | 1 - .../extensibleenumsswaggerversiontolerant/_client.py | 7 ++++++- .../extensibleenumsswaggerversiontolerant/_patch.py | 1 + .../_utils/serialization.py | 6 +++++- .../extensibleenumsswaggerversiontolerant/aio/_client.py | 7 ++++++- .../extensibleenumsswaggerversiontolerant/aio/_patch.py | 1 + .../aio/operations/_patch.py | 1 + .../operations/_patch.py | 1 + .../ExtensibleEnumsVersionTolerant/setup.py | 1 - .../HeaderVersionTolerant/headerversiontolerant/_client.py | 7 ++++++- .../HeaderVersionTolerant/headerversiontolerant/_patch.py | 1 + .../headerversiontolerant/_utils/serialization.py | 6 +++++- .../headerversiontolerant/aio/_client.py | 7 ++++++- .../headerversiontolerant/aio/_patch.py | 1 + .../headerversiontolerant/aio/operations/_patch.py | 1 + .../headerversiontolerant/operations/_patch.py | 1 + .../AcceptanceTests/HeaderVersionTolerant/setup.py | 1 - .../httpinfrastructureversiontolerant/_client.py | 7 ++++++- .../httpinfrastructureversiontolerant/_patch.py | 1 + .../_utils/serialization.py | 6 +++++- .../httpinfrastructureversiontolerant/aio/_client.py | 7 ++++++- .../httpinfrastructureversiontolerant/aio/_patch.py | 1 + .../aio/operations/_patch.py | 1 + .../httpinfrastructureversiontolerant/operations/_patch.py | 1 + .../Expected/AcceptanceTests/HttpVersionTolerant/setup.py | 1 - .../incorrecterrorresponseversiontolerant/_client.py | 7 ++++++- .../_operations/_patch.py | 1 + .../incorrecterrorresponseversiontolerant/_patch.py | 1 + .../_utils/serialization.py | 6 +++++- .../incorrecterrorresponseversiontolerant/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 + .../incorrecterrorresponseversiontolerant/aio/_patch.py | 1 + .../IncorrectErrorResponseVersionTolerant/setup.py | 1 - .../mediatypesversiontolerant/_client.py | 7 ++++++- .../mediatypesversiontolerant/_operations/_patch.py | 1 + .../mediatypesversiontolerant/_patch.py | 1 + .../mediatypesversiontolerant/_utils/serialization.py | 6 +++++- .../mediatypesversiontolerant/aio/_client.py | 7 ++++++- .../mediatypesversiontolerant/aio/_operations/_patch.py | 1 + .../mediatypesversiontolerant/aio/_patch.py | 1 + .../AcceptanceTests/MediaTypesVersionTolerant/setup.py | 1 - .../mergepatchjsonversiontolerant/_client.py | 7 ++++++- .../mergepatchjsonversiontolerant/_operations/_patch.py | 1 + .../mergepatchjsonversiontolerant/_patch.py | 1 + .../mergepatchjsonversiontolerant/_utils/serialization.py | 6 +++++- .../mergepatchjsonversiontolerant/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 + .../mergepatchjsonversiontolerant/aio/_patch.py | 1 + .../AcceptanceTests/MergePatchJsonVersionTolerant/setup.py | 1 - .../modelflatteningversiontolerant/_client.py | 7 ++++++- .../modelflatteningversiontolerant/_operations/_patch.py | 1 + .../modelflatteningversiontolerant/_patch.py | 1 + .../modelflatteningversiontolerant/_utils/serialization.py | 6 +++++- .../modelflatteningversiontolerant/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 + .../modelflatteningversiontolerant/aio/_patch.py | 1 + .../ModelFlatteningVersionTolerant/setup.py | 1 - .../multipleinheritanceversiontolerant/_client.py | 7 ++++++- .../_operations/_patch.py | 1 - .../multipleinheritanceversiontolerant/_patch.py | 1 - .../_utils/serialization.py | 6 +++++- .../multipleinheritanceversiontolerant/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 - .../multipleinheritanceversiontolerant/aio/_patch.py | 1 - .../MultipleInheritanceVersionTolerant/setup.py | 1 - .../anything_client/_client.py | 7 ++++++- .../anything_client/_operations/_patch.py | 1 + .../anything_client/_patch.py | 1 + .../anything_client/_utils/serialization.py | 6 +++++- .../anything_client/aio/_client.py | 7 ++++++- .../anything_client/aio/_operations/_patch.py | 1 + .../anything_client/aio/_patch.py | 1 + .../NoNamespaceFlagVersionTolerant/setup.py | 1 - .../nooperationsversiontolerant/_patch.py | 1 + .../nooperationsversiontolerant/_utils/serialization.py | 6 +++++- .../AcceptanceTests/NoOperationsVersionTolerant/setup.py | 1 - .../nonstringenumsversiontolerant/_client.py | 7 ++++++- .../nonstringenumsversiontolerant/_patch.py | 1 - .../nonstringenumsversiontolerant/_utils/serialization.py | 6 +++++- .../nonstringenumsversiontolerant/aio/_client.py | 7 ++++++- .../nonstringenumsversiontolerant/aio/_patch.py | 1 - .../nonstringenumsversiontolerant/aio/operations/_patch.py | 1 - .../nonstringenumsversiontolerant/operations/_patch.py | 1 - .../AcceptanceTests/NonStringEnumsVersionTolerant/setup.py | 1 - .../objecttypeversiontolerant/_client.py | 7 ++++++- .../objecttypeversiontolerant/_operations/_patch.py | 1 + .../objecttypeversiontolerant/_patch.py | 1 + .../objecttypeversiontolerant/_utils/serialization.py | 6 +++++- .../objecttypeversiontolerant/aio/_client.py | 7 ++++++- .../objecttypeversiontolerant/aio/_operations/_patch.py | 1 + .../objecttypeversiontolerant/aio/_patch.py | 1 + .../AcceptanceTests/ObjectTypeVersionTolerant/setup.py | 1 - .../parameterflatteningversiontolerant/_client.py | 7 ++++++- .../parameterflatteningversiontolerant/_patch.py | 1 + .../_utils/serialization.py | 6 +++++- .../parameterflatteningversiontolerant/aio/_client.py | 7 ++++++- .../parameterflatteningversiontolerant/aio/_patch.py | 1 + .../aio/operations/_patch.py | 1 + .../operations/_patch.py | 1 + .../ParameterFlatteningVersionTolerant/setup.py | 1 - .../parameterizedendpointversiontolerant/_client.py | 7 ++++++- .../_operations/_patch.py | 1 + .../parameterizedendpointversiontolerant/_patch.py | 1 + .../_utils/serialization.py | 6 +++++- .../parameterizedendpointversiontolerant/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 + .../parameterizedendpointversiontolerant/aio/_patch.py | 1 + .../ParameterizedEndpointVersionTolerant/setup.py | 1 - .../ReportVersionTolerant/reportversiontolerant/_client.py | 7 ++++++- .../reportversiontolerant/_operations/_patch.py | 1 + .../ReportVersionTolerant/reportversiontolerant/_patch.py | 1 + .../reportversiontolerant/_utils/serialization.py | 6 +++++- .../reportversiontolerant/aio/_client.py | 7 ++++++- .../reportversiontolerant/aio/_operations/_patch.py | 1 + .../reportversiontolerant/aio/_patch.py | 1 + .../AcceptanceTests/ReportVersionTolerant/setup.py | 1 - .../requiredoptionalversiontolerant/_client.py | 7 ++++++- .../requiredoptionalversiontolerant/_patch.py | 1 + .../_utils/serialization.py | 6 +++++- .../requiredoptionalversiontolerant/aio/_client.py | 7 ++++++- .../requiredoptionalversiontolerant/aio/_patch.py | 1 + .../aio/operations/_patch.py | 1 + .../requiredoptionalversiontolerant/operations/_patch.py | 1 + .../RequiredOptionalVersionTolerant/setup.py | 1 - .../reservedwordsversiontolerant/_client.py | 7 ++++++- .../reservedwordsversiontolerant/_patch.py | 1 + .../reservedwordsversiontolerant/_utils/serialization.py | 6 +++++- .../reservedwordsversiontolerant/aio/_client.py | 7 ++++++- .../reservedwordsversiontolerant/aio/_patch.py | 1 + .../reservedwordsversiontolerant/aio/operations/_patch.py | 1 + .../reservedwordsversiontolerant/operations/_patch.py | 1 + .../AcceptanceTests/ReservedWordsVersionTolerant/setup.py | 1 - .../securityaadswaggerversiontolerant/_client.py | 7 ++++++- .../_operations/_patch.py | 1 + .../securityaadswaggerversiontolerant/_patch.py | 1 + .../_utils/serialization.py | 6 +++++- .../securityaadswaggerversiontolerant/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 + .../securityaadswaggerversiontolerant/aio/_patch.py | 1 + .../SecurityAadSwaggerVersionTolerant/setup.py | 1 - .../securitykeyswaggerversiontolerant/_client.py | 7 ++++++- .../_operations/_patch.py | 1 + .../securitykeyswaggerversiontolerant/_patch.py | 1 + .../_utils/serialization.py | 6 +++++- .../securitykeyswaggerversiontolerant/aio/_client.py | 7 ++++++- .../aio/_operations/_patch.py | 1 + .../securitykeyswaggerversiontolerant/aio/_patch.py | 1 + .../SecurityKeySwaggerVersionTolerant/setup.py | 1 - .../UrlMultiCollectionFormatVersionTolerant/setup.py | 1 - .../urlmulticollectionformatversiontolerant/_client.py | 7 ++++++- .../urlmulticollectionformatversiontolerant/_patch.py | 1 + .../_utils/serialization.py | 6 +++++- .../urlmulticollectionformatversiontolerant/aio/_client.py | 7 ++++++- .../urlmulticollectionformatversiontolerant/aio/_patch.py | 1 + .../aio/operations/_patch.py | 1 + .../operations/_patch.py | 1 + .../Expected/AcceptanceTests/UrlVersionTolerant/setup.py | 1 - .../UrlVersionTolerant/urlversiontolerant/_client.py | 7 ++++++- .../UrlVersionTolerant/urlversiontolerant/_patch.py | 1 + .../urlversiontolerant/_utils/serialization.py | 6 +++++- .../UrlVersionTolerant/urlversiontolerant/aio/_client.py | 7 ++++++- .../UrlVersionTolerant/urlversiontolerant/aio/_patch.py | 1 + .../urlversiontolerant/aio/operations/_patch.py | 1 + .../urlversiontolerant/operations/_patch.py | 1 + .../AcceptanceTests/ValidationVersionTolerant/setup.py | 1 - .../validationversiontolerant/_client.py | 7 ++++++- .../validationversiontolerant/_operations/_patch.py | 1 + .../validationversiontolerant/_patch.py | 1 + .../validationversiontolerant/_utils/serialization.py | 6 +++++- .../validationversiontolerant/aio/_client.py | 7 ++++++- .../validationversiontolerant/aio/_operations/_patch.py | 1 + .../validationversiontolerant/aio/_patch.py | 1 + .../Expected/AcceptanceTests/XmlVersionTolerant/setup.py | 1 - .../xmlserviceversiontolerant/_client.py | 7 ++++++- .../XmlVersionTolerant/xmlserviceversiontolerant/_patch.py | 1 + .../xmlserviceversiontolerant/_utils/serialization.py | 6 +++++- .../xmlserviceversiontolerant/aio/_client.py | 7 ++++++- .../xmlserviceversiontolerant/aio/_patch.py | 1 + .../xmlserviceversiontolerant/aio/operations/_patch.py | 1 + .../xmlserviceversiontolerant/models/_patch.py | 1 + .../xmlserviceversiontolerant/operations/_patch.py | 1 + .../XmsErrorResponseVersionTolerant/setup.py | 1 - .../xmserrorresponseversiontolerant/_client.py | 7 ++++++- .../xmserrorresponseversiontolerant/_patch.py | 1 + .../_utils/serialization.py | 6 +++++- .../xmserrorresponseversiontolerant/aio/_client.py | 7 ++++++- .../xmserrorresponseversiontolerant/aio/_patch.py | 1 + .../aio/operations/_patch.py | 1 + .../xmserrorresponseversiontolerant/operations/_patch.py | 1 + 1277 files changed, 3181 insertions(+), 637 deletions(-) diff --git a/packages/autorest.python/autorest/__init__.py b/packages/autorest.python/autorest/__init__.py index b71e984d4a..6e0890e4a0 100644 --- a/packages/autorest.python/autorest/__init__.py +++ b/packages/autorest.python/autorest/__init__.py @@ -13,7 +13,6 @@ from pygen import ReaderAndWriter, Plugin, YamlUpdatePlugin, OptionsDict from .jsonrpc import AutorestAPI - _LOGGER = logging.getLogger(__name__) diff --git a/packages/autorest.python/autorest/codegen.py b/packages/autorest.python/autorest/codegen.py index 44491bda99..d34ab9df23 100644 --- a/packages/autorest.python/autorest/codegen.py +++ b/packages/autorest.python/autorest/codegen.py @@ -16,7 +16,6 @@ from .jsonrpc import AutorestAPI from . import PluginAutorest - _LOGGER = logging.getLogger(__name__) diff --git a/packages/autorest.python/autorest/jsonrpc/localapi.py b/packages/autorest.python/autorest/jsonrpc/localapi.py index e3b990233d..5bed10228f 100644 --- a/packages/autorest.python/autorest/jsonrpc/localapi.py +++ b/packages/autorest.python/autorest/jsonrpc/localapi.py @@ -9,7 +9,6 @@ from . import AutorestAPI, Channel - _LOGGER = logging.getLogger(__name__) diff --git a/packages/autorest.python/autorest/jsonrpc/server.py b/packages/autorest.python/autorest/jsonrpc/server.py index 1f4b5e58f1..c250165444 100644 --- a/packages/autorest.python/autorest/jsonrpc/server.py +++ b/packages/autorest.python/autorest/jsonrpc/server.py @@ -14,7 +14,6 @@ from .stdstream import read_message, write_message - _LOGGER = logging.getLogger(__name__) diff --git a/packages/autorest.python/autorest/jsonrpc/stdstream.py b/packages/autorest.python/autorest/jsonrpc/stdstream.py index 0fe3f02c69..440b5aa566 100644 --- a/packages/autorest.python/autorest/jsonrpc/stdstream.py +++ b/packages/autorest.python/autorest/jsonrpc/stdstream.py @@ -14,7 +14,6 @@ from . import AutorestAPI, Channel - _LOGGER = logging.getLogger(__name__) diff --git a/packages/autorest.python/autorest/m2r.py b/packages/autorest.python/autorest/m2r.py index c65134bdf8..576093aca5 100644 --- a/packages/autorest.python/autorest/m2r.py +++ b/packages/autorest.python/autorest/m2r.py @@ -4,6 +4,7 @@ # license information. # -------------------------------------------------------------------------- """An autorest MD to RST plugin.""" + import logging from typing import Any, Dict, Set, Union @@ -12,7 +13,6 @@ from . import YamlUpdatePluginAutorest - _LOGGER = logging.getLogger(__name__) diff --git a/packages/autorest.python/autorest/m4reformatter/__init__.py b/packages/autorest.python/autorest/m4reformatter/__init__.py index e51865b373..9f3a6a11ae 100644 --- a/packages/autorest.python/autorest/m4reformatter/__init__.py +++ b/packages/autorest.python/autorest/m4reformatter/__init__.py @@ -5,6 +5,7 @@ # license information. # -------------------------------------------------------------------------- """The modelerfour reformatter autorest plugin.""" + import re import copy import logging @@ -19,7 +20,6 @@ ) from .. import YamlUpdatePluginAutorest - ORIGINAL_ID_TO_UPDATED_TYPE: Dict[int, Dict[str, Any]] = {} OAUTH_TYPE = "OAuth2" KEY_TYPE = "Key" diff --git a/packages/autorest.python/autorest/preprocess.py b/packages/autorest.python/autorest/preprocess.py index 015a24d2af..a11c27d268 100644 --- a/packages/autorest.python/autorest/preprocess.py +++ b/packages/autorest.python/autorest/preprocess.py @@ -4,6 +4,7 @@ # license information. # -------------------------------------------------------------------------- """The preprocessing autorest plugin.""" + from typing import Dict, Any from pygen.preprocess import PreProcessPlugin from . import YamlUpdatePluginAutorest diff --git a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/_patch.py b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/_patch.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/_pyproject_mgmt_client.py b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/_pyproject_mgmt_client.py index b27694f1f1..64c589a920 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/_pyproject_mgmt_client.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/_pyproject_mgmt_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HttpSuccessOperations, Operations, SelfDefineOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/_utils/serialization.py b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/_utils/serialization.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/aio/_patch.py b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/aio/_patch.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/aio/_pyproject_mgmt_client.py b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/aio/_pyproject_mgmt_client.py index 32866d55e4..ac5bd83957 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/aio/_pyproject_mgmt_client.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/aio/_pyproject_mgmt_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import PyprojectMgmtClientConfiguration from .operations import HttpSuccessOperations, Operations, SelfDefineOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/aio/operations/_patch.py b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/aio/operations/_patch.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/operations/_patch.py b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/operations/_patch.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/pyproject.toml b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/pyproject.toml index 70c4451697..8abde5a327 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/pyproject.toml +++ b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_auto_rest_head_test_service.py b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_auto_rest_head_test_service.py index a6ef89375d..63cfe6af28 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_auto_rest_head_test_service.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_patch.py b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_patch.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_utils/serialization.py b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_utils/serialization.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/_auto_rest_head_test_service.py b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/_auto_rest_head_test_service.py index 2d3478de43..810364e863 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/_auto_rest_head_test_service.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import AutoRestHeadTestServiceConfiguration from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/_patch.py b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/_patch.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/operations/_patch.py b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/operations/_patch.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/operations/_patch.py b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/operations/_patch.py index 8bcb627aa4..b6400f50d7 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/operations/_patch.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/setup.py b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/setup.py index f84d55c6a2..b71e7f1dac 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/setup.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/setup.py @@ -11,7 +11,6 @@ import re from setuptools import setup, find_packages - PACKAGE_NAME = "azure-mgmt-test" PACKAGE_PPRINT_NAME = "Test Management" @@ -42,7 +41,6 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", @@ -67,5 +65,5 @@ "azure-mgmt-core>=1.6.0", "typing-extensions>=4.6.0", ], - python_requires=">=3.9", + python_requires=">=3.10", ) diff --git a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/_client.py b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/_client.py index 3e25925425..afa5449b4f 100644 --- a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/_client.py +++ b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ArrayOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATArrayService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/_patch.py b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/_patch.py +++ b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/_utils/serialization.py b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/_utils/serialization.py +++ b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/aio/_client.py b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/aio/_client.py index 804ba362ed..1b0fbe3088 100644 --- a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/aio/_client.py +++ b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestSwaggerBATArrayServiceConfiguration from .operations import ArrayOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATArrayService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/aio/_patch.py b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/aio/_patch.py +++ b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/aio/operations/_patch.py b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/aio/operations/_patch.py +++ b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/models/_patch.py b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/models/_patch.py +++ b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/operations/_patch.py b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/operations/_patch.py +++ b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_client.py b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_client.py index 7289074a3f..fbcf69b2e9 100644 --- a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_client.py +++ b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestHeadTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_patch.py b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_patch.py +++ b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_utils/serialization.py b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_utils/serialization.py +++ b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/_client.py b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/_client.py index 4c393c268b..aba04c2560 100644 --- a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/_client.py +++ b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._configuration import AutoRestHeadTestServiceConfiguration from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestHeadTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/_patch.py b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/_patch.py +++ b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/operations/_patch.py b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/operations/_patch.py +++ b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/operations/_patch.py b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/operations/_patch.py +++ b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure_key_credential/generated/setup.py b/packages/autorest.python/samples/specification/azure_key_credential/generated/setup.py index d6e4e96b8f..cb7577b5b7 100644 --- a/packages/autorest.python/samples/specification/azure_key_credential/generated/setup.py +++ b/packages/autorest.python/samples/specification/azure_key_credential/generated/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "azure-key-credential-sample" version = "0.1.0" diff --git a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/_client.py b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/_client.py index e3a605b5b7..c770cd01de 100644 --- a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/_client.py +++ b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestHeadTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/_patch.py b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/_patch.py +++ b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/_utils/serialization.py b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/_utils/serialization.py +++ b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/_client.py b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/_client.py index 35b5e4a9c9..4d6fd53443 100644 --- a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/_client.py +++ b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestHeadTestServiceConfiguration from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestHeadTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/_patch.py b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/_patch.py +++ b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/operations/_patch.py b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/operations/_patch.py +++ b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/operations/_patch.py b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/operations/_patch.py +++ b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/basic/generated/setup.py b/packages/autorest.python/samples/specification/basic/generated/setup.py index 597610ab53..2a0b62343c 100644 --- a/packages/autorest.python/samples/specification/basic/generated/setup.py +++ b/packages/autorest.python/samples/specification/basic/generated/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "azure-basic-sample" version = "0.1.0" diff --git a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_client.py b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_client.py index 2419c98e18..b40fefeb01 100644 --- a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_client.py +++ b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _PollingPagingExampleOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PollingPagingExample(_PollingPagingExampleOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Show polling and paging generation. diff --git a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_operations/_patch.py b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_operations/_patch.py +++ b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_patch.py b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_patch.py +++ b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_utils/serialization.py b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_utils/serialization.py +++ b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_client.py b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_client.py index 3a08c9ade7..e9350bc044 100644 --- a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_client.py +++ b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import PollingPagingExampleConfiguration from ._operations import _PollingPagingExampleOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PollingPagingExample(_PollingPagingExampleOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Show polling and paging generation. diff --git a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_operations/_patch.py b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_operations/_patch.py +++ b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_patch.py b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_patch.py +++ b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/directives/generated/setup.py b/packages/autorest.python/samples/specification/directives/generated/setup.py index 4ac09a3c1c..20c122573f 100644 --- a/packages/autorest.python/samples/specification/directives/generated/setup.py +++ b/packages/autorest.python/samples/specification/directives/generated/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "azure-directives-sample" version = "0.1.0" diff --git a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/_auto_rest_head_test_service.py b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/_auto_rest_head_test_service.py index 38d921db51..be5e23de46 100644 --- a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/_auto_rest_head_test_service.py +++ b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/_patch.py b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/_patch.py +++ b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/_utils/serialization.py b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/_utils/serialization.py +++ b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/_auto_rest_head_test_service.py b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/_auto_rest_head_test_service.py index 71a0077054..75257a3126 100644 --- a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/_auto_rest_head_test_service.py +++ b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import AutoRestHeadTestServiceConfiguration from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/_patch.py b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/_patch.py +++ b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/operations/_patch.py b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/operations/_patch.py +++ b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/operations/_patch.py b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/operations/_patch.py +++ b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/management/generated/setup.py b/packages/autorest.python/samples/specification/management/generated/setup.py index 2af2af850d..bfea5fb2e3 100644 --- a/packages/autorest.python/samples/specification/management/generated/setup.py +++ b/packages/autorest.python/samples/specification/management/generated/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "azure-mgmt-sample" version = "0.1.0" diff --git a/packages/autorest.python/scripts/venvtools.py b/packages/autorest.python/scripts/venvtools.py index 3b9eb69474..df1388e625 100644 --- a/packages/autorest.python/scripts/venvtools.py +++ b/packages/autorest.python/scripts/venvtools.py @@ -10,7 +10,6 @@ import sys from pathlib import Path - _ROOT_DIR = Path(__file__).parent.parent diff --git a/packages/autorest.python/setup.py b/packages/autorest.python/setup.py index 4552703485..7247beea66 100644 --- a/packages/autorest.python/setup.py +++ b/packages/autorest.python/setup.py @@ -12,7 +12,6 @@ from setuptools import setup, find_packages - # Version extraction inspired from 'requests' with open(os.path.join("autorest", "_version.py"), "r") as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) diff --git a/packages/autorest.python/test/azure/legacy/AcceptanceTests/asynctests/test_lro.py b/packages/autorest.python/test/azure/legacy/AcceptanceTests/asynctests/test_lro.py index 183605582e..505505e370 100644 --- a/packages/autorest.python/test/azure/legacy/AcceptanceTests/asynctests/test_lro.py +++ b/packages/autorest.python/test/azure/legacy/AcceptanceTests/asynctests/test_lro.py @@ -45,7 +45,6 @@ from lro.aio import AutoRestLongRunningOperationTestService from lro.models import * # pylint: disable=W0614 - try: from urlparse import urlparse except ImportError: diff --git a/packages/autorest.python/test/azure/legacy/AcceptanceTests/conftest.py b/packages/autorest.python/test/azure/legacy/AcceptanceTests/conftest.py index 6b2ca89b0c..b77cbc5999 100644 --- a/packages/autorest.python/test/azure/legacy/AcceptanceTests/conftest.py +++ b/packages/autorest.python/test/azure/legacy/AcceptanceTests/conftest.py @@ -35,7 +35,6 @@ import pytest - cwd = dirname(realpath(__file__)) diff --git a/packages/autorest.python/test/azure/legacy/AcceptanceTests/test_lro.py b/packages/autorest.python/test/azure/legacy/AcceptanceTests/test_lro.py index 2cbb5dda96..08c27eacf3 100644 --- a/packages/autorest.python/test/azure/legacy/AcceptanceTests/test_lro.py +++ b/packages/autorest.python/test/azure/legacy/AcceptanceTests/test_lro.py @@ -44,7 +44,6 @@ from lro import AutoRestLongRunningOperationTestService from lro.models import * # pylint: disable=W0614 - try: from urlparse import urlparse except ImportError: diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_auto_rest_duration_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_auto_rest_duration_test_service.py index 99afed4252..2b6c32d560 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_auto_rest_duration_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_auto_rest_duration_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DurationOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDurationTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/_auto_rest_duration_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/_auto_rest_duration_test_service.py index b6145cdcad..309e576bf8 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/_auto_rest_duration_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/_auto_rest_duration_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestDurationTestServiceConfiguration from .operations import DurationOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDurationTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/models/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/setup.py index 3902fbc600..f721aeacf6 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestdurationtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_auto_rest_parameter_grouping_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_auto_rest_parameter_grouping_test_service.py index 483b773001..460ebcd625 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_auto_rest_parameter_grouping_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_auto_rest_parameter_grouping_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -20,6 +20,11 @@ from ._configuration import AutoRestParameterGroupingTestServiceConfiguration from .operations import ParameterGroupingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterGroupingTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/_auto_rest_parameter_grouping_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/_auto_rest_parameter_grouping_test_service.py index a639888d93..e2587f0e51 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/_auto_rest_parameter_grouping_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/_auto_rest_parameter_grouping_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -20,6 +20,11 @@ from ._configuration import AutoRestParameterGroupingTestServiceConfiguration from .operations import ParameterGroupingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterGroupingTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/models/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/setup.py index 03cbb4a0b2..bc6da493da 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestparametergroupingtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_auto_rest_report_service_for_azure.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_auto_rest_report_service_for_azure.py index 5dff1d95ae..7037a641cc 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_auto_rest_report_service_for_azure.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_auto_rest_report_service_for_azure.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _AutoRestReportServiceForAzureOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestReportServiceForAzure( _AutoRestReportServiceForAzureOperationsMixin diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/_auto_rest_report_service_for_azure.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/_auto_rest_report_service_for_azure.py index e6d325b711..50ee66b501 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/_auto_rest_report_service_for_azure.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/_auto_rest_report_service_for_azure.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestReportServiceForAzureConfiguration from .operations import _AutoRestReportServiceForAzureOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestReportServiceForAzure( _AutoRestReportServiceForAzureOperationsMixin diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/models/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/setup.py index dd6ab92563..94e8de7902 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestreportserviceforazure" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_auto_rest_azure_special_parameters_test_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_auto_rest_azure_special_parameters_test_client.py index 4cb0ce5459..375cbdd6d4 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_auto_rest_azure_special_parameters_test_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_auto_rest_azure_special_parameters_test_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -32,6 +32,11 @@ XMsClientRequestIdOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/_auto_rest_azure_special_parameters_test_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/_auto_rest_azure_special_parameters_test_client.py index 39aa96aed2..1aa6c10bf9 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/_auto_rest_azure_special_parameters_test_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/_auto_rest_azure_special_parameters_test_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -32,6 +32,11 @@ XMsClientRequestIdOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/setup.py index 44e6524347..5edf72a51f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestazurespecialparameterstestclient" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_auto_rest_parameterized_host_test_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_auto_rest_parameterized_host_test_client.py index d2692fca2f..640682e57f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_auto_rest_parameterized_host_test_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_auto_rest_parameterized_host_test_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -20,6 +20,11 @@ from ._configuration import AutoRestParameterizedHostTestClientConfiguration from .operations import PathsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedHostTestClient: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_auto_rest_parameterized_host_test_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_auto_rest_parameterized_host_test_client.py index 01cd11b169..68a9909fd6 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_auto_rest_parameterized_host_test_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_auto_rest_parameterized_host_test_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -20,6 +20,11 @@ from ._configuration import AutoRestParameterizedHostTestClientConfiguration from .operations import PathsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedHostTestClient: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py index 1bc312dc47..19c691ad4e 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestparameterizedhosttestclient" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_auto_rest_paging_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_auto_rest_paging_test_service.py index a8320725b0..9b9cc6e980 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_auto_rest_paging_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_auto_rest_paging_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -22,6 +22,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/_auto_rest_paging_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/_auto_rest_paging_test_service.py index 533aec3b1c..c109147aa0 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/_auto_rest_paging_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/_auto_rest_paging_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -22,6 +22,11 @@ from ._configuration import AutoRestPagingTestServiceConfiguration from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/models/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/setup.py index 56bba34773..a32602c9c4 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "custompollerpager" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_auto_rest_parameterized_host_test_paging_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_auto_rest_parameterized_host_test_paging_client.py index 09d8154a67..efa3c58e56 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_auto_rest_parameterized_host_test_paging_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_auto_rest_parameterized_host_test_paging_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedHostTestPagingClient: # pylint: disable=client-accepts-api-version-keyword,name-too-long """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/_auto_rest_parameterized_host_test_paging_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/_auto_rest_parameterized_host_test_paging_client.py index f1f554c5a8..e7ef88fe24 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/_auto_rest_parameterized_host_test_paging_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/_auto_rest_parameterized_host_test_paging_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestParameterizedHostTestPagingClientConfiguration from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedHostTestPagingClient: # pylint: disable=client-accepts-api-version-keyword,name-too-long """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/models/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/setup.py index a241b7d4ea..27ac1b3af3 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestparameterizedhosttestpagingclient" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/_auto_rest_head_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/_auto_rest_head_test_service.py index 8494e25bb6..976fe4b107 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/_auto_rest_head_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/_auto_rest_head_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/_auto_rest_head_test_service.py index 606cc43c98..44bd911421 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/_auto_rest_head_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import AutoRestHeadTestServiceConfiguration from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/setup.py index f86c4179ad..1a98eeef7b 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestheadtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_auto_rest_head_exception_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_auto_rest_head_exception_test_service.py index afab653986..9821ce0c8b 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_auto_rest_head_exception_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_auto_rest_head_exception_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HeadExceptionOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/_auto_rest_head_exception_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/_auto_rest_head_exception_test_service.py index 2eefca13d9..2410c44aff 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/_auto_rest_head_exception_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/_auto_rest_head_exception_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import AutoRestHeadExceptionTestServiceConfiguration from .operations import HeadExceptionOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/setup.py index 8082b2c9d9..c4699b1da5 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestheadexceptiontestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_auto_rest_head_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_auto_rest_head_test_service.py index c5fa0cbc6b..9c0c5995a4 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_auto_rest_head_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core.credentials import AzureKeyCredential from azure.core.pipeline import policies @@ -20,6 +20,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestHeadTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/_auto_rest_head_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/_auto_rest_head_test_service.py index e2123958e9..5d1b589844 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/_auto_rest_head_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core.credentials import AzureKeyCredential from azure.core.pipeline import policies @@ -20,6 +20,11 @@ from ._configuration import AutoRestHeadTestServiceConfiguration from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestHeadTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/setup.py index f86c4179ad..1a98eeef7b 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestheadtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_auto_rest_long_running_operation_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_auto_rest_long_running_operation_test_service.py index 51365652ed..af0198e298 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_auto_rest_long_running_operation_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_auto_rest_long_running_operation_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -22,6 +22,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import LRORetrysOperations, LROSADsOperations, LROsCustomHeaderOperations, LROsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/_auto_rest_long_running_operation_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/_auto_rest_long_running_operation_test_service.py index f1b2cbaf73..8ea33e720a 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/_auto_rest_long_running_operation_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/_auto_rest_long_running_operation_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -22,6 +22,11 @@ from ._configuration import AutoRestLongRunningOperationTestServiceConfiguration from .operations import LRORetrysOperations, LROSADsOperations, LROsCustomHeaderOperations, LROsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/setup.py index 88e5c20f48..10bd1250e0 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestlongrunningoperationtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_lro_with_paramaterized_endpoints.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_lro_with_paramaterized_endpoints.py index f45d0e2a9e..b51316b242 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_lro_with_paramaterized_endpoints.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_lro_with_paramaterized_endpoints.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _LROWithParamaterizedEndpointsOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class LROWithParamaterizedEndpoints( _LROWithParamaterizedEndpointsOperationsMixin diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/_lro_with_paramaterized_endpoints.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/_lro_with_paramaterized_endpoints.py index 1b0af4cb56..f9ae68c8aa 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/_lro_with_paramaterized_endpoints.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/_lro_with_paramaterized_endpoints.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import LROWithParamaterizedEndpointsConfiguration from .operations import _LROWithParamaterizedEndpointsOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class LROWithParamaterizedEndpoints( _LROWithParamaterizedEndpointsOperationsMixin diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/models/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/setup.py index ce174315da..08029b7d89 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "lrowithparamaterizedendpoints" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/_mixed_api_version_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/_mixed_api_version_client.py index 3cd26ec240..92e897f4f8 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/_mixed_api_version_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/_mixed_api_version_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, TYPE_CHECKING -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -29,6 +29,11 @@ XMsClientRequestIdOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/_mixed_api_version_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/_mixed_api_version_client.py index 9607a275dd..25dbb84c9f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/_mixed_api_version_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/_mixed_api_version_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -29,6 +29,11 @@ XMsClientRequestIdOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/models/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/setup.py index 40652aab19..869e2088be 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "mixedapiversion" version = "1.0.0b1" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/_head_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/_head_client.py index 5b1a6a6291..2e41d56423 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/_head_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/_head_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/_head_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/_head_client.py index 73811936d0..e0d41aa2a8 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/_head_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/_head_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import HeadClientConfiguration from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/_paging_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/_paging_client.py index 7cbd0d0d83..32d6da73bc 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/_paging_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/_paging_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -22,6 +22,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/_paging_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/_paging_client.py index 11e9065096..dbf660ffa8 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/_paging_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/_paging_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -22,6 +22,11 @@ from ._configuration import PagingClientConfiguration from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/models/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/pyproject.toml b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/pyproject.toml index c44125e7cf..e8c440128d 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/pyproject.toml +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_auto_rest_head_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_auto_rest_head_test_service.py index 47e5d5d5b0..7c037e2e6d 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_auto_rest_head_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/_auto_rest_head_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/_auto_rest_head_test_service.py index addb5dea69..1dddd627dd 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/_auto_rest_head_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import AutoRestHeadTestServiceConfiguration from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/setup.py index cb8f06f5f8..8f76f6d604 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/setup.py @@ -11,7 +11,6 @@ import re from setuptools import setup, find_packages - PACKAGE_NAME = "azure-packagemode-customize" PACKAGE_PPRINT_NAME = "Azure Customized Package Mode" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_auto_rest_head_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_auto_rest_head_test_service.py index f886afb3de..7a1d388bdc 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_auto_rest_head_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/_auto_rest_head_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/_auto_rest_head_test_service.py index 8ca3670632..f4036b4954 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/_auto_rest_head_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import AutoRestHeadTestServiceConfiguration from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/pyproject.toml b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/pyproject.toml index 2e6250af39..599ce9e4d8 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/pyproject.toml +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_auto_rest_head_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_auto_rest_head_test_service.py index 2c64aac7aa..ea44d8d659 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_auto_rest_head_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/_auto_rest_head_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/_auto_rest_head_test_service.py index 8c4b515526..68fd91110a 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/_auto_rest_head_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import AutoRestHeadTestServiceConfiguration from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/pyproject.toml b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/pyproject.toml index 8792a684a3..ec436888f6 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/pyproject.toml +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_auto_rest_paging_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_auto_rest_paging_test_service.py index 6724d1dcea..086539781c 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_auto_rest_paging_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_auto_rest_paging_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestPagingTestService: """Long-running Operation for AutoRest. diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_auto_rest_paging_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_auto_rest_paging_test_service.py index 4edf158d90..53a68edd97 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_auto_rest_paging_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_auto_rest_paging_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestPagingTestServiceConfiguration from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestPagingTestService: """Long-running Operation for AutoRest. diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/setup.py index b44a4d8eef..e3824b83d0 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestpagingtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_autorest_security_aad.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_autorest_security_aad.py index 89b9fa90f2..ee2c495d7b 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_autorest_security_aad.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_autorest_security_aad.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _AutorestSecurityAadOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_autorest_security_aad.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_autorest_security_aad.py index 12a442b0dc..e60768940b 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_autorest_security_aad.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_autorest_security_aad.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import AutorestSecurityAadConfiguration from .operations import _AutorestSecurityAadOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/setup.py index 15cebfde20..ba732b256f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestsecurityaad" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_autorest_security_key.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_autorest_security_key.py index d1f7c10170..4bbf159a79 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_autorest_security_key.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_autorest_security_key.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _AutorestSecurityKeyOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_autorest_security_key.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_autorest_security_key.py index bf89fc6de3..b4599ab13c 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_autorest_security_key.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_autorest_security_key.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import AutorestSecurityKeyConfiguration from .operations import _AutorestSecurityKeyOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/setup.py index de28e02403..357945102b 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestsecuritykey" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/setup.py index 11e5dc4715..f84268cd2a 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "storagemanagementclient" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_storage_management_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_storage_management_client.py index 0f15ee04a9..7fca193de2 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_storage_management_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_storage_management_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -22,6 +22,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import StorageAccountsOperations, UsageOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/_storage_management_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/_storage_management_client.py index 894a8fcb1e..7f9b2f3098 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/_storage_management_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/_storage_management_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -22,6 +22,11 @@ from ._configuration import StorageManagementClientConfiguration from .operations import StorageAccountsOperations, UsageOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/setup.py index b7bf474666..6bc3274fa7 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "microsoftazuretesturl" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_microsoft_azure_test_url.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_microsoft_azure_test_url.py index fa61c14a66..0cc60559fb 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_microsoft_azure_test_url.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_microsoft_azure_test_url.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -22,6 +22,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import GroupOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/_microsoft_azure_test_url.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/_microsoft_azure_test_url.py index 9f65cfce1a..34fd2fb37d 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/_microsoft_azure_test_url.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/_microsoft_azure_test_url.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -22,6 +22,11 @@ from ._configuration import MicrosoftAzureTestUrlConfiguration from .operations import GroupOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/models/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/AcceptanceTests/asynctests/test_lro.py b/packages/autorest.python/test/azure/version-tolerant/AcceptanceTests/asynctests/test_lro.py index 7443b39743..59c3a7d49d 100644 --- a/packages/autorest.python/test/azure/version-tolerant/AcceptanceTests/asynctests/test_lro.py +++ b/packages/autorest.python/test/azure/version-tolerant/AcceptanceTests/asynctests/test_lro.py @@ -34,7 +34,6 @@ from lroversiontolerant.aio import AutoRestLongRunningOperationTestService - try: from urlparse import urlparse except ImportError: diff --git a/packages/autorest.python/test/azure/version-tolerant/AcceptanceTests/conftest.py b/packages/autorest.python/test/azure/version-tolerant/AcceptanceTests/conftest.py index 6b2ca89b0c..b77cbc5999 100644 --- a/packages/autorest.python/test/azure/version-tolerant/AcceptanceTests/conftest.py +++ b/packages/autorest.python/test/azure/version-tolerant/AcceptanceTests/conftest.py @@ -35,7 +35,6 @@ import pytest - cwd = dirname(realpath(__file__)) diff --git a/packages/autorest.python/test/azure/version-tolerant/AcceptanceTests/test_lro.py b/packages/autorest.python/test/azure/version-tolerant/AcceptanceTests/test_lro.py index b91af61c15..4b30b1dbd8 100644 --- a/packages/autorest.python/test/azure/version-tolerant/AcceptanceTests/test_lro.py +++ b/packages/autorest.python/test/azure/version-tolerant/AcceptanceTests/test_lro.py @@ -32,7 +32,6 @@ from lroversiontolerant import AutoRestLongRunningOperationTestService - try: from urlparse import urlparse except ImportError: diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_client.py index d9386eec17..2b3cae676d 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DurationOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDurationTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/_client.py index 449d62630c..7251a0c645 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestDurationTestServiceConfiguration from .operations import DurationOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDurationTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/setup.py index 3902fbc600..f721aeacf6 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestdurationtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_client.py index 9100ccf780..43823ad937 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ParameterGroupingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterGroupingTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/_client.py index d6f1e2eee3..9bdd75312c 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestParameterGroupingTestServiceConfiguration from .operations import ParameterGroupingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterGroupingTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/setup.py index c6ae6f64ce..e15ba80b9c 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestparametergroupingtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_client.py index 2e8f65f63c..16616467e7 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _AutoRestReportServiceForAzureOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestReportServiceForAzure( _AutoRestReportServiceForAzureOperationsMixin diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_client.py index cd71034496..20c7d94c1f 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestReportServiceForAzureConfiguration from ._operations import _AutoRestReportServiceForAzureOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestReportServiceForAzure( _AutoRestReportServiceForAzureOperationsMixin diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/setup.py index dd6ab92563..94e8de7902 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestreportserviceforazure" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_client.py index 09a5923e43..cbb14a6d53 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -30,6 +30,11 @@ XMsClientRequestIdOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/_client.py index 3f6d99683a..4d31e9f1df 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -30,6 +30,11 @@ XMsClientRequestIdOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/setup.py index 9784c2389f..62902b5820 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestazurespecialparameterstestclient" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_client.py index ef2e3db653..f6a2050b91 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PathsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedHostTestClient: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_client.py index 0c857272e9..c763846f1f 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestParameterizedHostTestClientConfiguration from .operations import PathsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedHostTestClient: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py index dbe06a5c65..69ce6d162b 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestparameterizedhosttestclient" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_client.py index 6b8be1e976..0d0f9e0b50 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/_client.py index d25bc0a9ca..f398ecea4c 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import AutoRestPagingTestServiceConfiguration from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/setup.py index 210899c7d6..84bc32b8e4 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "custompollerpagerversiontolerant" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_client.py index fee40a6136..bd830825d1 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedHostTestPagingClient: # pylint: disable=client-accepts-api-version-keyword,name-too-long """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/_client.py index 109050b717..a1159f0c47 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestParameterizedHostTestPagingClientConfiguration from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedHostTestPagingClient: # pylint: disable=client-accepts-api-version-keyword,name-too-long """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/setup.py index a241b7d4ea..27ac1b3af3 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestparameterizedhosttestpagingclient" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_client.py index 067102ab94..9c8cca6575 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HeadExceptionOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/_client.py index cef620dd95..9daef4a3ca 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import AutoRestHeadExceptionTestServiceConfiguration from .operations import HeadExceptionOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/setup.py index 8082b2c9d9..c4699b1da5 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestheadexceptiontestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_client.py index 980357592a..6281146a82 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/_client.py index ed9ba128bf..3edef57735 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import AutoRestHeadTestServiceConfiguration from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/setup.py index f86c4179ad..1a98eeef7b 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestheadtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/_client.py index ee1dc7ac19..24ebcd5cda 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import QuestionAnsweringProjectsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class LroPagingClient: """The language service API is a suite of natural language processing (NLP) skills built with diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/_client.py index 804fb320e8..4b50ddd992 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import LroPagingClientConfiguration from .operations import QuestionAnsweringProjectsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class LroPagingClient: """The language service API is a suite of natural language processing (NLP) skills built with diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/setup.py index 7f50b8b297..038e045a59 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/setup.py @@ -9,7 +9,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "lropagingversiontolerant" version = "1.0.0b1" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_client.py index ba9159c596..464b2d0e05 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import LRORetrysOperations, LROSADsOperations, LROsCustomHeaderOperations, LROsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/_client.py index f546bb8116..6c83a5722e 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import AutoRestLongRunningOperationTestServiceConfiguration from .operations import LRORetrysOperations, LROSADsOperations, LROsCustomHeaderOperations, LROsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/setup.py index 88e5c20f48..10bd1250e0 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestlongrunningoperationtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_client.py index 5b4f9f4dc3..814121548a 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _LROWithParamaterizedEndpointsOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class LROWithParamaterizedEndpoints( _LROWithParamaterizedEndpointsOperationsMixin diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_client.py index 6c69e5007f..e2d8e8a1af 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import LROWithParamaterizedEndpointsConfiguration from ._operations import _LROWithParamaterizedEndpointsOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class LROWithParamaterizedEndpoints( _LROWithParamaterizedEndpointsOperationsMixin diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/setup.py index ce174315da..08029b7d89 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "lrowithparamaterizedendpoints" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_client.py index d068b3540e..696e6e53fb 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestPagingTestService: """Long-running Operation for AutoRest. diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/_client.py index b035fa1dc2..8c540253e5 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestPagingTestServiceConfiguration from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestPagingTestService: """Long-running Operation for AutoRest. diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/setup.py index b44a4d8eef..e3824b83d0 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestpagingtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/setup.py index 11e5dc4715..f84268cd2a 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "storagemanagementclient" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_client.py index 6aaf7d94b3..df62cedb96 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import StorageAccountsOperations, UsageOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/_client.py index efc2bd736f..d8c399b801 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import StorageManagementClientConfiguration from .operations import StorageAccountsOperations, UsageOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/setup.py index b7bf474666..6bc3274fa7 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "microsoftazuretesturl" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_client.py index 259c6d6bb9..0d2e661864 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import GroupOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/_client.py index f730bb8bd9..b4336338c8 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import MicrosoftAzureTestUrlConfiguration from .operations import GroupOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_client.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_client.py index ede9a3fefa..473832b3bd 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_client.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _DPGClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DPGClient(_DPGClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """DPG Swagger that tests our ability to grow up. diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_operations/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_patch.py index 0937b0ba62..8c9afc8cce 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List, Any, Union, cast, IO from azure.core.paging import ItemPaged from azure.core.polling import LROPoller diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_utils/serialization.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_client.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_client.py index 048e29a8ab..0e2aa194c3 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import DPGClientConfiguration from ._operations import _DPGClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DPGClient(_DPGClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """DPG Swagger that tests our ability to grow up. diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_patch.py index 2c1eeb4368..fbb4dd2ff9 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List, Any, Union, cast, IO from azure.core.async_paging import AsyncItemPaged from azure.core.polling import AsyncLROPoller diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/setup.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/setup.py index 9f91dc341c..250a343c31 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/setup.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "dpgcustomizationcustomized" version = "0.1.0" diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_client.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_client.py index ede9a3fefa..473832b3bd 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_client.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _DPGClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DPGClient(_DPGClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """DPG Swagger that tests our ability to grow up. diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_operations/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_utils/serialization.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_client.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_client.py index 048e29a8ab..0e2aa194c3 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import DPGClientConfiguration from ._operations import _DPGClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DPGClient(_DPGClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """DPG Swagger that tests our ability to grow up. diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/setup.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/setup.py index d58c0e29aa..aee8e1e529 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/setup.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "dpgcustomizationinitial" version = "0.1.0" diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_client.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_client.py index da8d7f4488..8421c9c225 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_client.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ParamsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DPGClient: # pylint: disable=client-accepts-api-version-keyword """DPG Swagger, this is the initial swagger a service could do. diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_utils/serialization.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/_client.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/_client.py index 247c65d3fc..ea3aa0d53a 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import DPGClientConfiguration from .operations import ParamsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DPGClient: # pylint: disable=client-accepts-api-version-keyword """DPG Swagger, this is the initial swagger a service could do. diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/operations/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/setup.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/setup.py index 0a9423116f..0a64f49daa 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/setup.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "dpgservicedriveninitial" version = "0.1.0" diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_client.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_client.py index bfeb7fe51a..1ea0bc973d 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_client.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ParamsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DPGClient: # pylint: disable=client-accepts-api-version-keyword """DPG Swagger, this is the initial swagger a service could do. diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_utils/serialization.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/_client.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/_client.py index 647c208229..db85a7c685 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import DPGClientConfiguration from .operations import ParamsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DPGClient: # pylint: disable=client-accepts-api-version-keyword """DPG Swagger, this is the initial swagger a service could do. diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/operations/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/setup.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/setup.py index a0e7631966..931d156aeb 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/setup.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "dpgservicedrivenupdateone" version = "0.1.0" diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_client.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_client.py index 49431f569f..a5dffc3778 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_client.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._operations import _DPGClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DPGClient(_DPGClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """DPG Swagger that tests our ability to grow up. diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_operations/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_operations/_patch.py index ccae2673af..c6d685a398 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List, Any from ..models import Product from ._operations import _DPGClientOperationsMixin as _DPGClientOperationsMixinGenerated diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_patch.py index fa21522181..12c66bab02 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List from ._client import DPGClient as DPGClientGenerated diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_utils/serialization.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_client.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_client.py index 92c68907e4..8f8bc9d809 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import DPGClientConfiguration from ._operations import _DPGClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DPGClient(_DPGClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """DPG Swagger that tests our ability to grow up. diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_operations/_patch.py index 084c07a6d2..b59678a025 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List, Any from ...models import Product from ._operations import _DPGClientOperationsMixin as _DPGClientOperationsMixinGenerated diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_patch.py index fa21522181..12c66bab02 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List from ._client import DPGClient as DPGClientGenerated diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/models/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/models/_patch.py index 30c0e5dccd..b7c15515bf 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/models/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List from ._models import Product as ProductGenerated diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/setup.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/setup.py index 95878502fb..4cc602f980 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/setup.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "dpgtestmodels" version = "0.1.0" diff --git a/packages/autorest.python/test/unittests/storage_models/serialization.py b/packages/autorest.python/test/unittests/storage_models/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/unittests/storage_models/serialization.py +++ b/packages/autorest.python/test/unittests/storage_models/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/unittests/test_m2r.py b/packages/autorest.python/test/unittests/test_m2r.py index 13d124e7ee..f435f988d5 100644 --- a/packages/autorest.python/test/unittests/test_m2r.py +++ b/packages/autorest.python/test/unittests/test_m2r.py @@ -5,7 +5,6 @@ # -------------------------------------------------------------------------- from autorest import m2r as m2r_autorest - _MD_LINK = "[inline link](https://github.com/Azure/autorest.python)" _RST_LINK = "`inline link `_" diff --git a/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/asynctests/test_header.py b/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/asynctests/test_header.py index b25dc4ee0c..c31c80e466 100644 --- a/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/asynctests/test_header.py +++ b/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/asynctests/test_header.py @@ -185,7 +185,7 @@ async def test_duration(self, client, value_header): @pytest.mark.asyncio async def test_byte(self, client, value_header): - u_bytes = bytearray("\u554A\u9F44\u4E02\u72DB\u72DC\uF9F1\uF92C\uF9F1\uFA0C\uFA29", encoding="utf-8") + u_bytes = bytearray("\u554a\u9f44\u4e02\u72db\u72dc\uf9f1\uf92c\uf9f1\ufa0c\ufa29", encoding="utf-8") await client.header.param_byte("valid", u_bytes) response = await client.header.response_byte("valid", cls=value_header) diff --git a/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/asynctests/test_url.py b/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/asynctests/test_url.py index 2804bc9535..268622282f 100644 --- a/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/asynctests/test_url.py +++ b/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/asynctests/test_url.py @@ -73,7 +73,7 @@ async def test_byte_empty_and_null(self, client): @pytest.mark.asyncio async def test_byte_multi_byte(self, client): - u_bytes = bytearray("\u554A\u9F44\u4E02\u72DB\u72DC\uF9F1\uF92C\uF9F1\uFA0C\uFA29", encoding="utf-8") + u_bytes = bytearray("\u554a\u9f44\u4e02\u72db\u72dc\uf9f1\uf92c\uf9f1\ufa0c\ufa29", encoding="utf-8") await client.paths.byte_multi_byte(u_bytes) @pytest.mark.asyncio @@ -163,7 +163,7 @@ async def test_base64_url(self, client): @pytest.mark.asyncio async def test_queries_byte(self, client): await client.queries.byte_empty() - u_bytes = bytearray("\u554A\u9F44\u4E02\u72DB\u72DC\uF9F1\uF92C\uF9F1\uFA0C\uFA29", encoding="utf-8") + u_bytes = bytearray("\u554a\u9f44\u4e02\u72db\u72dc\uf9f1\uf92c\uf9f1\ufa0c\ufa29", encoding="utf-8") await client.queries.byte_multi_byte(u_bytes) await client.queries.byte_null() diff --git a/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/conftest.py b/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/conftest.py index 64139e91e4..fdef7f8070 100644 --- a/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/conftest.py +++ b/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/conftest.py @@ -36,7 +36,6 @@ import pytest - cwd = dirname(realpath(__file__)) diff --git a/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/test_header.py b/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/test_header.py index 01b39b96a4..6c086c6c53 100644 --- a/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/test_header.py +++ b/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/test_header.py @@ -169,7 +169,7 @@ def test_duration(self, client, value_header): assert response == timedelta(days=123, hours=22, minutes=14, seconds=12, milliseconds=11) def test_byte(self, client, value_header): - u_bytes = bytearray("\u554A\u9F44\u4E02\u72DB\u72DC\uF9F1\uF92C\uF9F1\uFA0C\uFA29", encoding="utf-8") + u_bytes = bytearray("\u554a\u9f44\u4e02\u72db\u72dc\uf9f1\uf92c\uf9f1\ufa0c\ufa29", encoding="utf-8") client.header.param_byte("valid", u_bytes) response = client.header.response_byte("valid", cls=value_header) diff --git a/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/test_url.py b/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/test_url.py index 84306c535d..857737ae31 100644 --- a/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/test_url.py +++ b/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/test_url.py @@ -67,7 +67,7 @@ def test_byte_empty_and_null(self, client): client.paths.byte_null(None) def test_byte_multi_byte(self, client): - u_bytes = bytearray("\u554A\u9F44\u4E02\u72DB\u72DC\uF9F1\uF92C\uF9F1\uFA0C\uFA29", encoding="utf-8") + u_bytes = bytearray("\u554a\u9f44\u4e02\u72db\u72dc\uf9f1\uf92c\uf9f1\ufa0c\ufa29", encoding="utf-8") client.paths.byte_multi_byte(u_bytes) def test_date_null(self, client): @@ -138,7 +138,7 @@ def test_base64_url(self, client): def test_queries_byte(self, client): client.queries.byte_empty() - u_bytes = bytearray("\u554A\u9F44\u4E02\u72DB\u72DC\uF9F1\uF92C\uF9F1\uFA0C\uFA29", encoding="utf-8") + u_bytes = bytearray("\u554a\u9f44\u4e02\u72db\u72dc\uf9f1\uf92c\uf9f1\ufa0c\ufa29", encoding="utf-8") client.queries.byte_multi_byte(u_bytes) client.queries.byte_null() diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_additional_properties_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_additional_properties_client.py index c36eb97e70..f4e2fa92cb 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_additional_properties_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_additional_properties_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PetsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AdditionalPropertiesClient: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/_additional_properties_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/_additional_properties_client.py index 5c61c04925..ceab4875cb 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/_additional_properties_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/_additional_properties_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AdditionalPropertiesClientConfiguration from .operations import PetsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AdditionalPropertiesClient: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/setup.py index 708d6ea09f..c3248500f0 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "additionalpropertiesclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_anything_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_anything_client.py index 7b3c2099c6..1f22966ddd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_anything_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_anything_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _AnythingClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AnythingClient(_AnythingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing basic anything types. Those schemas without types can be anything: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/_anything_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/_anything_client.py index 588e256c8a..d227bb0b29 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/_anything_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/_anything_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AnythingClientConfiguration from .operations import _AnythingClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AnythingClient(_AnythingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing basic anything types. Those schemas without types can be anything: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/setup.py index 720471e11a..45f92248a5 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/setup.py @@ -9,7 +9,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "anythingclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_auto_rest_swagger_bat_array_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_auto_rest_swagger_bat_array_service.py index 17ae7ddb46..65da3077f2 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_auto_rest_swagger_bat_array_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_auto_rest_swagger_bat_array_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ArrayOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATArrayService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/_auto_rest_swagger_bat_array_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/_auto_rest_swagger_bat_array_service.py index f4b56f1727..d083643eeb 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/_auto_rest_swagger_bat_array_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/_auto_rest_swagger_bat_array_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestSwaggerBATArrayServiceConfiguration from .operations import ArrayOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATArrayService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/setup.py index 5c93b4bc4c..a4646706d2 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatarrayservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/setup.py index 5c93b4bc4c..a4646706d2 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatarrayservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_auto_rest_swagger_bat_array_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_auto_rest_swagger_bat_array_service.py index f493961f7f..f2fd942ae5 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_auto_rest_swagger_bat_array_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_auto_rest_swagger_bat_array_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ArrayOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATArrayService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_auto_rest_swagger_bat_array_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_auto_rest_swagger_bat_array_service.py index 822c3eca37..a863e9d207 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_auto_rest_swagger_bat_array_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_auto_rest_swagger_bat_array_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestSwaggerBATArrayServiceConfiguration from .operations import ArrayOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATArrayService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_binary_with_content_type_application_json.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_binary_with_content_type_application_json.py index de84376639..962aa2dce2 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_binary_with_content_type_application_json.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_binary_with_content_type_application_json.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DownloadOperations, UploadOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BinaryWithContentTypeApplicationJson: # pylint: disable=client-accepts-api-version-keyword """Sample for file with json and binary content type. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/_binary_with_content_type_application_json.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/_binary_with_content_type_application_json.py index 370e294435..f66898518e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/_binary_with_content_type_application_json.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/_binary_with_content_type_application_json.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import BinaryWithContentTypeApplicationJsonConfiguration from .operations import DownloadOperations, UploadOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BinaryWithContentTypeApplicationJson: # pylint: disable=client-accepts-api-version-keyword """Sample for file with json and binary content type. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/setup.py index da6cfdbb37..23083519cf 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "binarywithcontenttypeapplicationjson" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_auto_rest_bool_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_auto_rest_bool_test_service.py index b7ed25c8ec..16eb3df8ee 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_auto_rest_bool_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_auto_rest_bool_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import BoolOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestBoolTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/_auto_rest_bool_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/_auto_rest_bool_test_service.py index 3cdd55a0dd..08bd86564e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/_auto_rest_bool_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/_auto_rest_bool_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestBoolTestServiceConfiguration from .operations import BoolOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestBoolTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/setup.py index 20a8d56b18..327af1e195 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestbooltestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_auto_rest_swagger_bat_byte_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_auto_rest_swagger_bat_byte_service.py index 1f8dcf4435..4ed8e06bc3 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_auto_rest_swagger_bat_byte_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_auto_rest_swagger_bat_byte_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ByteOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATByteService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/_auto_rest_swagger_bat_byte_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/_auto_rest_swagger_bat_byte_service.py index 061a89a9f7..f8caebbd64 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/_auto_rest_swagger_bat_byte_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/_auto_rest_swagger_bat_byte_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestSwaggerBATByteServiceConfiguration from .operations import ByteOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATByteService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/setup.py index 2786adf6a4..26e40f3179 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatbyteservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_class_name.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_class_name.py index 18a12a6481..3b79d0d1ca 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_class_name.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_class_name.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ByteOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClassName: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/_class_name.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/_class_name.py index af762d9528..b6ac2c704c 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/_class_name.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/_class_name.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import ClassNameConfiguration from .operations import ByteOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClassName: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/setup.py index b4b8269f9d..5c0caf6c68 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "packagename" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_auto_rest_complex_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_auto_rest_complex_test_service.py index cd701d8438..b2e1ab8181 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_auto_rest_complex_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_auto_rest_complex_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -30,6 +30,11 @@ ReadonlypropertyOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestComplexTestService: # pylint: disable=too-many-instance-attributes """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/_auto_rest_complex_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/_auto_rest_complex_test_service.py index a182911f9f..e26f4a2e26 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/_auto_rest_complex_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/_auto_rest_complex_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -30,6 +30,11 @@ ReadonlypropertyOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestComplexTestService: # pylint: disable=too-many-instance-attributes """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/setup.py index a8f263a0d6..e9f2c8fff3 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestcomplextestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_auto_rest_date_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_auto_rest_date_test_service.py index 07326d39d6..9513c065c0 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_auto_rest_date_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_auto_rest_date_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DateOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDateTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/_auto_rest_date_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/_auto_rest_date_test_service.py index 4b727743a3..88c5543106 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/_auto_rest_date_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/_auto_rest_date_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestDateTestServiceConfiguration from .operations import DateOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDateTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/setup.py index d9ba100c0c..54f70b106b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestdatetestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_auto_rest_date_time_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_auto_rest_date_time_test_service.py index fab856f846..1003a77bbd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_auto_rest_date_time_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_auto_rest_date_time_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DatetimeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDateTimeTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/_auto_rest_date_time_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/_auto_rest_date_time_test_service.py index 23e2d97341..d59362f782 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/_auto_rest_date_time_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/_auto_rest_date_time_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestDateTimeTestServiceConfiguration from .operations import DatetimeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDateTimeTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/setup.py index 8fcb3ee4d7..19f0fea4d0 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestdatetimetestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_auto_rest_rfc1123_date_time_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_auto_rest_rfc1123_date_time_test_service.py index 08dbbb1902..a3471f180c 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_auto_rest_rfc1123_date_time_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_auto_rest_rfc1123_date_time_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import Datetimerfc1123Operations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestRFC1123DateTimeTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/_auto_rest_rfc1123_date_time_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/_auto_rest_rfc1123_date_time_test_service.py index 74ee1f09f8..db9387cb1d 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/_auto_rest_rfc1123_date_time_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/_auto_rest_rfc1123_date_time_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestRFC1123DateTimeTestServiceConfiguration from .operations import Datetimerfc1123Operations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestRFC1123DateTimeTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/setup.py index 7fa61b2e03..a3a8a2515c 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestrfc1123datetimetestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_auto_rest_swagger_bat_dictionary_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_auto_rest_swagger_bat_dictionary_service.py index 4c938c6e95..9557536277 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_auto_rest_swagger_bat_dictionary_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_auto_rest_swagger_bat_dictionary_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DictionaryOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATDictionaryService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/_auto_rest_swagger_bat_dictionary_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/_auto_rest_swagger_bat_dictionary_service.py index 9b71d885cd..ed0411ec5f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/_auto_rest_swagger_bat_dictionary_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/_auto_rest_swagger_bat_dictionary_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestSwaggerBATDictionaryServiceConfiguration from .operations import DictionaryOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATDictionaryService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/setup.py index 91345eef98..5cea2d2dc8 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatdictionaryservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_auto_rest_duration_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_auto_rest_duration_test_service.py index 99afed4252..2b6c32d560 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_auto_rest_duration_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_auto_rest_duration_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DurationOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDurationTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/_auto_rest_duration_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/_auto_rest_duration_test_service.py index b6145cdcad..309e576bf8 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/_auto_rest_duration_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/_auto_rest_duration_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestDurationTestServiceConfiguration from .operations import DurationOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDurationTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/setup.py index 3902fbc600..f721aeacf6 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestdurationtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_auto_rest_swagger_bat_file_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_auto_rest_swagger_bat_file_service.py index fd478206ea..2c4a61718e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_auto_rest_swagger_bat_file_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_auto_rest_swagger_bat_file_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import FilesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATFileService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/_auto_rest_swagger_bat_file_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/_auto_rest_swagger_bat_file_service.py index a21db654d4..6f44c9524d 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/_auto_rest_swagger_bat_file_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/_auto_rest_swagger_bat_file_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestSwaggerBATFileServiceConfiguration from .operations import FilesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATFileService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/setup.py index 58522e0d67..26d67cef4f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatfileservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_auto_rest_swagger_bat_form_data_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_auto_rest_swagger_bat_form_data_service.py index 84c75e0f79..77f916de41 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_auto_rest_swagger_bat_form_data_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_auto_rest_swagger_bat_form_data_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import FormdataOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATFormDataService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/_auto_rest_swagger_bat_form_data_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/_auto_rest_swagger_bat_form_data_service.py index aa416952fe..64411ee4e2 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/_auto_rest_swagger_bat_form_data_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/_auto_rest_swagger_bat_form_data_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestSwaggerBATFormDataServiceConfiguration from .operations import FormdataOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATFormDataService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/setup.py index e528774182..b0a12262b0 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatformdataservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_body_forms_data_url_encoded.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_body_forms_data_url_encoded.py index 4df823b769..48a75f54cc 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_body_forms_data_url_encoded.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_body_forms_data_url_encoded.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import FormdataurlencodedOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BodyFormsDataURLEncoded: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/_body_forms_data_url_encoded.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/_body_forms_data_url_encoded.py index 48621c04b1..d498b311c1 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/_body_forms_data_url_encoded.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/_body_forms_data_url_encoded.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import BodyFormsDataURLEncodedConfiguration from .operations import FormdataurlencodedOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BodyFormsDataURLEncoded: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/setup.py index fe5b2d5b03..6ac8049d97 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "bodyformsdataurlencoded" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_auto_rest_integer_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_auto_rest_integer_test_service.py index ed11337baa..40951d6589 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_auto_rest_integer_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_auto_rest_integer_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import IntOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestIntegerTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/_auto_rest_integer_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/_auto_rest_integer_test_service.py index 7d54bc4034..7f39af1ab7 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/_auto_rest_integer_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/_auto_rest_integer_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestIntegerTestServiceConfiguration from .operations import IntOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestIntegerTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/setup.py index a76d16b262..30a1f48d72 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestintegertestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_auto_rest_number_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_auto_rest_number_test_service.py index b8c468cf2a..b1af6f69a4 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_auto_rest_number_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_auto_rest_number_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import NumberOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestNumberTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/_auto_rest_number_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/_auto_rest_number_test_service.py index 13e8626eb8..c676c82488 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/_auto_rest_number_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/_auto_rest_number_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestNumberTestServiceConfiguration from .operations import NumberOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestNumberTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/setup.py index 3e1f1ec633..a60980ca8b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestnumbertestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_auto_rest_swagger_bat_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_auto_rest_swagger_bat_service.py index 7014254d8b..21a3dc6672 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_auto_rest_swagger_bat_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_auto_rest_swagger_bat_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import EnumOperations, StringOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/_auto_rest_swagger_bat_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/_auto_rest_swagger_bat_service.py index 1a8bff8225..267a14954c 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/_auto_rest_swagger_bat_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/_auto_rest_swagger_bat_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestSwaggerBATServiceConfiguration from .operations import EnumOperations, StringOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/setup.py index 20d8244540..d655a7e291 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_auto_rest_time_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_auto_rest_time_test_service.py index ceec08f700..3e339cd206 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_auto_rest_time_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_auto_rest_time_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import TimeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestTimeTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/_auto_rest_time_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/_auto_rest_time_test_service.py index 85e9226f32..90e73994c5 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/_auto_rest_time_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/_auto_rest_time_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestTimeTestServiceConfiguration from .operations import TimeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestTimeTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/setup.py index 2773de29cf..bb8c19db37 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autoresttimetestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/_client_with_enum.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/_client_with_enum.py index 8fb167cd5c..1177755ea7 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/_client_with_enum.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/_client_with_enum.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Union -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _ClientWithEnumOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClientWithEnum(_ClientWithEnumOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test client with enum variable. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/_client_with_enum.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/_client_with_enum.py index 0c0898bc18..da0240e496 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/_client_with_enum.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/_client_with_enum.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Union -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import ClientWithEnumConfiguration from .operations import _ClientWithEnumOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClientWithEnum(_ClientWithEnumOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test client with enum variable. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/models/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/setup.py index 62507af3e2..0abf28e31a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "clientwithenum" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_auto_rest_swagger_constant_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_auto_rest_swagger_constant_service.py index d6358e0260..59c40e47d4 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_auto_rest_swagger_constant_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_auto_rest_swagger_constant_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ContantsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerConstantService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger Constant. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/_auto_rest_swagger_constant_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/_auto_rest_swagger_constant_service.py index 68fc104412..015ac806e8 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/_auto_rest_swagger_constant_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/_auto_rest_swagger_constant_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestSwaggerConstantServiceConfiguration from .operations import ContantsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerConstantService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger Constant. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/setup.py index 48fe9cf124..37fc4bc01e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerconstantservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_auto_rest_parameterized_host_test_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_auto_rest_parameterized_host_test_client.py index d2692fca2f..640682e57f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_auto_rest_parameterized_host_test_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_auto_rest_parameterized_host_test_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -20,6 +20,11 @@ from ._configuration import AutoRestParameterizedHostTestClientConfiguration from .operations import PathsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedHostTestClient: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_auto_rest_parameterized_host_test_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_auto_rest_parameterized_host_test_client.py index 01cd11b169..68a9909fd6 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_auto_rest_parameterized_host_test_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_auto_rest_parameterized_host_test_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -20,6 +20,11 @@ from ._configuration import AutoRestParameterizedHostTestClientConfiguration from .operations import PathsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedHostTestClient: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py index 1bc312dc47..19c691ad4e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestparameterizedhosttestclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_auto_rest_parameterized_custom_host_test_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_auto_rest_parameterized_custom_host_test_client.py index c06d791f86..27d38408ef 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_auto_rest_parameterized_custom_host_test_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_auto_rest_parameterized_custom_host_test_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PathsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedCustomHostTestClient: # pylint: disable=client-accepts-api-version-keyword,name-too-long """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/_auto_rest_parameterized_custom_host_test_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/_auto_rest_parameterized_custom_host_test_client.py index b7025a26a4..3f26f00fc4 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/_auto_rest_parameterized_custom_host_test_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/_auto_rest_parameterized_custom_host_test_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestParameterizedCustomHostTestClientConfiguration from .operations import PathsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedCustomHostTestClient: # pylint: disable=client-accepts-api-version-keyword,name-too-long """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/models/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/setup.py index aab082215c..4f100126f9 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestparameterizedcustomhosttestclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/_error_with_secrets.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/_error_with_secrets.py index 4c5b531c3b..bdd0ab9f11 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/_error_with_secrets.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/_error_with_secrets.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _ErrorWithSecretsOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ErrorWithSecrets(_ErrorWithSecretsOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Tests whether loggers/tracers redact secrets and PII within error responses. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/_error_with_secrets.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/_error_with_secrets.py index e9107532b7..7f4c65f8b7 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/_error_with_secrets.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/_error_with_secrets.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import ErrorWithSecretsConfiguration from .operations import _ErrorWithSecretsOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ErrorWithSecrets(_ErrorWithSecretsOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Tests whether loggers/tracers redact secrets and PII within error responses. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/models/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/setup.py index c016a61946..7bffd139d9 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "errorwithsecrets" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_pet_store_inc.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_pet_store_inc.py index 338b740558..bac2d01382 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_pet_store_inc.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_pet_store_inc.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PetOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PetStoreInc: # pylint: disable=client-accepts-api-version-keyword """PetStore. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/_pet_store_inc.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/_pet_store_inc.py index 4c99309a65..f7976f86e3 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/_pet_store_inc.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/_pet_store_inc.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import PetStoreIncConfiguration from .operations import PetOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PetStoreInc: # pylint: disable=client-accepts-api-version-keyword """PetStore. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/setup.py index 41041f3e24..25a2b681ee 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "petstoreinc" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_auto_rest_swagger_bat_header_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_auto_rest_swagger_bat_header_service.py index 67bf8f1c59..4373272b57 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_auto_rest_swagger_bat_header_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_auto_rest_swagger_bat_header_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HeaderOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATHeaderService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/_auto_rest_swagger_bat_header_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/_auto_rest_swagger_bat_header_service.py index b0b8693611..27d5d26d7a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/_auto_rest_swagger_bat_header_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/_auto_rest_swagger_bat_header_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestSwaggerBATHeaderServiceConfiguration from .operations import HeaderOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATHeaderService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/setup.py index 7220cd67e2..1ebd98cd0b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatheaderservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_auto_rest_http_infrastructure_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_auto_rest_http_infrastructure_test_service.py index 0aeb041b2f..0b8af0ddf4 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_auto_rest_http_infrastructure_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_auto_rest_http_infrastructure_test_service.py @@ -8,8 +8,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -28,6 +28,11 @@ MultipleResponsesOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestHttpInfrastructureTestService: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/_auto_rest_http_infrastructure_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/_auto_rest_http_infrastructure_test_service.py index 03154ee926..6a0c6dd40e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/_auto_rest_http_infrastructure_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/_auto_rest_http_infrastructure_test_service.py @@ -8,8 +8,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -28,6 +28,11 @@ MultipleResponsesOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestHttpInfrastructureTestService: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/setup.py index f80fec31ad..5d1704d787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autoresthttpinfrastructuretestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_incorrect_returned_error_model.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_incorrect_returned_error_model.py index 31a818b2f2..28eda454ba 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_incorrect_returned_error_model.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_incorrect_returned_error_model.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _IncorrectReturnedErrorModelOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class IncorrectReturnedErrorModel( _IncorrectReturnedErrorModelOperationsMixin diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/_incorrect_returned_error_model.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/_incorrect_returned_error_model.py index 92ea16b07f..ebcbce3de5 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/_incorrect_returned_error_model.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/_incorrect_returned_error_model.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import IncorrectReturnedErrorModelConfiguration from .operations import _IncorrectReturnedErrorModelOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class IncorrectReturnedErrorModel( _IncorrectReturnedErrorModelOperationsMixin diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/setup.py index 414044f4ee..f0685714c5 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "incorrectreturnederrormodel" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/_media_types_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/_media_types_client.py index 45b21a6b86..ff4e299b19 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/_media_types_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/_media_types_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _MediaTypesClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MediaTypesClient(_MediaTypesClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Play with produces/consumes and media-types in general. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/_media_types_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/_media_types_client.py index b0664cf422..a8ba98c84d 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/_media_types_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/_media_types_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import MediaTypesClientConfiguration from .operations import _MediaTypesClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MediaTypesClient(_MediaTypesClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Play with produces/consumes and media-types in general. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/models/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/pyproject.toml b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/pyproject.toml index 726a1836d1..1efd7f1c3b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/pyproject.toml +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_media_types_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_media_types_client.py index 45b21a6b86..ff4e299b19 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_media_types_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_media_types_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _MediaTypesClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MediaTypesClient(_MediaTypesClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Play with produces/consumes and media-types in general. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/_media_types_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/_media_types_client.py index b0664cf422..a8ba98c84d 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/_media_types_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/_media_types_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import MediaTypesClientConfiguration from .operations import _MediaTypesClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MediaTypesClient(_MediaTypesClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Play with produces/consumes and media-types in general. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/setup.py index 17f9c4b725..0476a6dc33 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "mediatypesclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_merge_patch_json_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_merge_patch_json_client.py index fceb0b9d5e..9cb00421f6 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_merge_patch_json_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_merge_patch_json_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _MergePatchJsonClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MergePatchJsonClient(_MergePatchJsonClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing merge patch json. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_merge_patch_json_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_merge_patch_json_client.py index 21d5acd781..153a62518f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_merge_patch_json_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_merge_patch_json_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import MergePatchJsonClientConfiguration from .operations import _MergePatchJsonClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MergePatchJsonClient(_MergePatchJsonClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing merge patch json. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/setup.py index 24682ccbd2..c1d6be027e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "mergepatchjsonclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_auto_rest_resource_flattening_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_auto_rest_resource_flattening_test_service.py index ad85d39edc..e30d481bc8 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_auto_rest_resource_flattening_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_auto_rest_resource_flattening_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _AutoRestResourceFlatteningTestServiceOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestResourceFlatteningTestService( _AutoRestResourceFlatteningTestServiceOperationsMixin diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/_auto_rest_resource_flattening_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/_auto_rest_resource_flattening_test_service.py index f0261a9dca..86c5c45d13 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/_auto_rest_resource_flattening_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/_auto_rest_resource_flattening_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestResourceFlatteningTestServiceConfiguration from .operations import _AutoRestResourceFlatteningTestServiceOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestResourceFlatteningTestService( _AutoRestResourceFlatteningTestServiceOperationsMixin diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/setup.py index 96e4ed7ae3..ecc3ce5ed4 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestresourceflatteningtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_multiple_inheritance_service_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_multiple_inheritance_service_client.py index e80fb9ed4d..553a1217dc 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_multiple_inheritance_service_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_multiple_inheritance_service_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _MultipleInheritanceServiceClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MultipleInheritanceServiceClient( _MultipleInheritanceServiceClientOperationsMixin diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_multiple_inheritance_service_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_multiple_inheritance_service_client.py index 5f68d507b2..f143dd9774 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_multiple_inheritance_service_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_multiple_inheritance_service_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import MultipleInheritanceServiceClientConfiguration from .operations import _MultipleInheritanceServiceClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MultipleInheritanceServiceClient( _MultipleInheritanceServiceClientOperationsMixin diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/setup.py index 65ce30c147..106241853f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "multipleinheritanceserviceclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/setup.py index 6bb683a96d..649479281f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "nooperationsserviceclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_non_string_enums_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_non_string_enums_client.py index 7436529412..6692f8eba6 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_non_string_enums_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_non_string_enums_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import FloatOperations, IntOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NonStringEnumsClient: # pylint: disable=client-accepts-api-version-keyword """Testing non-string enums. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/_non_string_enums_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/_non_string_enums_client.py index 04e9f18358..bfedb58dfa 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/_non_string_enums_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/_non_string_enums_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import NonStringEnumsClientConfiguration from .operations import FloatOperations, IntOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NonStringEnumsClient: # pylint: disable=client-accepts-api-version-keyword """Testing non-string enums. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/setup.py index 930e6407d7..ac7b760933 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "nonstringenumsclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_object_type_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_object_type_client.py index 6ed66d73c1..e7912a445b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_object_type_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_object_type_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _ObjectTypeClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ObjectTypeClient(_ObjectTypeClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing basic type: object swaggers. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/_object_type_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/_object_type_client.py index c73b6f2acf..2631f01bef 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/_object_type_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/_object_type_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ObjectTypeClientConfiguration from .operations import _ObjectTypeClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ObjectTypeClient(_ObjectTypeClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing basic type: object swaggers. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/setup.py index 61ca91f962..01c7500f35 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "objecttypeclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_anything_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_anything_client.py index 7b3c2099c6..1f22966ddd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_anything_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_anything_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _AnythingClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AnythingClient(_AnythingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing basic anything types. Those schemas without types can be anything: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/_anything_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/_anything_client.py index 588e256c8a..d227bb0b29 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/_anything_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/_anything_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AnythingClientConfiguration from .operations import _AnythingClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AnythingClient(_AnythingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing basic anything types. Those schemas without types can be anything: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/pyproject.toml b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/pyproject.toml index 92ccb71ecd..6b53e5d78e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/pyproject.toml +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_auto_rest_parameter_flattening.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_auto_rest_parameter_flattening.py index 3e2c23c2dd..82f8dce269 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_auto_rest_parameter_flattening.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_auto_rest_parameter_flattening.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import AvailabilitySetsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterFlattening: # pylint: disable=client-accepts-api-version-keyword """Resource Flattening for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/_auto_rest_parameter_flattening.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/_auto_rest_parameter_flattening.py index eb0e2049f5..0bfef92a7b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/_auto_rest_parameter_flattening.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/_auto_rest_parameter_flattening.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestParameterFlatteningConfiguration from .operations import AvailabilitySetsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterFlattening: # pylint: disable=client-accepts-api-version-keyword """Resource Flattening for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/setup.py index 0dbf2cb1c5..ecc852cb59 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestparameterflattening" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_parmaterized_endpoint_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_parmaterized_endpoint_client.py index 4b84947fb6..7d5187a0f3 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_parmaterized_endpoint_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_parmaterized_endpoint_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _ParmaterizedEndpointClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ParmaterizedEndpointClient( _ParmaterizedEndpointClientOperationsMixin diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/_parmaterized_endpoint_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/_parmaterized_endpoint_client.py index 6018ae9023..a20c02aa0f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/_parmaterized_endpoint_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/_parmaterized_endpoint_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ParmaterizedEndpointClientConfiguration from .operations import _ParmaterizedEndpointClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ParmaterizedEndpointClient( _ParmaterizedEndpointClientOperationsMixin diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/setup.py index 428c21c8f5..c1f03fe870 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "parmaterizedendpointclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_auto_rest_report_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_auto_rest_report_service.py index bc9cd7953d..059f4c0a64 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_auto_rest_report_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_auto_rest_report_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _AutoRestReportServiceOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestReportService( _AutoRestReportServiceOperationsMixin diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/_auto_rest_report_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/_auto_rest_report_service.py index 5f52bc5ab5..ea285f8a32 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/_auto_rest_report_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/_auto_rest_report_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestReportServiceConfiguration from .operations import _AutoRestReportServiceOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestReportService( _AutoRestReportServiceOperationsMixin diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/setup.py index 66d07493d2..1267837c19 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestreportservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_auto_rest_required_optional_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_auto_rest_required_optional_test_service.py index ab509ee610..4cbc4a1987 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_auto_rest_required_optional_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_auto_rest_required_optional_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -20,6 +20,11 @@ from ._configuration import AutoRestRequiredOptionalTestServiceConfiguration from .operations import ExplicitOperations, ImplicitOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestRequiredOptionalTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/_auto_rest_required_optional_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/_auto_rest_required_optional_test_service.py index 1bad1c81c5..98387f159d 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/_auto_rest_required_optional_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/_auto_rest_required_optional_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -20,6 +20,11 @@ from ._configuration import AutoRestRequiredOptionalTestServiceConfiguration from .operations import ExplicitOperations, ImplicitOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestRequiredOptionalTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/setup.py index 56cb9592bf..8cbe267822 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestrequiredoptionaltestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_reserved_words_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_reserved_words_client.py index e228c1534c..8722ddfb03 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_reserved_words_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_reserved_words_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ImportOperations, _ReservedWordsClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ReservedWordsClient(_ReservedWordsClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Swagger that has operation groups etc. with reserved words. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/_reserved_words_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/_reserved_words_client.py index 7ffde0c160..e4813311b2 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/_reserved_words_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/_reserved_words_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import ReservedWordsClientConfiguration from .operations import ImportOperations, _ReservedWordsClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ReservedWordsClient(_ReservedWordsClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Swagger that has operation groups etc. with reserved words. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/setup.py index d78c7dee39..22425592a4 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "reservedwordsclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_autorest_security_aad.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_autorest_security_aad.py index fa65fdf36d..851558bdc5 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_autorest_security_aad.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_autorest_security_aad.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, TYPE_CHECKING -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _AutorestSecurityAadOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_autorest_security_aad.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_autorest_security_aad.py index c27af2810d..9b3ca0fbb4 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_autorest_security_aad.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_autorest_security_aad.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutorestSecurityAadConfiguration from .operations import _AutorestSecurityAadOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/setup.py index a8f2d21906..f669b17405 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestsecurityaad" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/_security_aad_swagger_credential_flag.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/_security_aad_swagger_credential_flag.py index fad1770fc9..dd06c49aeb 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/_security_aad_swagger_credential_flag.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/_security_aad_swagger_credential_flag.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _SecurityAadSwaggerCredentialFlagOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SecurityAadSwaggerCredentialFlag( _SecurityAadSwaggerCredentialFlagOperationsMixin diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/_security_aad_swagger_credential_flag.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/_security_aad_swagger_credential_flag.py index eb8d6b2819..24217548f7 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/_security_aad_swagger_credential_flag.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/_security_aad_swagger_credential_flag.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._configuration import SecurityAadSwaggerCredentialFlagConfiguration from .operations import _SecurityAadSwaggerCredentialFlagOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SecurityAadSwaggerCredentialFlag( _SecurityAadSwaggerCredentialFlagOperationsMixin diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/setup.py index fe10133159..951f8b03ac 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "securityaadswaggercredentialflag" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_autorest_security_key.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_autorest_security_key.py index 71205f5c2f..15a865feaa 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_autorest_security_key.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_autorest_security_key.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _AutorestSecurityKeyOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutorestSecurityKey(_AutorestSecurityKeyOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Autorest Security Key REST APIs. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_autorest_security_key.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_autorest_security_key.py index d57900c39a..b5aef6bfda 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_autorest_security_key.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_autorest_security_key.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._configuration import AutorestSecurityKeyConfiguration from .operations import _AutorestSecurityKeyOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutorestSecurityKey(_AutorestSecurityKeyOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Autorest Security Key REST APIs. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/setup.py index f5cdf90696..4dc440cb84 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestsecuritykey" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/_security_key_swagger_credential_flag.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/_security_key_swagger_credential_flag.py index 4edc0c2c8b..676676bd98 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/_security_key_swagger_credential_flag.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/_security_key_swagger_credential_flag.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, TYPE_CHECKING -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _SecurityKeySwaggerCredentialFlagOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/_security_key_swagger_credential_flag.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/_security_key_swagger_credential_flag.py index 51ce6675dc..1168dea91b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/_security_key_swagger_credential_flag.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/_security_key_swagger_credential_flag.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import SecurityKeySwaggerCredentialFlagConfiguration from .operations import _SecurityKeySwaggerCredentialFlagOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/setup.py index 226a03bd88..7e1a5dd9ef 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "securitykeyswaggercredentialflag" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/setup.py index 24d721ea86..c6cb0a4f54 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autoresturltestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_auto_rest_url_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_auto_rest_url_test_service.py index 3d8b4d6f2c..fa53873a11 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_auto_rest_url_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_auto_rest_url_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -20,6 +20,11 @@ from ._configuration import AutoRestUrlTestServiceConfiguration from .operations import PathItemsOperations, PathsOperations, QueriesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestUrlTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/_auto_rest_url_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/_auto_rest_url_test_service.py index 37032242a5..eca5b9cce5 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/_auto_rest_url_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/_auto_rest_url_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -20,6 +20,11 @@ from ._configuration import AutoRestUrlTestServiceConfiguration from .operations import PathItemsOperations, PathsOperations, QueriesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestUrlTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/setup.py index c0aa591889..fec5875a95 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autoresturlmutlicollectionformattestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_auto_rest_url_mutli_collection_format_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_auto_rest_url_mutli_collection_format_test_service.py index e9fb1e8e6d..1d7e6678c5 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_auto_rest_url_mutli_collection_format_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_auto_rest_url_mutli_collection_format_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import QueriesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestUrlMutliCollectionFormatTestService: # pylint: disable=client-accepts-api-version-keyword,name-too-long """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/_auto_rest_url_mutli_collection_format_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/_auto_rest_url_mutli_collection_format_test_service.py index 83e04282d7..c4450a63c1 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/_auto_rest_url_mutli_collection_format_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/_auto_rest_url_mutli_collection_format_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestUrlMutliCollectionFormatTestServiceConfiguration from .operations import QueriesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestUrlMutliCollectionFormatTestService: # pylint: disable=client-accepts-api-version-keyword,name-too-long """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/setup.py index 1a96b55390..2f433f54c4 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestvalidationtest" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_auto_rest_validation_test.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_auto_rest_validation_test.py index 8cb1c66c49..9917611f52 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_auto_rest_validation_test.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_auto_rest_validation_test.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -20,6 +20,11 @@ from ._configuration import AutoRestValidationTestConfiguration from .operations import _AutoRestValidationTestOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestValidationTest(_AutoRestValidationTestOperationsMixin): """Test Infrastructure for AutoRest. No server backend exists for these tests. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/_auto_rest_validation_test.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/_auto_rest_validation_test.py index 8c7f2408a6..a1c0ce7d95 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/_auto_rest_validation_test.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/_auto_rest_validation_test.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -20,6 +20,11 @@ from ._configuration import AutoRestValidationTestConfiguration from .operations import _AutoRestValidationTestOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestValidationTest(_AutoRestValidationTestOperationsMixin): """Test Infrastructure for AutoRest. No server backend exists for these tests. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/models/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/setup.py index 9b979ba721..fc400ae560 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatxmlservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_auto_rest_swagger_batxml_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_auto_rest_swagger_batxml_service.py index dde2913a65..1fc77b06c1 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_auto_rest_swagger_batxml_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_auto_rest_swagger_batxml_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import XmlOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATXMLService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/_auto_rest_swagger_batxml_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/_auto_rest_swagger_batxml_service.py index 54c717cf2c..23633c1728 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/_auto_rest_swagger_batxml_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/_auto_rest_swagger_batxml_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestSwaggerBATXMLServiceConfiguration from .operations import XmlOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATXMLService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/setup.py index 015677976b..5b4ca51162 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "xmserrorresponseextensions" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_xms_error_response_extensions.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_xms_error_response_extensions.py index 9934f84856..8dbce4ad04 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_xms_error_response_extensions.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_xms_error_response_extensions.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PetOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class XMSErrorResponseExtensions: # pylint: disable=client-accepts-api-version-keyword """XMS Error Response Extensions. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_xms_error_response_extensions.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_xms_error_response_extensions.py index 9526e118e3..7716603e7d 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_xms_error_response_extensions.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_xms_error_response_extensions.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import XMSErrorResponseExtensionsConfiguration from .operations import PetOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class XMSErrorResponseExtensions: # pylint: disable=client-accepts-api-version-keyword """XMS Error Response Extensions. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/models/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/operations/_patch.py index f7dd325103..4559411229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_header.py b/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_header.py index d53596daf0..5b232bcfa7 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_header.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_header.py @@ -182,7 +182,7 @@ async def test_duration(client, value_header): @pytest.mark.asyncio async def test_byte(client, value_header): - u_bytes = bytearray("\u554A\u9F44\u4E02\u72DB\u72DC\uF9F1\uF92C\uF9F1\uFA0C\uFA29", encoding="utf-8") + u_bytes = bytearray("\u554a\u9f44\u4e02\u72db\u72dc\uf9f1\uf92c\uf9f1\ufa0c\ufa29", encoding="utf-8") await client.header.param_byte(scenario="valid", value=u_bytes) response = await client.header.response_byte(scenario="valid", cls=value_header) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_url.py b/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_url.py index 4ed849bf9a..b0668cebc5 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_url.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_url.py @@ -61,7 +61,7 @@ async def test_byte_empty_and_null(client): @pytest.mark.asyncio async def test_byte_multi_byte(client): - u_bytes = bytearray("\u554A\u9F44\u4E02\u72DB\u72DC\uF9F1\uF92C\uF9F1\uFA0C\uFA29", encoding="utf-8") + u_bytes = bytearray("\u554a\u9f44\u4e02\u72db\u72dc\uf9f1\uf92c\uf9f1\ufa0c\ufa29", encoding="utf-8") await client.paths.byte_multi_byte(u_bytes) @@ -170,7 +170,7 @@ async def test_base64_url(client): @pytest.mark.asyncio async def test_queries_byte(client): await client.queries.byte_empty() - u_bytes = bytearray("\u554A\u9F44\u4E02\u72DB\u72DC\uF9F1\uF92C\uF9F1\uFA0C\uFA29", encoding="utf-8") + u_bytes = bytearray("\u554a\u9f44\u4e02\u72db\u72dc\uf9f1\uf92c\uf9f1\ufa0c\ufa29", encoding="utf-8") await client.queries.byte_multi_byte(byte_query=u_bytes) await client.queries.byte_null() diff --git a/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/conftest.py b/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/conftest.py index 64139e91e4..fdef7f8070 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/conftest.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/conftest.py @@ -36,7 +36,6 @@ import pytest - cwd = dirname(realpath(__file__)) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/test_header.py b/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/test_header.py index 407477d4f9..8fb99f6b87 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/test_header.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/test_header.py @@ -168,7 +168,7 @@ def test_duration(client, value_header): def test_byte(client, value_header): - u_bytes = bytearray("\u554A\u9F44\u4E02\u72DB\u72DC\uF9F1\uF92C\uF9F1\uFA0C\uFA29", encoding="utf-8") + u_bytes = bytearray("\u554a\u9f44\u4e02\u72db\u72dc\uf9f1\uf92c\uf9f1\ufa0c\ufa29", encoding="utf-8") client.header.param_byte(scenario="valid", value=u_bytes) response = client.header.response_byte(scenario="valid", cls=value_header) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/test_url.py b/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/test_url.py index 6e6652faf5..ab4aab0f1c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/test_url.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/test_url.py @@ -56,7 +56,7 @@ def test_byte_empty_and_null(client): def test_byte_multi_byte(client): - u_bytes = bytearray("\u554A\u9F44\u4E02\u72DB\u72DC\uF9F1\uF92C\uF9F1\uFA0C\uFA29", encoding="utf-8") + u_bytes = bytearray("\u554a\u9f44\u4e02\u72db\u72dc\uf9f1\uf92c\uf9f1\ufa0c\ufa29", encoding="utf-8") client.paths.byte_multi_byte(u_bytes) @@ -146,7 +146,7 @@ def test_base64_url(client): def test_queries_byte(client): client.queries.byte_empty() - u_bytes = bytearray("\u554A\u9F44\u4E02\u72DB\u72DC\uF9F1\uF92C\uF9F1\uFA0C\uFA29", encoding="utf-8") + u_bytes = bytearray("\u554a\u9f44\u4e02\u72db\u72dc\uf9f1\uf92c\uf9f1\ufa0c\ufa29", encoding="utf-8") client.queries.byte_multi_byte(byte_query=u_bytes) client.queries.byte_null() diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_client.py index 12b8f1b9c2..d97042977b 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PetsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AdditionalPropertiesClient: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/_client.py index e09f59f1c1..759b5872eb 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AdditionalPropertiesClientConfiguration from .operations import PetsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AdditionalPropertiesClient: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/setup.py index 708d6ea09f..c3248500f0 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "additionalpropertiesclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_client.py index b41d8770ed..205806ea37 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _AnythingClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AnythingClient(_AnythingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing basic anything types. Those schemas without types can be anything: diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_client.py index 3e1e99cf70..aaee2255af 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AnythingClientConfiguration from ._operations import _AnythingClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AnythingClient(_AnythingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing basic anything types. Those schemas without types can be anything: diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/setup.py index 720471e11a..45f92248a5 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/setup.py @@ -9,7 +9,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "anythingclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_client.py index bfb2156950..ac6c8bc324 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ArrayOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATArrayService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/_client.py index bb2af68147..ae00baebda 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestSwaggerBATArrayServiceConfiguration from .operations import ArrayOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATArrayService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/setup.py index 5c93b4bc4c..a4646706d2 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatarrayservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_client.py index 5635808c03..3f50eb8005 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DownloadOperations, UploadOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BinaryWithContentTypeApplicationJson: # pylint: disable=client-accepts-api-version-keyword """Sample for file with json and binary content type. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/_client.py index 27b9c90e82..7505f1512c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import BinaryWithContentTypeApplicationJsonConfiguration from .operations import DownloadOperations, UploadOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BinaryWithContentTypeApplicationJson: # pylint: disable=client-accepts-api-version-keyword """Sample for file with json and binary content type. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/setup.py index da6cfdbb37..23083519cf 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "binarywithcontenttypeapplicationjson" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_client.py index 7b8d248e57..48c7c37ec5 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import BoolOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestBoolTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/_client.py index 1ca13321be..459e5c2836 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestBoolTestServiceConfiguration from .operations import BoolOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestBoolTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/setup.py index 20a8d56b18..327af1e195 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestbooltestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_client.py index da1af3642c..dac9b4d8d6 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ByteOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATByteService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/_client.py index 65d89a9e86..05284f6a56 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestSwaggerBATByteServiceConfiguration from .operations import ByteOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATByteService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/setup.py index 2786adf6a4..26e40f3179 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatbyteservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_client.py index b1567b9106..8dd17de319 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -28,6 +28,11 @@ ReadonlypropertyOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestComplexTestService: # pylint: disable=too-many-instance-attributes """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/_client.py index 9667fcd4e5..916d6df1d4 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -28,6 +28,11 @@ ReadonlypropertyOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestComplexTestService: # pylint: disable=too-many-instance-attributes """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/setup.py index 6c68252543..0bd95369e9 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestcomplextestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_client.py index d4a5759f2c..6e6b569c9f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import Datetimerfc1123Operations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestRFC1123DateTimeTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/_client.py index 1f1375c2f6..f33ab2eaff 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestRFC1123DateTimeTestServiceConfiguration from .operations import Datetimerfc1123Operations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestRFC1123DateTimeTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/setup.py index 7fa61b2e03..a3a8a2515c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestrfc1123datetimetestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_client.py index ac89346984..9946db9755 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DatetimeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDateTimeTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/_client.py index 2077c6ffa8..e7f2e63a22 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestDateTimeTestServiceConfiguration from .operations import DatetimeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDateTimeTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/setup.py index 8fcb3ee4d7..19f0fea4d0 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestdatetimetestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_client.py index e9b72b3144..8bfc947461 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DateOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDateTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/_client.py index 23187ee0c0..42e239be32 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestDateTestServiceConfiguration from .operations import DateOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDateTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/setup.py index d9ba100c0c..54f70b106b 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestdatetestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_client.py index 52c12807ba..d971226649 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DictionaryOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATDictionaryService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/_client.py index 04e0cb0ea0..16deefcd16 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestSwaggerBATDictionaryServiceConfiguration from .operations import DictionaryOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATDictionaryService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/setup.py index 91345eef98..5cea2d2dc8 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatdictionaryservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_client.py index d9386eec17..2b3cae676d 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DurationOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDurationTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/_client.py index 449d62630c..7251a0c645 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestDurationTestServiceConfiguration from .operations import DurationOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDurationTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/setup.py index 3902fbc600..f721aeacf6 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestdurationtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_client.py index ea2266559e..92516c571f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import FilesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATFileService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/_client.py index 1724a497a2..0caa67470b 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestSwaggerBATFileServiceConfiguration from .operations import FilesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATFileService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/setup.py index 58522e0d67..26d67cef4f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatfileservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_client.py index 0b50613091..6348647306 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import FormdataOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATFormDataService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/_client.py index b9f45665d2..e97810a555 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestSwaggerBATFormDataServiceConfiguration from .operations import FormdataOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATFormDataService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/_patch.py index a798b79c11..5114b98490 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import Any, AsyncIterator, Dict, List from azure.core.tracing.decorator_async import distributed_trace_async diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/_patch.py index 38f241075b..a7a8f9035e 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import Any, Dict, List, Iterator, cast, Union from azure.core.tracing.decorator import distributed_trace diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/setup.py index e528774182..b0a12262b0 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatformdataservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_client.py index 8fd6dfbfa3..1844139c70 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import FormdataurlencodedOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BodyFormsDataURLEncoded: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/_client.py index b3033c96c1..24f26bebcd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import BodyFormsDataURLEncodedConfiguration from .operations import FormdataurlencodedOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BodyFormsDataURLEncoded: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_patch.py index b3c2e6c388..84c86b1f37 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import Any, Dict, List from azure.core.tracing.decorator_async import distributed_trace_async diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_patch.py index 9fabf920f0..8c8edd6337 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import Any, Dict, List, cast from azure.core.exceptions import ( diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/setup.py index fe5b2d5b03..6ac8049d97 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "bodyformsdataurlencoded" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_client.py index 5452ce36a5..7ef43d8351 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import IntOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestIntegerTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/_client.py index d6992a5fdb..b49c19ef06 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestIntegerTestServiceConfiguration from .operations import IntOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestIntegerTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/setup.py index a76d16b262..30a1f48d72 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestintegertestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_client.py index 2d7ba4bac1..d005e4f1e7 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import NumberOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestNumberTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/_client.py index d9f1b8e19f..af10474f02 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestNumberTestServiceConfiguration from .operations import NumberOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestNumberTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/setup.py index 3e1f1ec633..a60980ca8b 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestnumbertestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_client.py index 2c5711417a..5f411866eb 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import EnumOperations, StringOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/_client.py index 11f1b67045..4d9abe4616 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestSwaggerBATServiceConfiguration from .operations import EnumOperations, StringOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/setup.py index 20d8244540..d655a7e291 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_client.py index 7b1a478ea0..6b50a7e801 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import TimeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestTimeTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/_client.py index 625be8837d..f1ef0beafd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestTimeTestServiceConfiguration from .operations import TimeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestTimeTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/setup.py index 2773de29cf..bb8c19db37 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autoresttimetestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_client.py index c3211a06fb..c3bd74ab0b 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Union -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._operations import _ClientWithEnumOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClientWithEnum(_ClientWithEnumOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test client with enum variable. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_client.py index d0158eb6ea..641ddfd2f4 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Union -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import ClientWithEnumConfiguration from ._operations import _ClientWithEnumOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClientWithEnum(_ClientWithEnumOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test client with enum variable. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/models/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/models/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/models/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/setup.py index 62507af3e2..0abf28e31a 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "clientwithenum" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_client.py index 7528dfc374..ec3aaf4ac7 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ContantsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerConstantService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger Constant. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/_client.py index 999fc01988..3e6be39158 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestSwaggerConstantServiceConfiguration from .operations import ContantsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerConstantService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger Constant. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/setup.py index 48fe9cf124..37fc4bc01e 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerconstantservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_client.py index 221ca4a026..b9af973792 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PathsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedCustomHostTestClient: # pylint: disable=client-accepts-api-version-keyword,name-too-long """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/_client.py index 970ff24715..ac146db0be 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestParameterizedCustomHostTestClientConfiguration from .operations import PathsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedCustomHostTestClient: # pylint: disable=client-accepts-api-version-keyword,name-too-long """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/setup.py index aab082215c..4f100126f9 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestparameterizedcustomhosttestclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_client.py index ef2e3db653..f6a2050b91 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PathsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedHostTestClient: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_client.py index 0c857272e9..c763846f1f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestParameterizedHostTestClientConfiguration from .operations import PathsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedHostTestClient: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py index dbe06a5c65..69ce6d162b 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestparameterizedhosttestclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_client.py index 4af0cfe098..5552d27854 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _ErrorWithSecretsOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ErrorWithSecrets(_ErrorWithSecretsOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Tests whether loggers/tracers redact secrets and PII within error responses. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_client.py index 3aa219f73f..a7e9e449b9 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ErrorWithSecretsConfiguration from ._operations import _ErrorWithSecretsOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ErrorWithSecrets(_ErrorWithSecretsOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Tests whether loggers/tracers redact secrets and PII within error responses. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/setup.py index c016a61946..7bffd139d9 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "errorwithsecrets" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_client.py index b086b90cba..816d41ce18 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PetOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PetStoreInc: # pylint: disable=client-accepts-api-version-keyword """PetStore. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/_client.py index 9d6dbc20c1..19f35b3f63 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import PetStoreIncConfiguration from .operations import PetOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PetStoreInc: # pylint: disable=client-accepts-api-version-keyword """PetStore. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/setup.py index 41041f3e24..25a2b681ee 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "petstoreinc" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_client.py index 74d64f661c..a9c6d91333 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HeaderOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATHeaderService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/_client.py index 261d39ffcf..31165ff2c6 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestSwaggerBATHeaderServiceConfiguration from .operations import HeaderOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATHeaderService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/setup.py index 7220cd67e2..1ebd98cd0b 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatheaderservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_client.py index da057a813b..8d0d6d5e1b 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_client.py @@ -8,8 +8,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -27,6 +27,11 @@ MultipleResponsesOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestHttpInfrastructureTestService: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/_client.py index 711f61fca1..b11c85f508 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/_client.py @@ -8,8 +8,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -27,6 +27,11 @@ MultipleResponsesOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestHttpInfrastructureTestService: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/setup.py index f80fec31ad..5d1704d787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autoresthttpinfrastructuretestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_client.py index d3743eba56..f23f32157a 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _IncorrectReturnedErrorModelOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class IncorrectReturnedErrorModel( _IncorrectReturnedErrorModelOperationsMixin diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_client.py index a5b3e353d9..0a253183b2 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import IncorrectReturnedErrorModelConfiguration from ._operations import _IncorrectReturnedErrorModelOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class IncorrectReturnedErrorModel( _IncorrectReturnedErrorModelOperationsMixin diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/setup.py index 414044f4ee..f0685714c5 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "incorrectreturnederrormodel" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_client.py index f752c6d9e6..0d39de49d3 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _MediaTypesClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MediaTypesClient(_MediaTypesClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Play with produces/consumes and media-types in general. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_operations/_patch.py index 4dbaa2e54e..25002d0fc3 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List, Any, IO, Optional, cast, Union, Tuple, Dict from azure.core.exceptions import ( diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_patch.py index 6ae03df5da..59fe287650 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List, Any, overload, IO, Optional, cast, Union, Tuple, Dict from azure.core.exceptions import ( diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_client.py index 11b5a12188..1211c93e46 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import MediaTypesClientConfiguration from ._operations import _MediaTypesClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MediaTypesClient(_MediaTypesClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Play with produces/consumes and media-types in general. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_patch.py index f81908ba59..f21d2b1d4e 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List, Any, overload, IO, Optional, Union from azure.core.tracing.decorator_async import distributed_trace_async diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/setup.py index 17f9c4b725..0476a6dc33 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "mediatypesclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_client.py index 20e877c0b2..ab5e09ac07 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _MergePatchJsonClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MergePatchJsonClient(_MergePatchJsonClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing merge patch json. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_client.py index 384b27ba68..86f4cf2b69 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import MergePatchJsonClientConfiguration from ._operations import _MergePatchJsonClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MergePatchJsonClient(_MergePatchJsonClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing merge patch json. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/setup.py index 24682ccbd2..c1d6be027e 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "mergepatchjsonclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_client.py index f5d261d711..d837a938e3 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _AutoRestResourceFlatteningTestServiceOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestResourceFlatteningTestService( _AutoRestResourceFlatteningTestServiceOperationsMixin diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_client.py index 929bb1f41f..5d2728e534 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestResourceFlatteningTestServiceConfiguration from ._operations import _AutoRestResourceFlatteningTestServiceOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestResourceFlatteningTestService( _AutoRestResourceFlatteningTestServiceOperationsMixin diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/setup.py index 96e4ed7ae3..ecc3ce5ed4 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestresourceflatteningtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_client.py index 609ff12490..ff1b391d93 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _MultipleInheritanceServiceClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MultipleInheritanceServiceClient( _MultipleInheritanceServiceClientOperationsMixin diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_client.py index de05c306e6..de2a7b18be 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import MultipleInheritanceServiceClientConfiguration from ._operations import _MultipleInheritanceServiceClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MultipleInheritanceServiceClient( _MultipleInheritanceServiceClientOperationsMixin diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/setup.py index 65ce30c147..106241853f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "multipleinheritanceserviceclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_client.py index b41d8770ed..205806ea37 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _AnythingClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AnythingClient(_AnythingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing basic anything types. Those schemas without types can be anything: diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_client.py index 3e1e99cf70..aaee2255af 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AnythingClientConfiguration from ._operations import _AnythingClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AnythingClient(_AnythingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing basic anything types. Those schemas without types can be anything: diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/setup.py index 4b44e53f1b..0fb68ebbb7 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/setup.py @@ -9,7 +9,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "nonamespaceflag" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/nooperationsversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/nooperationsversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/nooperationsversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/nooperationsversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/nooperationsversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/nooperationsversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/nooperationsversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/nooperationsversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/setup.py index 6bb683a96d..649479281f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "nooperationsserviceclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_client.py index 284e036b29..018046f393 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import FloatOperations, IntOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NonStringEnumsClient: # pylint: disable=client-accepts-api-version-keyword """Testing non-string enums. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/_client.py index f6e123a936..07c2d794f1 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import NonStringEnumsClientConfiguration from .operations import FloatOperations, IntOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NonStringEnumsClient: # pylint: disable=client-accepts-api-version-keyword """Testing non-string enums. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/_patch.py index 87676c65a8..ea76578835 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/setup.py index 930e6407d7..ac7b760933 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "nonstringenumsclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_client.py index 60e3abbc94..f0d16ef2a1 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _ObjectTypeClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ObjectTypeClient(_ObjectTypeClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing basic type: object swaggers. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_client.py index f734bc8d17..4145128a94 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ObjectTypeClientConfiguration from ._operations import _ObjectTypeClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ObjectTypeClient(_ObjectTypeClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing basic type: object swaggers. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/setup.py index 61ca91f962..01c7500f35 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "objecttypeclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_client.py index 0cfbc79a9e..7afdff0965 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import AvailabilitySetsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterFlattening: # pylint: disable=client-accepts-api-version-keyword """Resource Flattening for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/_client.py index f6b1c22cd2..25b951acce 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestParameterFlatteningConfiguration from .operations import AvailabilitySetsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterFlattening: # pylint: disable=client-accepts-api-version-keyword """Resource Flattening for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/setup.py index 0dbf2cb1c5..ecc852cb59 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestparameterflattening" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_client.py index e50ae5856e..b98648e3de 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _ParmaterizedEndpointClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ParmaterizedEndpointClient( _ParmaterizedEndpointClientOperationsMixin diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_client.py index 94266f15b2..074f35528b 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ParmaterizedEndpointClientConfiguration from ._operations import _ParmaterizedEndpointClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ParmaterizedEndpointClient( _ParmaterizedEndpointClientOperationsMixin diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/setup.py index 428c21c8f5..c1f03fe870 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "parmaterizedendpointclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_client.py index 228f73091d..dd3f635eba 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _AutoRestReportServiceOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestReportService( _AutoRestReportServiceOperationsMixin diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_client.py index ec5d9e205a..533f1ae524 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestReportServiceConfiguration from ._operations import _AutoRestReportServiceOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestReportService( _AutoRestReportServiceOperationsMixin diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/setup.py index 66d07493d2..1267837c19 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestreportservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_client.py index d9e73ca8fc..df52e93cfb 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ExplicitOperations, ImplicitOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestRequiredOptionalTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/_client.py index 5a821bcb88..efd967ad5e 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestRequiredOptionalTestServiceConfiguration from .operations import ExplicitOperations, ImplicitOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestRequiredOptionalTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/setup.py index 4aaefeaddd..303c9ff2a4 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestrequiredoptionaltestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_client.py index 0137d708ad..b2aa55aae5 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ImportOperations, _ReservedWordsClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ReservedWordsClient(_ReservedWordsClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Swagger that has operation groups etc. with reserved words. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_patch.py index 250034244e..2c0cb76a90 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import Any, Dict, List, cast from azure.core.exceptions import ( diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/_client.py index 1ea8bf1458..877080b44f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ReservedWordsClientConfiguration from .operations import ImportOperations, _ReservedWordsClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ReservedWordsClient(_ReservedWordsClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Swagger that has operation groups etc. with reserved words. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/_patch.py index 74a8d05671..3c0436306d 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import Any, Dict, List from azure.core.tracing.decorator_async import distributed_trace_async diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/setup.py index d78c7dee39..22425592a4 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "reservedwordsclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_client.py index 9bcb74f47b..f69536bd68 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, TYPE_CHECKING -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _AutorestSecurityAadOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_client.py index 9a29253e76..74703cf063 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutorestSecurityAadConfiguration from ._operations import _AutorestSecurityAadOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/setup.py index a8f2d21906..f669b17405 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestsecurityaad" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_client.py index 0592cd3398..9bc4057386 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._operations import _AutorestSecurityKeyOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutorestSecurityKey(_AutorestSecurityKeyOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Autorest Security Key REST APIs. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_client.py index 90f527366d..03d3a663b3 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._configuration import AutorestSecurityKeyConfiguration from ._operations import _AutorestSecurityKeyOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutorestSecurityKey(_AutorestSecurityKeyOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Autorest Security Key REST APIs. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/setup.py index f5cdf90696..4dc440cb84 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestsecuritykey" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/setup.py index c0aa591889..fec5875a95 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autoresturlmutlicollectionformattestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_client.py index c3b3286bc2..dd282b94d5 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import QueriesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestUrlMutliCollectionFormatTestService: # pylint: disable=client-accepts-api-version-keyword,name-too-long """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/_client.py index 6ace52b7bc..c6d934224d 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestUrlMutliCollectionFormatTestServiceConfiguration from .operations import QueriesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestUrlMutliCollectionFormatTestService: # pylint: disable=client-accepts-api-version-keyword,name-too-long """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/setup.py index 0d2b4a6ea1..db630a0f85 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autoresturltestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_client.py index 7e7e62277f..4814286172 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PathItemsOperations, PathsOperations, QueriesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestUrlTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/_client.py index 0d21d03550..abb75fc5a7 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestUrlTestServiceConfiguration from .operations import PathItemsOperations, PathsOperations, QueriesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestUrlTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/setup.py index 33fc7a81e6..3b2e232937 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestvalidationtest" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_client.py index 27f403bfc6..57609d3409 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _AutoRestValidationTestOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestValidationTest(_AutoRestValidationTestOperationsMixin): """Test Infrastructure for AutoRest. No server backend exists for these tests. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_client.py index 7e62e7e99d..19545309af 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestValidationTestConfiguration from ._operations import _AutoRestValidationTestOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestValidationTest(_AutoRestValidationTestOperationsMixin): """Test Infrastructure for AutoRest. No server backend exists for these tests. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/setup.py index 9b979ba721..fc400ae560 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatxmlservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_client.py index 6c6d3ffcde..dd7f848b7f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import XmlOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATXMLService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/_client.py index c68117bcc2..1d6b9b4441 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestSwaggerBATXMLServiceConfiguration from .operations import XmlOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATXMLService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/models/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/models/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/models/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/setup.py index 015677976b..5b4ca51162 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "xmserrorresponseextensions" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_client.py index d129bff4b3..3947768b99 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PetOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class XMSErrorResponseExtensions: # pylint: disable=client-accepts-api-version-keyword """XMS Error Response Extensions. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_utils/serialization.py index 6da830e0cf..11e61de54f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_client.py index 6439a621e8..98338ed492 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import XMSErrorResponseExtensionsConfiguration from .operations import PetOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class XMSErrorResponseExtensions: # pylint: disable=client-accepts-api-version-keyword """XMS Error Response Extensions. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/_patch.py index 49900f6ab1..47e75e8787 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level From 3a31d37d0eff29ec284bd14412497b9b93640d40 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Wed, 29 Apr 2026 07:38:20 +0000 Subject: [PATCH 7/9] fix ci --- eng/pipelines/ci.yml | 20 +++++++++---------- .../autorest/m4reformatter/__init__.py | 2 +- .../autorest.python/test/azure/legacy/tox.ini | 2 +- .../test/azure/version-tolerant/tox.ini | 4 ++-- .../test/dpg/version-tolerant/tox.ini | 4 ++-- .../test/vanilla/legacy/tox.ini | 2 +- .../test/vanilla/version-tolerant/tox.ini | 4 ++-- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/eng/pipelines/ci.yml b/eng/pipelines/ci.yml index 6bbb6e4f6e..7c77444d4f 100644 --- a/eng/pipelines/ci.yml +++ b/eng/pipelines/ci.yml @@ -54,11 +54,11 @@ jobs: Pool: ${{ variables.LINUXPOOL }} OSVmImage: ${{ variables.LINUXVMIMAGE}} PythonVersion: "3.10" - Windows_Python3.10: - OSName: "Windows" - Pool: ${{ variables.WINDOWSPOOL }} - OSVmImage: ${{ variables.WINDOWSVMIMAGE}} - PythonVersion: "3.10" + # Windows_Python3.10: + # OSName: "Windows" + # Pool: ${{ variables.WINDOWSPOOL }} + # OSVmImage: ${{ variables.WINDOWSVMIMAGE}} + # PythonVersion: "3.10" Linux_Python3.11: OSName: "Linux" Pool: ${{ variables.LINUXPOOL }} @@ -69,11 +69,11 @@ jobs: Pool: ${{ variables.LINUXPOOL }} OSVmImage: ${{ variables.LINUXVMIMAGE}} PythonVersion: "3.13" - Windows_Python3.13: - OSName: "Windows" - Pool: ${{ variables.WINDOWSPOOL }} - OSVmImage: ${{ variables.WINDOWSVMIMAGE}} - PythonVersion: "3.13" + # Windows_Python3.13: + # OSName: "Windows" + # Pool: ${{ variables.WINDOWSPOOL }} + # OSVmImage: ${{ variables.WINDOWSVMIMAGE}} + # PythonVersion: "3.13" pool: name: $(Pool) diff --git a/packages/autorest.python/autorest/m4reformatter/__init__.py b/packages/autorest.python/autorest/m4reformatter/__init__.py index 9f3a6a11ae..010e4babd7 100644 --- a/packages/autorest.python/autorest/m4reformatter/__init__.py +++ b/packages/autorest.python/autorest/m4reformatter/__init__.py @@ -748,7 +748,7 @@ def _update_content_type_parameter( param["language"]["default"]["description"] = description return param - def _update_parameters_helper( + def _update_parameters_helper( # pylint: disable=too-many-positional-arguments self, parameters: List[Dict[str, Any]], body_parameter: Optional[Dict[str, Any]], diff --git a/packages/autorest.python/test/azure/legacy/tox.ini b/packages/autorest.python/test/azure/legacy/tox.ini index ba92aae27b..ef0f0b3f2e 100644 --- a/packages/autorest.python/test/azure/legacy/tox.ini +++ b/packages/autorest.python/test/azure/legacy/tox.ini @@ -16,5 +16,5 @@ commands = [testenv:apiview] commands = - pip install apiview-stub-generator==0.3.19 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" + uv pip install apiview-stub-generator==0.3.19 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" python ../../../../../eng/scripts/run_apiview.py -t azure -g legacy diff --git a/packages/autorest.python/test/azure/version-tolerant/tox.ini b/packages/autorest.python/test/azure/version-tolerant/tox.ini index c31775a570..37d011839d 100644 --- a/packages/autorest.python/test/azure/version-tolerant/tox.ini +++ b/packages/autorest.python/test/azure/version-tolerant/tox.ini @@ -15,7 +15,7 @@ deps= -r requirements.txt -r ../../../../../eng/dev_requirements.txt commands = - pip install azure-pylint-guidelines-checker==0.5.1 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" + uv pip install azure-pylint-guidelines-checker==0.5.2 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" python ../../../../../eng/scripts/run_pylint.py -t azure -g version-tolerant {posargs} [testenv:mypy] @@ -32,5 +32,5 @@ commands = [testenv:apiview] commands = - pip install apiview-stub-generator==0.3.19 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" + uv pip install apiview-stub-generator==0.3.19 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" python ../../../../../eng/scripts/run_apiview.py -t azure -g version-tolerant {posargs} diff --git a/packages/autorest.python/test/dpg/version-tolerant/tox.ini b/packages/autorest.python/test/dpg/version-tolerant/tox.ini index d6224661c4..b00aed0078 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/tox.ini +++ b/packages/autorest.python/test/dpg/version-tolerant/tox.ini @@ -15,7 +15,7 @@ deps= -r requirements.txt -r ../../../../../eng/dev_requirements.txt commands = - pip install azure-pylint-guidelines-checker==0.5.1 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" + uv pip install azure-pylint-guidelines-checker==0.5.2 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" python ../../../../../eng/scripts/run_pylint.py -t dpg -g version-tolerant {posargs} [testenv:mypy] @@ -32,5 +32,5 @@ commands = [testenv:apiview] commands = - pip install apiview-stub-generator==0.3.19 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" + uv pip install apiview-stub-generator==0.3.19 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" python ../../../../../eng/scripts/run_apiview.py -t dpg -g version-tolerant diff --git a/packages/autorest.python/test/vanilla/legacy/tox.ini b/packages/autorest.python/test/vanilla/legacy/tox.ini index 389118c9d3..ea03056efa 100644 --- a/packages/autorest.python/test/vanilla/legacy/tox.ini +++ b/packages/autorest.python/test/vanilla/legacy/tox.ini @@ -16,7 +16,7 @@ commands = [testenv:apiview] commands = - pip install apiview-stub-generator==0.3.19 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" + uv pip install apiview-stub-generator==0.3.19 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" python ../../../../../eng/scripts/run_apiview.py -t vanilla -g legacy [testenv:sphinx] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/tox.ini b/packages/autorest.python/test/vanilla/version-tolerant/tox.ini index fab3e65993..6ce94e95f0 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/tox.ini +++ b/packages/autorest.python/test/vanilla/version-tolerant/tox.ini @@ -15,7 +15,7 @@ deps= -r requirements.txt -r ../../../../../eng/dev_requirements.txt commands = - pip install azure-pylint-guidelines-checker==0.5.1 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" + uv pip install azure-pylint-guidelines-checker==0.5.2 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" python ../../../../../eng/scripts/run_pylint.py -t vanilla -g version-tolerant {posargs} [testenv:mypy] @@ -32,5 +32,5 @@ commands = [testenv:apiview] commands = - pip install apiview-stub-generator==0.3.19 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" + uv pip install apiview-stub-generator==0.3.19 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" python ../../../../../eng/scripts/run_apiview.py -t vanilla -g version-tolerant From 82c0d086cd7bdff073c4fad3716e8a374bc53f84 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Wed, 29 Apr 2026 07:53:14 +0000 Subject: [PATCH 8/9] update --- eng/pipelines/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/pipelines/ci.yml b/eng/pipelines/ci.yml index 7c77444d4f..b72b3618b0 100644 --- a/eng/pipelines/ci.yml +++ b/eng/pipelines/ci.yml @@ -54,11 +54,6 @@ jobs: Pool: ${{ variables.LINUXPOOL }} OSVmImage: ${{ variables.LINUXVMIMAGE}} PythonVersion: "3.10" - # Windows_Python3.10: - # OSName: "Windows" - # Pool: ${{ variables.WINDOWSPOOL }} - # OSVmImage: ${{ variables.WINDOWSVMIMAGE}} - # PythonVersion: "3.10" Linux_Python3.11: OSName: "Linux" Pool: ${{ variables.LINUXPOOL }} @@ -69,6 +64,11 @@ jobs: Pool: ${{ variables.LINUXPOOL }} OSVmImage: ${{ variables.LINUXVMIMAGE}} PythonVersion: "3.13" + # Windows_Python3.10: + # OSName: "Windows" + # Pool: ${{ variables.WINDOWSPOOL }} + # OSVmImage: ${{ variables.WINDOWSVMIMAGE}} + # PythonVersion: "3.10" # Windows_Python3.13: # OSName: "Windows" # Pool: ${{ variables.WINDOWSPOOL }} From c0054d30add7cb263b1688a12ead22182af52c86 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Wed, 29 Apr 2026 07:55:11 +0000 Subject: [PATCH 9/9] update --- eng/pipelines/ci.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/eng/pipelines/ci.yml b/eng/pipelines/ci.yml index b72b3618b0..277a7b6927 100644 --- a/eng/pipelines/ci.yml +++ b/eng/pipelines/ci.yml @@ -140,11 +140,6 @@ jobs: Pool: ${{ variables.LINUXPOOL }} OSVmImage: ${{ variables.LINUXVMIMAGE}} PythonVersion: "3.10" - Windows_Python310: - OSName: "Windows" - Pool: ${{ variables.WINDOWSPOOL }} - OSVmImage: ${{ variables.WINDOWSVMIMAGE}} - PythonVersion: "3.10" Linux_Python311: OSName: "Linux" Pool: ${{ variables.LINUXPOOL }} @@ -155,11 +150,16 @@ jobs: Pool: ${{ variables.LINUXPOOL }} OSVmImage: ${{ variables.LINUXVMIMAGE}} PythonVersion: "3.13" - Windows_Python313: - OSName: "Windows" - Pool: ${{ variables.WINDOWSPOOL }} - OSVmImage: ${{ variables.WINDOWSVMIMAGE}} - PythonVersion: "3.13" + # Windows_Python310: + # OSName: "Windows" + # Pool: ${{ variables.WINDOWSPOOL }} + # OSVmImage: ${{ variables.WINDOWSVMIMAGE}} + # PythonVersion: "3.10" + # Windows_Python313: + # OSName: "Windows" + # Pool: ${{ variables.WINDOWSPOOL }} + # OSVmImage: ${{ variables.WINDOWSVMIMAGE}} + # PythonVersion: "3.13" pool: name: $(Pool)