@autorest/python 6.1.9 → 6.1.11
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.
|
@@ -159,7 +159,7 @@ def build_type(yaml_data: Dict[str, Any], code_model: CodeModel) -> BaseType:
|
|
|
159
159
|
response.fill_instance_from_yaml(yaml_data, code_model)
|
|
160
160
|
else:
|
|
161
161
|
object_type = yaml_data.get("type")
|
|
162
|
-
if object_type
|
|
162
|
+
if object_type not in TYPE_TO_OBJECT:
|
|
163
163
|
_LOGGER.warning(
|
|
164
164
|
'Unrecognized definition type "%s" is found, falling back it as "string"! ',
|
|
165
165
|
yaml_data["type"],
|
|
@@ -143,15 +143,7 @@ class PagingOperationBase(OperationBase[PagingResponseType]):
|
|
|
143
143
|
elif "api-version" in [
|
|
144
144
|
p.rest_api_name for p in self.code_model.client.parameters
|
|
145
145
|
]:
|
|
146
|
-
file_import.
|
|
147
|
-
"urllib.parse", "urlparse", ImportType.STDLIB
|
|
148
|
-
)
|
|
149
|
-
file_import.add_submodule_import(
|
|
150
|
-
"urllib.parse", "urljoin", ImportType.STDLIB
|
|
151
|
-
)
|
|
152
|
-
file_import.add_submodule_import(
|
|
153
|
-
"urllib.parse", "parse_qs", ImportType.STDLIB
|
|
154
|
-
)
|
|
146
|
+
file_import.add_import("urllib.parse", ImportType.STDLIB)
|
|
155
147
|
file_import.add_submodule_import(
|
|
156
148
|
"azure.core.utils", "case_insensitive_dict", ImportType.AZURECORE
|
|
157
149
|
)
|
|
@@ -1208,15 +1208,20 @@ class _PagingOperationSerializer(
|
|
|
1208
1208
|
if p.rest_api_name == "api-version"
|
|
1209
1209
|
)
|
|
1210
1210
|
retval.append("# make call to next link with the client's api-version")
|
|
1211
|
-
retval.append("_parsed_next_link = urlparse(next_link)")
|
|
1212
|
-
retval.
|
|
1213
|
-
|
|
1211
|
+
retval.append("_parsed_next_link = urllib.parse.urlparse(next_link)")
|
|
1212
|
+
retval.extend(
|
|
1213
|
+
[
|
|
1214
|
+
"_next_request_params = case_insensitive_dict({",
|
|
1215
|
+
" key: [urllib.parse.quote(v) for v in value]"
|
|
1216
|
+
" for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()"
|
|
1217
|
+
"})",
|
|
1218
|
+
]
|
|
1214
1219
|
)
|
|
1215
1220
|
retval.append(
|
|
1216
1221
|
f'_next_request_params["api-version"] = {api_version_param.full_client_name}'
|
|
1217
1222
|
)
|
|
1218
1223
|
query_str = ", params=_next_request_params"
|
|
1219
|
-
next_link_str = "urljoin(next_link, _parsed_next_link.path)"
|
|
1224
|
+
next_link_str = "urllib.parse.urljoin(next_link, _parsed_next_link.path)"
|
|
1220
1225
|
except StopIteration:
|
|
1221
1226
|
pass
|
|
1222
1227
|
|
|
@@ -386,7 +386,7 @@ def update_response(
|
|
|
386
386
|
def _get_default_content_type( # pylint: disable=too-many-return-statements
|
|
387
387
|
content_types: Iterable[str],
|
|
388
388
|
) -> Optional[str]:
|
|
389
|
-
json_values = [ct for ct in content_types if JSON_REGEXP.match(ct)]
|
|
389
|
+
json_values = [ct for ct in content_types if JSON_REGEXP.match(ct.split(";")[0])]
|
|
390
390
|
if json_values:
|
|
391
391
|
if "application/json" in json_values:
|
|
392
392
|
return "application/json"
|
|
@@ -131,11 +131,13 @@ class PostProcessPlugin(Plugin): # pylint: disable=abstract-method
|
|
|
131
131
|
f for f in folders if f.stem in ["operations", "_operations"]
|
|
132
132
|
]
|
|
133
133
|
for operations_folder in operations_folders:
|
|
134
|
-
|
|
134
|
+
sub_namespace = ".".join(
|
|
135
|
+
str(operations_folder.relative_to(self.base_folder)).split(os.sep)
|
|
136
|
+
)
|
|
135
137
|
self.fix_imports_in_init(
|
|
136
138
|
generated_file_name="_operations",
|
|
137
139
|
folder_path=operations_folder,
|
|
138
|
-
namespace=f"{self.namespace}
|
|
140
|
+
namespace=f"{self.namespace}.{sub_namespace}",
|
|
139
141
|
)
|
|
140
142
|
shutil.rmtree(f"{str(self.output_folder)}/.temp_folder")
|
|
141
143
|
return True
|
|
@@ -155,7 +157,7 @@ class PostProcessPlugin(Plugin): # pylint: disable=abstract-method
|
|
|
155
157
|
k: None for k in customized_objects_str.split(",")
|
|
156
158
|
}.keys() # filter out duplicates
|
|
157
159
|
file = (folder_path / "__init__.py").relative_to(self.output_folder)
|
|
158
|
-
file_content = self.read_file(file)
|
|
160
|
+
file_content = self.read_file(file).replace("\r\n", "\n")
|
|
159
161
|
added_objs = []
|
|
160
162
|
for obj in customized_objects:
|
|
161
163
|
if f" import {obj}\n" in file_content:
|