@azure-tools/typespec-python 0.32.1 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/dist/scripts/copy-scripts.d.ts +2 -0
  2. package/dist/scripts/copy-scripts.d.ts.map +1 -0
  3. package/dist/scripts/copy-scripts.js +24 -0
  4. package/dist/scripts/copy-scripts.js.map +1 -0
  5. package/dist/scripts/eng/lint.js +1 -1
  6. package/dist/scripts/eng/lint.js.map +1 -1
  7. package/dist/src/emitter.d.ts +0 -2
  8. package/dist/src/emitter.d.ts.map +1 -1
  9. package/dist/src/emitter.js +2 -102
  10. package/dist/src/emitter.js.map +1 -1
  11. package/dist/src/index.d.ts +1 -1
  12. package/dist/src/index.d.ts.map +1 -1
  13. package/dist/src/index.js +1 -1
  14. package/dist/src/index.js.map +1 -1
  15. package/package.json +22 -19
  16. package/scripts/__pycache__/venvtools.cpython-310.pyc +0 -0
  17. package/scripts/copy-scripts.ts +26 -0
  18. package/scripts/eng/lint.ts +1 -1
  19. package/scripts/eng/pylintrc +2 -1
  20. package/dist/src/code-model.d.ts +0 -4
  21. package/dist/src/code-model.d.ts.map +0 -1
  22. package/dist/src/code-model.js +0 -190
  23. package/dist/src/code-model.js.map +0 -1
  24. package/dist/src/external-process.d.ts +0 -20
  25. package/dist/src/external-process.d.ts.map +0 -1
  26. package/dist/src/external-process.js +0 -44
  27. package/dist/src/external-process.js.map +0 -1
  28. package/dist/src/http.d.ts +0 -7
  29. package/dist/src/http.d.ts.map +0 -1
  30. package/dist/src/http.js +0 -266
  31. package/dist/src/http.js.map +0 -1
  32. package/dist/src/types.d.ts +0 -36
  33. package/dist/src/types.d.ts.map +0 -1
  34. package/dist/src/types.js +0 -488
  35. package/dist/src/types.js.map +0 -1
  36. package/dist/src/utils.d.ts +0 -26
  37. package/dist/src/utils.d.ts.map +0 -1
  38. package/dist/src/utils.js +0 -151
  39. package/dist/src/utils.js.map +0 -1
  40. package/generator/LICENSE +0 -21
  41. package/generator/README.md +0 -1
  42. package/generator/dev_requirements.txt +0 -5
  43. package/generator/pygen/__init__.py +0 -107
  44. package/generator/pygen/_version.py +0 -7
  45. package/generator/pygen/black.py +0 -69
  46. package/generator/pygen/codegen/__init__.py +0 -338
  47. package/generator/pygen/codegen/_utils.py +0 -16
  48. package/generator/pygen/codegen/models/__init__.py +0 -204
  49. package/generator/pygen/codegen/models/base.py +0 -186
  50. package/generator/pygen/codegen/models/base_builder.py +0 -119
  51. package/generator/pygen/codegen/models/client.py +0 -430
  52. package/generator/pygen/codegen/models/code_model.py +0 -237
  53. package/generator/pygen/codegen/models/combined_type.py +0 -149
  54. package/generator/pygen/codegen/models/constant_type.py +0 -129
  55. package/generator/pygen/codegen/models/credential_types.py +0 -214
  56. package/generator/pygen/codegen/models/dictionary_type.py +0 -127
  57. package/generator/pygen/codegen/models/enum_type.py +0 -238
  58. package/generator/pygen/codegen/models/imports.py +0 -291
  59. package/generator/pygen/codegen/models/list_type.py +0 -143
  60. package/generator/pygen/codegen/models/lro_operation.py +0 -142
  61. package/generator/pygen/codegen/models/lro_paging_operation.py +0 -32
  62. package/generator/pygen/codegen/models/model_type.py +0 -362
  63. package/generator/pygen/codegen/models/operation.py +0 -530
  64. package/generator/pygen/codegen/models/operation_group.py +0 -184
  65. package/generator/pygen/codegen/models/paging_operation.py +0 -155
  66. package/generator/pygen/codegen/models/parameter.py +0 -412
  67. package/generator/pygen/codegen/models/parameter_list.py +0 -387
  68. package/generator/pygen/codegen/models/primitive_types.py +0 -659
  69. package/generator/pygen/codegen/models/property.py +0 -171
  70. package/generator/pygen/codegen/models/request_builder.py +0 -189
  71. package/generator/pygen/codegen/models/request_builder_parameter.py +0 -115
  72. package/generator/pygen/codegen/models/response.py +0 -348
  73. package/generator/pygen/codegen/models/utils.py +0 -23
  74. package/generator/pygen/codegen/serializers/__init__.py +0 -574
  75. package/generator/pygen/codegen/serializers/base_serializer.py +0 -21
  76. package/generator/pygen/codegen/serializers/builder_serializer.py +0 -1513
  77. package/generator/pygen/codegen/serializers/client_serializer.py +0 -295
  78. package/generator/pygen/codegen/serializers/enum_serializer.py +0 -15
  79. package/generator/pygen/codegen/serializers/general_serializer.py +0 -213
  80. package/generator/pygen/codegen/serializers/import_serializer.py +0 -127
  81. package/generator/pygen/codegen/serializers/metadata_serializer.py +0 -198
  82. package/generator/pygen/codegen/serializers/model_init_serializer.py +0 -33
  83. package/generator/pygen/codegen/serializers/model_serializer.py +0 -300
  84. package/generator/pygen/codegen/serializers/operation_groups_serializer.py +0 -89
  85. package/generator/pygen/codegen/serializers/operations_init_serializer.py +0 -44
  86. package/generator/pygen/codegen/serializers/parameter_serializer.py +0 -221
  87. package/generator/pygen/codegen/serializers/patch_serializer.py +0 -19
  88. package/generator/pygen/codegen/serializers/request_builders_serializer.py +0 -52
  89. package/generator/pygen/codegen/serializers/sample_serializer.py +0 -168
  90. package/generator/pygen/codegen/serializers/test_serializer.py +0 -293
  91. package/generator/pygen/codegen/serializers/types_serializer.py +0 -31
  92. package/generator/pygen/codegen/serializers/utils.py +0 -68
  93. package/generator/pygen/codegen/templates/client.py.jinja2 +0 -37
  94. package/generator/pygen/codegen/templates/client_container.py.jinja2 +0 -12
  95. package/generator/pygen/codegen/templates/config.py.jinja2 +0 -73
  96. package/generator/pygen/codegen/templates/config_container.py.jinja2 +0 -16
  97. package/generator/pygen/codegen/templates/conftest.py.jinja2 +0 -28
  98. package/generator/pygen/codegen/templates/enum.py.jinja2 +0 -13
  99. package/generator/pygen/codegen/templates/enum_container.py.jinja2 +0 -10
  100. package/generator/pygen/codegen/templates/init.py.jinja2 +0 -24
  101. package/generator/pygen/codegen/templates/keywords.jinja2 +0 -19
  102. package/generator/pygen/codegen/templates/lro_operation.py.jinja2 +0 -16
  103. package/generator/pygen/codegen/templates/lro_paging_operation.py.jinja2 +0 -18
  104. package/generator/pygen/codegen/templates/macros.jinja2 +0 -12
  105. package/generator/pygen/codegen/templates/metadata.json.jinja2 +0 -167
  106. package/generator/pygen/codegen/templates/model_base.py.jinja2 +0 -1158
  107. package/generator/pygen/codegen/templates/model_container.py.jinja2 +0 -13
  108. package/generator/pygen/codegen/templates/model_dpg.py.jinja2 +0 -98
  109. package/generator/pygen/codegen/templates/model_init.py.jinja2 +0 -28
  110. package/generator/pygen/codegen/templates/model_msrest.py.jinja2 +0 -92
  111. package/generator/pygen/codegen/templates/operation.py.jinja2 +0 -21
  112. package/generator/pygen/codegen/templates/operation_group.py.jinja2 +0 -75
  113. package/generator/pygen/codegen/templates/operation_groups_container.py.jinja2 +0 -20
  114. package/generator/pygen/codegen/templates/operation_tools.jinja2 +0 -81
  115. package/generator/pygen/codegen/templates/operations_folder_init.py.jinja2 +0 -17
  116. package/generator/pygen/codegen/templates/packaging_templates/CHANGELOG.md.jinja2 +0 -6
  117. package/generator/pygen/codegen/templates/packaging_templates/LICENSE.jinja2 +0 -21
  118. package/generator/pygen/codegen/templates/packaging_templates/MANIFEST.in.jinja2 +0 -8
  119. package/generator/pygen/codegen/templates/packaging_templates/README.md.jinja2 +0 -107
  120. package/generator/pygen/codegen/templates/packaging_templates/dev_requirements.txt.jinja2 +0 -9
  121. package/generator/pygen/codegen/templates/packaging_templates/setup.py.jinja2 +0 -108
  122. package/generator/pygen/codegen/templates/paging_operation.py.jinja2 +0 -21
  123. package/generator/pygen/codegen/templates/patch.py.jinja2 +0 -19
  124. package/generator/pygen/codegen/templates/pkgutil_init.py.jinja2 +0 -1
  125. package/generator/pygen/codegen/templates/request_builder.py.jinja2 +0 -28
  126. package/generator/pygen/codegen/templates/request_builders.py.jinja2 +0 -10
  127. package/generator/pygen/codegen/templates/rest_init.py.jinja2 +0 -12
  128. package/generator/pygen/codegen/templates/sample.py.jinja2 +0 -44
  129. package/generator/pygen/codegen/templates/serialization.py.jinja2 +0 -2115
  130. package/generator/pygen/codegen/templates/test.py.jinja2 +0 -50
  131. package/generator/pygen/codegen/templates/testpreparer.py.jinja2 +0 -26
  132. package/generator/pygen/codegen/templates/types.py.jinja2 +0 -8
  133. package/generator/pygen/codegen/templates/validation.py.jinja2 +0 -38
  134. package/generator/pygen/codegen/templates/vendor.py.jinja2 +0 -96
  135. package/generator/pygen/codegen/templates/version.py.jinja2 +0 -4
  136. package/generator/pygen/m2r.py +0 -65
  137. package/generator/pygen/postprocess/__init__.py +0 -183
  138. package/generator/pygen/postprocess/get_all.py +0 -19
  139. package/generator/pygen/postprocess/venvtools.py +0 -75
  140. package/generator/pygen/preprocess/__init__.py +0 -509
  141. package/generator/pygen/preprocess/helpers.py +0 -27
  142. package/generator/pygen/preprocess/python_mappings.py +0 -224
  143. package/generator/pygen/utils.py +0 -160
  144. package/generator/pygen.egg-info/PKG-INFO +0 -25
  145. package/generator/pygen.egg-info/SOURCES.txt +0 -66
  146. package/generator/pygen.egg-info/dependency_links.txt +0 -1
  147. package/generator/pygen.egg-info/requires.txt +0 -4
  148. package/generator/pygen.egg-info/top_level.txt +0 -1
  149. package/generator/requirements.txt +0 -12
  150. package/generator/setup.py +0 -55
@@ -1,12 +0,0 @@
1
- {% macro wrap_model_string(doc_string, wrap_string, suffix_string="") %}
2
- {% set orignal_result = doc_string | wordwrap(width=95, break_long_words=False, break_on_hyphens=False, wrapstring=wrap_string) %}
3
- {% set list_result = orignal_result.split('\n') %}
4
- {% for line in list_result %}
5
- {% set suffix = suffix_string if list_result | length == loop.index %}
6
- {% if line | length > 120 %}
7
- {{ line + " # pylint: disable=line-too-long" }}{{ suffix }}
8
- {% else %}
9
- {{ line }}{{ suffix }}
10
- {% endif %}
11
- {% endfor %}
12
- {% endmacro %}
@@ -1,167 +0,0 @@
1
- {% import 'operation_tools.jinja2' as op_tools %}
2
- {% import 'keywords.jinja2' as keywords %}
3
- {
4
- "chosen_version": {{ chosen_version | tojson }},
5
- "total_api_version_list": {{ total_api_version_list | tojson }},
6
- "client": {
7
- "name": {{ client.name | tojson }},
8
- "filename": {{ ("_" + client.legacy_filename) | tojson }},
9
- "description": {{ client.description | tojson }},
10
- "host_value": {{ (client.parameters.host.client_default_value_declaration if not client.has_parameterized_host else None) | tojson }},
11
- "parameterized_host_template": {{ (keywords.escape_str(client.url) if client.has_parameterized_host else None) | tojson }},
12
- "azure_arm": {{ client.code_model.options["azure_arm"] | tojson }},
13
- "has_public_lro_operations": {{ client.has_public_lro_operations | tojson }},
14
- "client_side_validation": {{ client.code_model.options["client_side_validation"] | tojson }},
15
- "sync_imports": {{ sync_client_imports | tojson }},
16
- "async_imports": {{ async_client_imports | tojson }}
17
- },
18
- "global_parameters": {
19
- "sync": {
20
- {% for gp in global_parameters.method | rejectattr("client_name", "equalto", "api_version") | rejectattr("is_host") %}
21
- {{ gp.client_name | tojson }}: {
22
- "signature": {{ gp.method_signature(async_mode=False) | tojson }},
23
- "description": {{ gp.description | tojson }},
24
- "docstring_type": {{ gp.docstring_type(async_mode=False) | tojson }},
25
- "required": {{ (not gp.optional) | tojson }},
26
- "method_location": {{ gp.method_location | tojson }}
27
- }{{ "," if not loop.last else "" }}
28
- {% endfor %}
29
- },
30
- "async": {
31
- {% for gp in global_parameters.method | rejectattr("client_name", "equalto", "api_version") | rejectattr("is_host") %}
32
- {{ gp.client_name | tojson }}: {
33
- "signature": {{ (gp.method_signature(async_mode=True)) | tojson }},
34
- "description": {{ gp.description | tojson }},
35
- "docstring_type": {{ gp.docstring_type(async_mode=True) | tojson }},
36
- "required": {{ (not gp.optional) | tojson }}
37
- }{{ "," if not loop.last else "" }}
38
- {% endfor %}
39
- },
40
- "constant": {
41
- {% for gp in client.parameters.constant | rejectattr("client_name", "equalto", "api_version") %}
42
- {{ gp.client_name | tojson }}: {{ gp.constant_declaration | tojson }}{{ "," if not loop.last else "" }}
43
- {% endfor %}
44
- },
45
- "call": {{ client.parameters.method | rejectattr("client_name", "equalto", "api_version") | rejectattr("is_host") | map(attribute="client_name") | join(', ') | tojson }},
46
- "service_client_specific": {
47
- "sync": {
48
- "api_version": {
49
- "signature": "api_version: Optional[str]=None,",
50
- "description": "API version to use if no profile is provided, or if missing in profile.",
51
- "docstring_type": "str",
52
- "required": false,
53
- "method_location": "positional"
54
- },
55
- {% if not client.has_parameterized_host %}
56
- "base_url": {
57
- "signature": {{ client.parameters.host.method_signature(async_mode=False) | tojson }},
58
- "description": "Service URL",
59
- "docstring_type": "str",
60
- "required": false,
61
- "method_location": "positional"
62
- },
63
- {% endif %}
64
- "profile": {
65
- "signature": "profile: KnownProfiles=KnownProfiles.default,",
66
- "description": "A profile definition, from KnownProfiles to dict.",
67
- "docstring_type": "azure.profiles.KnownProfiles",
68
- "required": false,
69
- "method_location": "positional"
70
- }
71
- },
72
- "async": {
73
- "api_version": {
74
- "signature": "api_version: Optional[str] = None,",
75
- "description": "API version to use if no profile is provided, or if missing in profile.",
76
- "docstring_type": "str",
77
- "required": false,
78
- "method_location": "positional"
79
- },
80
- {% if not client.has_parameterized_host %}
81
- "base_url": {
82
- "signature": {{ client.parameters.host.method_signature(async_mode=True) | tojson }},
83
- "description": "Service URL",
84
- "docstring_type": "str",
85
- "required": false,
86
- "method_location": "positional"
87
- },
88
- {% endif %}
89
- "profile": {
90
- "signature": "profile: KnownProfiles = KnownProfiles.default,",
91
- "description": "A profile definition, from KnownProfiles to dict.",
92
- "docstring_type": "azure.profiles.KnownProfiles",
93
- "required": false,
94
- "method_location": "positional"
95
- }
96
- }
97
- }
98
- },
99
- "config": {
100
- "credential": {{ has_credential | tojson }},
101
- "credential_scopes": {{ (client.credential.type.policy.credential_scopes if has_credential and client.credential.type.policy.credential_scopes is defined else None)| tojson}},
102
- "credential_call_sync": {{ (client.credential.type.policy.call(async_mode=False) if has_credential else None) | tojson }},
103
- "credential_call_async": {{ (client.credential.type.policy.call(async_mode=True) if has_credential else None) | tojson }},
104
- "sync_imports": {{ sync_config_imports | tojson }},
105
- "async_imports": {{ async_config_imports | tojson }}
106
- },
107
- "operation_groups": {
108
- {% for operation_group in client.operation_groups | rejectattr('is_mixin') %}
109
- {{ operation_group.property_name | tojson }}: {{ operation_group.class_name | tojson }}{{ "," if not loop.last else "" }}
110
- {% endfor %}
111
- }{{ "," if mixin_operations }}
112
- {% if mixin_operations %}
113
- "operation_mixins": {
114
- "sync_imports": {{ str(sync_mixin_imports) | tojson }},
115
- "async_imports": {{ str(async_mixin_imports) | tojson }},
116
- "sync_mixin_typing_definitions": {{ str(sync_mixin_typing_definitions) | tojson }},
117
- "async_mixin_typing_definitions": {{ str(async_mixin_typing_definitions) | tojson }},
118
- "operations": {
119
- {% for operation in mixin_operations %}
120
- {{ operation.name | tojson }} : {
121
- {% set request_builder = operation.request_builder %}
122
- "sync": {
123
- {% set operation_serializer = get_sync_operation_serializer(operation) %}
124
- {% if is_lro(operation) and is_paging(operation) %}
125
- {% from "lro_paging_operation.py.jinja2" import operation_docstring with context %}
126
- {% set sync_return_type_wrapper = [operation.get_poller(async_mode=False), operation.get_pager(async_mode=False)] %}
127
- {% elif is_lro(operation) %}
128
- {% from "lro_operation.py.jinja2" import operation_docstring with context %}
129
- {% set sync_return_type_wrapper = [operation.get_poller(async_mode=False)] %}
130
- {% elif is_paging(operation) %}
131
- {% from "paging_operation.py.jinja2" import operation_docstring with context %}
132
- {% set sync_return_type_wrapper = [operation.get_pager(async_mode=False)] %}
133
- {% else %}
134
- {% from "operation.py.jinja2" import operation_docstring with context %}
135
- {% set sync_return_type_wrapper = "" %}
136
- {% endif %}
137
- "signature": {{ (operation_serializer.method_signature_and_response_type_annotation(operation, want_decorators=False) + "\n") | tojson }},
138
- "doc": {{ op_tools.description(operation, operation_serializer).rstrip("\n") | tojson }},
139
- "call": {{ operation.parameters.call | join(', ') | tojson }}
140
- },
141
- "async": {
142
- {% set coroutine = False if (is_paging(operation) and not is_lro(operation)) else True %}
143
- {% set operation_serializer = get_async_operation_serializer(operation) %}
144
- "coroutine": {{ coroutine | tojson }},
145
- {% if is_lro(operation) and is_paging(operation) %}
146
- {% from "lro_paging_operation.py.jinja2" import operation_docstring with context %}
147
- {% set async_return_type_wrapper = [operation.get_poller(async_mode=True), operation.get_pager(async_mode=True)] %}
148
- {% elif is_lro(operation) %}
149
- {% from "lro_operation.py.jinja2" import operation_docstring with context %}
150
- {% set async_return_type_wrapper = [operation.get_poller(async_mode=True)] %}
151
- {% elif is_paging(operation) %}
152
- {% from "paging_operation.py.jinja2" import operation_docstring with context %}
153
- {% set async_return_type_wrapper = [operation.get_pager(async_mode=True)] %}
154
- {% else %}
155
- {% from "operation.py.jinja2" import operation_docstring with context %}
156
- {% set async_return_type_wrapper = "" %}
157
- {% endif %}
158
- "signature": {{ (operation_serializer.method_signature_and_response_type_annotation(operation, want_decorators=False) + "\n") | tojson }},
159
- "doc": {{ op_tools.description(operation, operation_serializer).rstrip("\n") | tojson }},
160
- "call": {{ operation.parameters.call | join(', ') | tojson }}
161
- }
162
- }{{ "," if not loop.last else "" }}
163
- {% endfor %}
164
- }
165
- }
166
- {% endif %}
167
- }