From 805e3b7e3d9f35fbf78a7b5a5fab8ad886a47bf8 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 25 May 2023 18:06:45 +0000 Subject: [PATCH] CodeGen from PR 24171 in Azure/azure-rest-api-specs Merge 29e55ba44ca7c06b8c07ab4a524971d880b086e8 into be63fad20943ff5f1cdf9849d2631839b683935a --- .../azure-mgmt-mixedreality/_meta.json | 6 +- .../azure/mgmt/mixedreality/__init__.py | 2 +- .../azure/mgmt/mixedreality/_configuration.py | 13 +- .../mixedreality/_mixed_reality_client.py | 15 +- .../azure/mgmt/mixedreality/_serialization.py | 180 ++++++++------ .../azure/mgmt/mixedreality/_vendor.py | 5 +- .../azure/mgmt/mixedreality/_version.py | 2 +- .../azure/mgmt/mixedreality/aio/__init__.py | 2 +- .../mgmt/mixedreality/aio/_configuration.py | 8 +- .../mixedreality/aio/_mixed_reality_client.py | 8 +- .../mixedreality/aio/operations/__init__.py | 2 +- .../_mixed_reality_client_operations.py | 31 ++- .../_object_anchors_accounts_operations.py | 178 +++++++------- .../aio/operations/_operations.py | 24 +- .../_remote_rendering_accounts_operations.py | 178 +++++++------- .../_spatial_anchors_accounts_operations.py | 178 +++++++------- .../mgmt/mixedreality/models/__init__.py | 2 +- .../models/_mixed_reality_client_enums.py | 4 +- .../mgmt/mixedreality/models/_models_py3.py | 105 ++++---- .../mgmt/mixedreality/operations/__init__.py | 2 +- .../_mixed_reality_client_operations.py | 39 ++- .../_object_anchors_accounts_operations.py | 232 +++++++++--------- .../mixedreality/operations/_operations.py | 28 +-- .../_remote_rendering_accounts_operations.py | 232 +++++++++--------- .../_spatial_anchors_accounts_operations.py | 232 +++++++++--------- .../delete.py} | 5 +- .../get.py} | 2 +- .../get_by_resource_group.py} | 2 +- .../get_by_subscription.py} | 2 +- .../list_keys.py} | 2 +- .../patch.py} | 2 +- .../put.py} | 2 +- .../regenerate_key.py} | 2 +- ...name_availability_for_local_uniqueness.py} | 2 +- .../exposing_available_operations.py} | 2 +- .../delete.py} | 5 +- .../get.py} | 2 +- .../get_by_resource_group.py} | 2 +- .../get_by_subscription.py} | 2 +- .../list_keys.py} | 2 +- .../patch.py} | 2 +- .../put.py} | 2 +- .../regenerate_key.py} | 2 +- .../delete.py} | 5 +- .../get.py} | 2 +- .../get_by_resource_group.py} | 2 +- .../get_by_subscription.py} | 2 +- .../list_keys.py} | 2 +- .../patch.py} | 2 +- .../put.py} | 2 +- .../regenerate_key.py} | 2 +- 51 files changed, 871 insertions(+), 898 deletions(-) rename sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/{delete_object_anchors_account.py => objectanchors/delete.py} (92%) rename sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/{get_object_anchors_account.py => objectanchors/get.py} (97%) rename sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/{list_object_anchors_accounts_by_resource_group.py => objectanchors/get_by_resource_group.py} (96%) rename sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/{list_object_anchors_accounts_by_subscription.py => objectanchors/get_by_subscription.py} (96%) rename sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/{list_object_anchors_account_key.py => objectanchors/list_keys.py} (97%) rename sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/{update_object_anchors_account.py => objectanchors/patch.py} (97%) rename sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/{create_object_anchors_account.py => objectanchors/put.py} (97%) rename sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/{regenerate_object_anchors_account_keys.py => objectanchors/regenerate_key.py} (96%) rename sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/{check_local_name_availability.py => proxy/check_name_availability_for_local_uniqueness.py} (96%) rename sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/{list_available_operations.py => proxy/exposing_available_operations.py} (97%) rename sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/{delete_remote_rendering_account.py => remoterendering/delete.py} (92%) rename sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/{get_remote_rendering_account.py => remoterendering/get.py} (97%) rename sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/{list_remote_rendering_accounts_by_resource_group.py => remoterendering/get_by_resource_group.py} (96%) rename sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/{list_remote_rendering_accounts_by_subscription.py => remoterendering/get_by_subscription.py} (96%) rename sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/{list_remote_rendering_account_key.py => remoterendering/list_keys.py} (97%) rename sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/{update_remote_rendering_account.py => remoterendering/patch.py} (97%) rename sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/{create_remote_rendering_account.py => remoterendering/put.py} (97%) rename sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/{regenerate_remote_rendering_account_keys.py => remoterendering/regenerate_key.py} (96%) rename sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/{delete_spatial_anchors_account.py => spatialanchors/delete.py} (92%) rename sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/{get_spatial_anchors_account.py => spatialanchors/get.py} (97%) rename sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/{list_spatial_anchor_accounts_by_resource_group.py => spatialanchors/get_by_resource_group.py} (96%) rename sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/{list_spatial_anchors_accounts_by_subscription.py => spatialanchors/get_by_subscription.py} (96%) rename sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/{list_spatial_anchor_account_key.py => spatialanchors/list_keys.py} (97%) rename sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/{update_spatial_anchors_account.py => spatialanchors/patch.py} (97%) rename sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/{create_spatial_anchor_account.py => spatialanchors/put.py} (97%) rename sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/{regenerate_spatial_anchors_account_keys.py => spatialanchors/regenerate_key.py} (96%) diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/_meta.json b/sdk/mixedreality/azure-mgmt-mixedreality/_meta.json index 43fb421b6fd6..a58dd3f6e1b5 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/_meta.json +++ b/sdk/mixedreality/azure-mgmt-mixedreality/_meta.json @@ -1,11 +1,11 @@ { - "commit": "4522e1d3fb6dcb81bc63e3414d11dd7eaf08264b", + "commit": "9eba6eb27c98106f70168a7a8842f30c308fa81a", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.1", + "@autorest/python@6.4.12", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/mixedreality/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/mixedreality/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.4.12 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/mixedreality/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/__init__.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/__init__.py index 610e1857d28b..888454ace128 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/__init__.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_configuration.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_configuration.py index d3042efdccbc..75c587d6a36c 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_configuration.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -43,7 +37,7 @@ class MixedRealityClientConfiguration(Configuration): # pylint: disable=too-man def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(MixedRealityClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-03-01-preview") # type: Literal["2021-03-01-preview"] + api_version: str = kwargs.pop("api_version", "2021-03-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -57,10 +51,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-mixedreality/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_mixed_reality_client.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_mixed_reality_client.py index 7b24aa5c899a..264ef55ff1e4 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_mixed_reality_client.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_mixed_reality_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from ._configuration import MixedRealityClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( @@ -62,9 +62,9 @@ def __init__( **kwargs: Any ) -> None: self._config = MixedRealityClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -101,15 +101,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> MixedRealityClient + def __enter__(self) -> "MixedRealityClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_serialization.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_serialization.py index 7c1dedb5133d..842ae727fbbc 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_serialization.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,23 +38,38 @@ import re import sys import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate - -from typing import Dict, Any, cast, TYPE_CHECKING +import isodate # type: ignore from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] class RawDeserializer: @@ -65,8 +81,7 @@ class RawDeserializer: CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -132,8 +147,7 @@ def _json_attemp(data): raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -160,8 +174,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore + basestring = str + unicode_str = str _LOGGER = logging.getLogger(__name__) @@ -188,7 +202,7 @@ def dst(self, dt): try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 class _FixedOffset(datetime.tzinfo): # type: ignore @@ -219,7 +233,7 @@ def __getinitargs__(self): try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore @@ -276,12 +290,12 @@ class Model(object): serialization and deserialization. """ - _subtype_map = {} # type: Dict[str, Dict[str, Any]] - _attribute_map = {} # type: Dict[str, Dict[str, Any]] - _validation = {} # type: Dict[str, Dict[str, Any]] + _subtype_map: Dict[str, Dict[str, Any]] = {} + _attribute_map: Dict[str, Dict[str, Any]] = {} + _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -290,27 +304,27 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @@ -319,13 +333,13 @@ def is_xml_model(cls): def _create_xml_node(cls): """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -339,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -387,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -399,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -412,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -453,7 +477,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -521,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -537,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -605,14 +629,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): @@ -621,23 +645,22 @@ def _serialize(self, target_obj, data_type=None, **kwargs): new_attr.tag = "}".join([splitted_tag[0], xml_name]) else: new_attr.tag = xml_name - serialized.append(new_attr) + serialized.append(new_attr) # type: ignore else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) local_node.text = unicode_str(new_attr) - serialized.append(local_node) + serialized.append(local_node) # type: ignore else: # JSON - for k in reversed(keys): - unflattened = {k: new_attr} - new_attr = unflattened + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized - for k in keys: + for k in keys: # type: ignore if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] except ValueError: continue @@ -659,8 +682,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -675,7 +698,7 @@ def body(self, data, data_type, **kwargs): # We're not able to deal with additional properties for now. deserializer.additional_properties_detection = False if is_xml_model_serialization: - deserializer.key_extractors = [ + deserializer.key_extractors = [ # type: ignore attribute_key_case_insensitive_extractor, ] else: @@ -780,6 +803,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -843,7 +868,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -1001,10 +1026,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) + enum_obj(result) # type: ignore return result except ValueError: - for enum_value in enum_obj: + for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" @@ -1164,7 +1189,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1245,7 +1271,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1269,7 +1295,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1335,7 +1361,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1355,7 +1381,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1416,7 +1442,7 @@ def _deserialize(self, target_obj, data): if data is None: return data try: - attributes = response._attribute_map + attributes = response._attribute_map # type: ignore d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1444,7 +1470,7 @@ def _deserialize(self, target_obj, data): value = self.deserialize_data(raw_value, attr_desc["type"]) d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name + msg = "Unable to deserialize to object: " + class_name # type: ignore raise_with_traceback(DeserializationError, msg, err) else: additional_properties = self._build_additional_properties(attributes, data) @@ -1474,7 +1500,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1489,7 +1515,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1499,7 +1525,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: @@ -1543,7 +1569,7 @@ def _unpack_content(raw_data, content_type=None): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1565,7 +1591,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): response_obj.additional_properties = additional_properties return response_obj except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore raise DeserializationError(msg + str(err)) else: try: @@ -1747,7 +1773,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore return data except NameError: return str(data) @@ -1798,7 +1824,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) + return bytearray(b64decode(attr)) # type: ignore @staticmethod def deserialize_base64(attr): @@ -1810,8 +1836,8 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) - attr = attr + padding + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @@ -1826,7 +1852,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) + return decimal.Decimal(attr) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise_with_traceback(DeserializationError, msg, err) @@ -1841,7 +1867,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) + return _long_type(attr) # type: ignore @staticmethod def deserialize_duration(attr): @@ -1871,7 +1897,7 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. return isodate.parse_date(attr, defaultmonth=None, defaultday=None) @@ -1886,7 +1912,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1901,7 +1927,7 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) + parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) @@ -1924,7 +1950,7 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() + attr = attr.upper() # type: ignore match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) @@ -1960,7 +1986,7 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) + attr = int(attr.text) # type: ignore try: date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_vendor.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_vendor.py index bc12b91166ef..f05cfddada2a 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_vendor.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_vendor.py @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import TYPE_CHECKING +from typing import List, TYPE_CHECKING, cast from azure.core.pipeline.transport import HttpRequest @@ -33,7 +33,8 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_version.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_version.py index 653b73a4a199..8dbbc07e3567 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_version.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.1.0b1" +VERSION = "0.0.1" diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/__init__.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/__init__.py index 2630af764763..a5b6191fe73b 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/__init__.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/_configuration.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/_configuration.py index 729654240cc6..45fe89a70c84 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/_configuration.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -43,7 +37,7 @@ class MixedRealityClientConfiguration(Configuration): # pylint: disable=too-man def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(MixedRealityClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-03-01-preview") # type: Literal["2021-03-01-preview"] + api_version: str = kwargs.pop("api_version", "2021-03-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/_mixed_reality_client.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/_mixed_reality_client.py index 528d7ecdc3e9..2e86efb3e70d 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/_mixed_reality_client.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/_mixed_reality_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import MixedRealityClientConfiguration from .operations import ( @@ -62,9 +62,9 @@ def __init__( **kwargs: Any ) -> None: self._config = MixedRealityClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -108,5 +108,5 @@ async def __aenter__(self) -> "MixedRealityClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/__init__.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/__init__.py index 9e3f97a21844..b5e5b577beb2 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/__init__.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/__init__.py @@ -13,7 +13,7 @@ from ._object_anchors_accounts_operations import ObjectAnchorsAccountsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_mixed_reality_client_operations.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_mixed_reality_client_operations.py index 6bd0cc003bfb..ec0150d0ecc7 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_mixed_reality_client_operations.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_mixed_reality_client_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -29,10 +29,6 @@ from ...operations._mixed_reality_client_operations import build_check_name_availability_local_request from .._vendor import MixedRealityClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,8 +85,8 @@ async def check_name_availability_local( :param location: The location in which uniqueness will be verified. Required. :type location: str - :param check_name_availability: Check Name Availability Request. Is either a model type or a IO - type. Required. + :param check_name_availability: Check Name Availability Request. Is either a + CheckNameAvailabilityRequest type or a IO type. Required. :type check_name_availability: ~azure.mgmt.mixedreality.models.CheckNameAvailabilityRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -112,16 +108,14 @@ async def check_name_availability_local( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckNameAvailabilityResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(check_name_availability, (IO, bytes)): + if isinstance(check_name_availability, (IOBase, bytes)): _content = check_name_availability else: _json = self._serialize.body(check_name_availability, "CheckNameAvailabilityRequest") @@ -138,10 +132,11 @@ async def check_name_availability_local( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -157,4 +152,6 @@ async def check_name_availability_local( return deserialized - check_name_availability_local.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/locations/{location}/checkNameAvailability"} # type: ignore + check_name_availability_local.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/locations/{location}/checkNameAvailability" + } diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_object_anchors_accounts_operations.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_object_anchors_accounts_operations.py index ffed13c956b9..2d71ba4e3751 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_object_anchors_accounts_operations.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_object_anchors_accounts_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -41,10 +41,6 @@ ) from .._vendor import MixedRealityClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,10 +78,8 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ObjectAn _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ObjectAnchorsAccountPage] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ObjectAnchorsAccountPage] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -106,7 +100,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -122,7 +116,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -130,14 +124,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ObjectAnchorsAccountPage", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -149,7 +144,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/objectAnchorsAccounts"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/objectAnchorsAccounts" + } @distributed_trace def list_by_resource_group( @@ -169,10 +166,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ObjectAnchorsAccountPage] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ObjectAnchorsAccountPage] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -194,7 +189,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -210,7 +205,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -218,14 +213,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ObjectAnchorsAccountPage", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,7 +233,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -265,10 +263,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -280,10 +276,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -295,7 +292,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}" + } @distributed_trace_async async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.ObjectAnchorsAccount: @@ -321,10 +320,8 @@ async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ObjectAnchorsAccount] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ObjectAnchorsAccount] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -336,10 +333,11 @@ async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -355,7 +353,9 @@ async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}" + } @overload async def update( @@ -425,8 +425,8 @@ async def update( :type resource_group_name: str :param account_name: Name of an Mixed Reality Account. Required. :type account_name: str - :param object_anchors_account: Object Anchors Account parameter. Is either a model type or a IO - type. Required. + :param object_anchors_account: Object Anchors Account parameter. Is either a + ObjectAnchorsAccount type or a IO type. Required. :type object_anchors_account: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccount or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -447,16 +447,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ObjectAnchorsAccount] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ObjectAnchorsAccount] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(object_anchors_account, (IO, bytes)): + if isinstance(object_anchors_account, (IOBase, bytes)): _content = object_anchors_account else: _json = self._serialize.body(object_anchors_account, "ObjectAnchorsAccount") @@ -474,10 +472,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -493,7 +492,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}" + } @overload async def create( @@ -563,8 +564,8 @@ async def create( :type resource_group_name: str :param account_name: Name of an Mixed Reality Account. Required. :type account_name: str - :param object_anchors_account: Object Anchors Account parameter. Is either a model type or a IO - type. Required. + :param object_anchors_account: Object Anchors Account parameter. Is either a + ObjectAnchorsAccount type or a IO type. Required. :type object_anchors_account: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccount or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -585,16 +586,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ObjectAnchorsAccount] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ObjectAnchorsAccount] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(object_anchors_account, (IO, bytes)): + if isinstance(object_anchors_account, (IOBase, bytes)): _content = object_anchors_account else: _json = self._serialize.body(object_anchors_account, "ObjectAnchorsAccount") @@ -612,10 +611,11 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -631,11 +631,13 @@ async def create( deserialized = self._deserialize("ObjectAnchorsAccount", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}" + } @distributed_trace_async async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.AccountKeys: @@ -661,10 +663,8 @@ async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountKeys] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AccountKeys] = kwargs.pop("cls", None) request = build_list_keys_request( resource_group_name=resource_group_name, @@ -676,10 +676,11 @@ async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -695,7 +696,9 @@ async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: return deserialized - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}/listKeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}/listKeys" + } @overload async def regenerate_keys( @@ -765,8 +768,8 @@ async def regenerate_keys( :type resource_group_name: str :param account_name: Name of an Mixed Reality Account. Required. :type account_name: str - :param regenerate: Required information for key regeneration. Is either a model type or a IO - type. Required. + :param regenerate: Required information for key regeneration. Is either a + AccountKeyRegenerateRequest type or a IO type. Required. :type regenerate: ~azure.mgmt.mixedreality.models.AccountKeyRegenerateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -787,16 +790,14 @@ async def regenerate_keys( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountKeys] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccountKeys] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(regenerate, (IO, bytes)): + if isinstance(regenerate, (IOBase, bytes)): _content = regenerate else: _json = self._serialize.body(regenerate, "AccountKeyRegenerateRequest") @@ -814,10 +815,11 @@ async def regenerate_keys( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -833,4 +835,6 @@ async def regenerate_keys( return deserialized - regenerate_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}/regenerateKeys"} # type: ignore + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}/regenerateKeys" + } diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_operations.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_operations.py index e4527eda1532..27cb9c23eec0 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_operations.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ...operations._operations import build_list_request from .._vendor import MixedRealityClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,10 +65,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationPage] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationPage] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -93,7 +86,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -109,7 +102,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -117,14 +110,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationPage", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -136,4 +130,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.MixedReality/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.MixedReality/operations"} diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_remote_rendering_accounts_operations.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_remote_rendering_accounts_operations.py index 72f2c8597c68..71e5cac06a9a 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_remote_rendering_accounts_operations.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_remote_rendering_accounts_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -41,10 +41,6 @@ ) from .._vendor import MixedRealityClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,10 +78,8 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.RemoteRe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RemoteRenderingAccountPage] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RemoteRenderingAccountPage] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -106,7 +100,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -122,7 +116,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -130,14 +124,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RemoteRenderingAccountPage", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -149,7 +144,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/remoteRenderingAccounts"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/remoteRenderingAccounts" + } @distributed_trace def list_by_resource_group( @@ -169,10 +166,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RemoteRenderingAccountPage] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RemoteRenderingAccountPage] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -194,7 +189,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -210,7 +205,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -218,14 +213,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RemoteRenderingAccountPage", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,7 +233,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -265,10 +263,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -280,10 +276,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -295,7 +292,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}" + } @distributed_trace_async async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.RemoteRenderingAccount: @@ -321,10 +320,8 @@ async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RemoteRenderingAccount] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RemoteRenderingAccount] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -336,10 +333,11 @@ async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -355,7 +353,9 @@ async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}" + } @overload async def update( @@ -425,8 +425,8 @@ async def update( :type resource_group_name: str :param account_name: Name of an Mixed Reality Account. Required. :type account_name: str - :param remote_rendering_account: Remote Rendering Account parameter. Is either a model type or - a IO type. Required. + :param remote_rendering_account: Remote Rendering Account parameter. Is either a + RemoteRenderingAccount type or a IO type. Required. :type remote_rendering_account: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -447,16 +447,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RemoteRenderingAccount] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RemoteRenderingAccount] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(remote_rendering_account, (IO, bytes)): + if isinstance(remote_rendering_account, (IOBase, bytes)): _content = remote_rendering_account else: _json = self._serialize.body(remote_rendering_account, "RemoteRenderingAccount") @@ -474,10 +472,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -493,7 +492,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}" + } @overload async def create( @@ -563,8 +564,8 @@ async def create( :type resource_group_name: str :param account_name: Name of an Mixed Reality Account. Required. :type account_name: str - :param remote_rendering_account: Remote Rendering Account parameter. Is either a model type or - a IO type. Required. + :param remote_rendering_account: Remote Rendering Account parameter. Is either a + RemoteRenderingAccount type or a IO type. Required. :type remote_rendering_account: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -585,16 +586,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RemoteRenderingAccount] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RemoteRenderingAccount] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(remote_rendering_account, (IO, bytes)): + if isinstance(remote_rendering_account, (IOBase, bytes)): _content = remote_rendering_account else: _json = self._serialize.body(remote_rendering_account, "RemoteRenderingAccount") @@ -612,10 +611,11 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -631,11 +631,13 @@ async def create( deserialized = self._deserialize("RemoteRenderingAccount", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}" + } @distributed_trace_async async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.AccountKeys: @@ -661,10 +663,8 @@ async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountKeys] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AccountKeys] = kwargs.pop("cls", None) request = build_list_keys_request( resource_group_name=resource_group_name, @@ -676,10 +676,11 @@ async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -695,7 +696,9 @@ async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: return deserialized - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}/listKeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}/listKeys" + } @overload async def regenerate_keys( @@ -765,8 +768,8 @@ async def regenerate_keys( :type resource_group_name: str :param account_name: Name of an Mixed Reality Account. Required. :type account_name: str - :param regenerate: Required information for key regeneration. Is either a model type or a IO - type. Required. + :param regenerate: Required information for key regeneration. Is either a + AccountKeyRegenerateRequest type or a IO type. Required. :type regenerate: ~azure.mgmt.mixedreality.models.AccountKeyRegenerateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -787,16 +790,14 @@ async def regenerate_keys( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountKeys] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccountKeys] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(regenerate, (IO, bytes)): + if isinstance(regenerate, (IOBase, bytes)): _content = regenerate else: _json = self._serialize.body(regenerate, "AccountKeyRegenerateRequest") @@ -814,10 +815,11 @@ async def regenerate_keys( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -833,4 +835,6 @@ async def regenerate_keys( return deserialized - regenerate_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}/regenerateKeys"} # type: ignore + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}/regenerateKeys" + } diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_spatial_anchors_accounts_operations.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_spatial_anchors_accounts_operations.py index 786fe4b026c9..1203766a77e7 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_spatial_anchors_accounts_operations.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_spatial_anchors_accounts_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -41,10 +41,6 @@ ) from .._vendor import MixedRealityClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,10 +78,8 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SpatialA _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SpatialAnchorsAccountPage] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SpatialAnchorsAccountPage] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -106,7 +100,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -122,7 +116,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -130,14 +124,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SpatialAnchorsAccountPage", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -149,7 +144,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/spatialAnchorsAccounts"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/spatialAnchorsAccounts" + } @distributed_trace def list_by_resource_group( @@ -169,10 +166,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SpatialAnchorsAccountPage] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SpatialAnchorsAccountPage] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -194,7 +189,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -210,7 +205,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -218,14 +213,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SpatialAnchorsAccountPage", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,7 +233,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -265,10 +263,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -280,10 +276,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -295,7 +292,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}" + } @distributed_trace_async async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.SpatialAnchorsAccount: @@ -321,10 +320,8 @@ async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SpatialAnchorsAccount] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SpatialAnchorsAccount] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -336,10 +333,11 @@ async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -355,7 +353,9 @@ async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}" + } @overload async def update( @@ -425,8 +425,8 @@ async def update( :type resource_group_name: str :param account_name: Name of an Mixed Reality Account. Required. :type account_name: str - :param spatial_anchors_account: Spatial Anchors Account parameter. Is either a model type or a - IO type. Required. + :param spatial_anchors_account: Spatial Anchors Account parameter. Is either a + SpatialAnchorsAccount type or a IO type. Required. :type spatial_anchors_account: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -447,16 +447,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SpatialAnchorsAccount] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SpatialAnchorsAccount] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(spatial_anchors_account, (IO, bytes)): + if isinstance(spatial_anchors_account, (IOBase, bytes)): _content = spatial_anchors_account else: _json = self._serialize.body(spatial_anchors_account, "SpatialAnchorsAccount") @@ -474,10 +472,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -493,7 +492,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}" + } @overload async def create( @@ -563,8 +564,8 @@ async def create( :type resource_group_name: str :param account_name: Name of an Mixed Reality Account. Required. :type account_name: str - :param spatial_anchors_account: Spatial Anchors Account parameter. Is either a model type or a - IO type. Required. + :param spatial_anchors_account: Spatial Anchors Account parameter. Is either a + SpatialAnchorsAccount type or a IO type. Required. :type spatial_anchors_account: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -585,16 +586,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SpatialAnchorsAccount] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SpatialAnchorsAccount] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(spatial_anchors_account, (IO, bytes)): + if isinstance(spatial_anchors_account, (IOBase, bytes)): _content = spatial_anchors_account else: _json = self._serialize.body(spatial_anchors_account, "SpatialAnchorsAccount") @@ -612,10 +611,11 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -631,11 +631,13 @@ async def create( deserialized = self._deserialize("SpatialAnchorsAccount", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}" + } @distributed_trace_async async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.AccountKeys: @@ -661,10 +663,8 @@ async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountKeys] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AccountKeys] = kwargs.pop("cls", None) request = build_list_keys_request( resource_group_name=resource_group_name, @@ -676,10 +676,11 @@ async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -695,7 +696,9 @@ async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: return deserialized - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}/listKeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}/listKeys" + } @overload async def regenerate_keys( @@ -765,8 +768,8 @@ async def regenerate_keys( :type resource_group_name: str :param account_name: Name of an Mixed Reality Account. Required. :type account_name: str - :param regenerate: Required information for key regeneration. Is either a model type or a IO - type. Required. + :param regenerate: Required information for key regeneration. Is either a + AccountKeyRegenerateRequest type or a IO type. Required. :type regenerate: ~azure.mgmt.mixedreality.models.AccountKeyRegenerateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -787,16 +790,14 @@ async def regenerate_keys( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountKeys] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccountKeys] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(regenerate, (IO, bytes)): + if isinstance(regenerate, (IOBase, bytes)): _content = regenerate else: _json = self._serialize.body(regenerate, "AccountKeyRegenerateRequest") @@ -814,10 +815,11 @@ async def regenerate_keys( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -833,4 +835,6 @@ async def regenerate_keys( return deserialized - regenerate_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}/regenerateKeys"} # type: ignore + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}/regenerateKeys" + } diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/models/__init__.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/models/__init__.py index e0000a9e5e2b..850043c1358f 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/models/__init__.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/models/__init__.py @@ -37,7 +37,7 @@ from ._mixed_reality_client_enums import Serial from ._mixed_reality_client_enums import SkuTier from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/models/_mixed_reality_client_enums.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/models/_mixed_reality_client_enums.py index 584ff3787dd7..786c322ce015 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/models/_mixed_reality_client_enums.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/models/_mixed_reality_client_enums.py @@ -29,10 +29,10 @@ class NameUnavailableReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): class Serial(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Serial of key to be regenerated.""" - #: The Primary Key PRIMARY = 1 - #: The Secondary Key + """The Primary Key""" SECONDARY = 2 + """The Secondary Key""" class SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/models/_models_py3.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/models/_models_py3.py index f4209949aaad..ae0c6eda6bbd 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/models/_models_py3.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/models/_models_py3.py @@ -9,7 +9,7 @@ import datetime import sys -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization @@ -34,7 +34,7 @@ class AccountKeyRegenerateRequest(_serialization.Model): "serial": {"key": "serial", "type": "int"}, } - def __init__(self, *, serial: Union[int, "_models.Serial"] = 1, **kwargs): + def __init__(self, *, serial: Union[int, "_models.Serial"] = 1, **kwargs: Any) -> None: """ :keyword serial: Serial of key to be regenerated. Known values are: 1 and 2. :paramtype serial: int or ~azure.mgmt.mixedreality.models.Serial @@ -64,7 +64,7 @@ class AccountKeys(_serialization.Model): "secondary_key": {"key": "secondaryKey", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.primary_key = None @@ -92,7 +92,7 @@ class CheckNameAvailabilityRequest(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: str, type: str, **kwargs): + def __init__(self, *, name: str, type: str, **kwargs: Any) -> None: """ :keyword name: Resource Name To Verify. Required. :paramtype name: str @@ -133,8 +133,8 @@ def __init__( name_available: bool, reason: Optional[Union[str, "_models.NameUnavailableReason"]] = None, message: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name_available: if name Available. Required. :paramtype name_available: bool @@ -179,8 +179,8 @@ def __init__( message: Optional[str] = None, target: Optional[str] = None, details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. @@ -225,7 +225,7 @@ class Identity(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs): + def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs: Any) -> None: """ :keyword type: The identity type. Default value is "SystemAssigned". :paramtype type: str @@ -259,8 +259,8 @@ def __init__( name: Optional[str] = None, display_name: Optional[str] = None, blob_duration: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the log. :paramtype name: str @@ -302,8 +302,8 @@ def __init__( display_name: Optional[str] = None, internal_name: Optional[str] = None, to_be_exported_for_shoebox: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the dimension. :paramtype name: str @@ -400,8 +400,8 @@ def __init__( internal_metric_name: Optional[str] = None, dimensions: Optional[List["_models.MetricDimension"]] = None, locked_aggregation_type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the metric. :paramtype name: str @@ -486,7 +486,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -495,7 +495,8 @@ def __init__(self, **kwargs): class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. @@ -530,7 +531,7 @@ class TrackedResource(Resource): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -615,8 +616,8 @@ def __init__( sku: Optional["_models.Sku"] = None, kind: Optional["_models.Sku"] = None, storage_account_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -668,7 +669,7 @@ class ObjectAnchorsAccountIdentity(Identity): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs): + def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs: Any) -> None: """ :keyword type: The identity type. Default value is "SystemAssigned". :paramtype type: str @@ -677,7 +678,8 @@ def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs class ObjectAnchorsAccountPage(_serialization.Model): - """Result of the request to get resource collection. It contains a list of resources and a URL link to get the next set of results. + """Result of the request to get resource collection. It contains a list of resources and a URL + link to get the next set of results. :ivar value: List of resources supported by the Resource Provider. :vartype value: list[~azure.mgmt.mixedreality.models.ObjectAnchorsAccount] @@ -691,8 +693,12 @@ class ObjectAnchorsAccountPage(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.ObjectAnchorsAccount"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.ObjectAnchorsAccount"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: List of resources supported by the Resource Provider. :paramtype value: list[~azure.mgmt.mixedreality.models.ObjectAnchorsAccount] @@ -735,8 +741,8 @@ def __init__( is_data_action: Optional[bool] = None, origin: Optional[str] = None, properties: Optional["_models.OperationProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -786,7 +792,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, *, provider: str, resource: str, operation: str, description: str, **kwargs): + def __init__(self, *, provider: str, resource: str, operation: str, description: str, **kwargs: Any) -> None: """ :keyword provider: Service provider: Microsoft.ResourceProvider. Required. :paramtype provider: str @@ -806,7 +812,8 @@ def __init__(self, *, provider: str, resource: str, operation: str, description: class OperationPage(_serialization.Model): - """Result of the request to list Resource Provider operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list Resource Provider operations. It contains a list of operations + and a URL link to get the next set of results. :ivar value: List of operations supported by the Resource Provider. :vartype value: list[~azure.mgmt.mixedreality.models.Operation] @@ -819,7 +826,9 @@ class OperationPage(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of operations supported by the Resource Provider. :paramtype value: list[~azure.mgmt.mixedreality.models.Operation] @@ -842,7 +851,9 @@ class OperationProperties(_serialization.Model): "service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"}, } - def __init__(self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs): + def __init__( + self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any + ) -> None: """ :keyword service_specification: Service specification. :paramtype service_specification: ~azure.mgmt.mixedreality.models.ServiceSpecification @@ -924,8 +935,8 @@ def __init__( sku: Optional["_models.Sku"] = None, kind: Optional["_models.Sku"] = None, storage_account_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -954,7 +965,8 @@ def __init__( class RemoteRenderingAccountPage(_serialization.Model): - """Result of the request to get resource collection. It contains a list of resources and a URL link to get the next set of results. + """Result of the request to get resource collection. It contains a list of resources and a URL + link to get the next set of results. :ivar value: List of resources supported by the Resource Provider. :vartype value: list[~azure.mgmt.mixedreality.models.RemoteRenderingAccount] @@ -972,8 +984,8 @@ def __init__( *, value: Optional[List["_models.RemoteRenderingAccount"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: List of resources supported by the Resource Provider. :paramtype value: list[~azure.mgmt.mixedreality.models.RemoteRenderingAccount] @@ -1004,8 +1016,8 @@ def __init__( *, log_specifications: Optional[List["_models.LogSpecification"]] = None, metric_specifications: Optional[List["_models.MetricSpecification"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword log_specifications: Specifications of the Log for Azure Monitoring. :paramtype log_specifications: list[~azure.mgmt.mixedreality.models.LogSpecification] @@ -1059,8 +1071,8 @@ def __init__( size: Optional[str] = None, family: Optional[str] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the SKU. Ex - P3. It is typically a letter+number code. Required. :paramtype name: str @@ -1159,8 +1171,8 @@ def __init__( sku: Optional["_models.Sku"] = None, kind: Optional["_models.Sku"] = None, storage_account_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -1189,7 +1201,8 @@ def __init__( class SpatialAnchorsAccountPage(_serialization.Model): - """Result of the request to get resource collection. It contains a list of resources and a URL link to get the next set of results. + """Result of the request to get resource collection. It contains a list of resources and a URL + link to get the next set of results. :ivar value: List of resources supported by the Resource Provider. :vartype value: list[~azure.mgmt.mixedreality.models.SpatialAnchorsAccount] @@ -1207,8 +1220,8 @@ def __init__( *, value: Optional[List["_models.SpatialAnchorsAccount"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: List of resources supported by the Resource Provider. :paramtype value: list[~azure.mgmt.mixedreality.models.SpatialAnchorsAccount] @@ -1257,8 +1270,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/__init__.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/__init__.py index 9e3f97a21844..b5e5b577beb2 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/__init__.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/__init__.py @@ -13,7 +13,7 @@ from ._object_anchors_accounts_operations import ObjectAnchorsAccountsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_mixed_reality_client_operations.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_mixed_reality_client_operations.py index db136cb4e480..d0abf85e0820 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_mixed_reality_client_operations.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_mixed_reality_client_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +28,6 @@ from .._serialization import Serializer from .._vendor import MixedRealityClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,10 +39,8 @@ def build_check_name_availability_local_request(location: str, subscription_id: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +55,7 @@ def build_check_name_availability_local_request(location: str, subscription_id: ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,8 +120,8 @@ def check_name_availability_local( :param location: The location in which uniqueness will be verified. Required. :type location: str - :param check_name_availability: Check Name Availability Request. Is either a model type or a IO - type. Required. + :param check_name_availability: Check Name Availability Request. Is either a + CheckNameAvailabilityRequest type or a IO type. Required. :type check_name_availability: ~azure.mgmt.mixedreality.models.CheckNameAvailabilityRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -149,16 +143,14 @@ def check_name_availability_local( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckNameAvailabilityResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(check_name_availability, (IO, bytes)): + if isinstance(check_name_availability, (IOBase, bytes)): _content = check_name_availability else: _json = self._serialize.body(check_name_availability, "CheckNameAvailabilityRequest") @@ -175,10 +167,11 @@ def check_name_availability_local( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -194,4 +187,6 @@ def check_name_availability_local( return deserialized - check_name_availability_local.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/locations/{location}/checkNameAvailability"} # type: ignore + check_name_availability_local.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/locations/{location}/checkNameAvailability" + } diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_object_anchors_accounts_operations.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_object_anchors_accounts_operations.py index 67109873acf4..8965b08b7b30 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_object_anchors_accounts_operations.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_object_anchors_accounts_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +30,6 @@ from .._serialization import Serializer from .._vendor import MixedRealityClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +41,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +52,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,9 +67,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +82,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -107,9 +99,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +117,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,9 +132,7 @@ def build_get_request(resource_group_name: str, account_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +150,7 @@ def build_get_request(resource_group_name: str, account_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -179,10 +167,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -200,7 +186,7 @@ def build_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,10 +205,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -240,7 +224,7 @@ def build_create_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -259,9 +243,7 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -279,7 +261,7 @@ def build_list_keys_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -296,10 +278,8 @@ def build_regenerate_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -317,7 +297,7 @@ def build_regenerate_keys_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -362,10 +342,8 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ObjectAnchors _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ObjectAnchorsAccountPage] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ObjectAnchorsAccountPage] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -386,7 +364,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -402,7 +380,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -410,14 +388,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ObjectAnchorsAccountPage", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -429,7 +408,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/objectAnchorsAccounts"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/objectAnchorsAccounts" + } @distributed_trace def list_by_resource_group( @@ -448,10 +429,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ObjectAnchorsAccountPage] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ObjectAnchorsAccountPage] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -473,7 +452,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -489,7 +468,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -497,14 +476,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ObjectAnchorsAccountPage", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -516,7 +496,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -544,10 +526,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -559,10 +539,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -574,7 +555,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}" + } @distributed_trace def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.ObjectAnchorsAccount: @@ -600,10 +583,8 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ObjectAnchorsAccount] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ObjectAnchorsAccount] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -615,10 +596,11 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -634,7 +616,9 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}" + } @overload def update( @@ -704,8 +688,8 @@ def update( :type resource_group_name: str :param account_name: Name of an Mixed Reality Account. Required. :type account_name: str - :param object_anchors_account: Object Anchors Account parameter. Is either a model type or a IO - type. Required. + :param object_anchors_account: Object Anchors Account parameter. Is either a + ObjectAnchorsAccount type or a IO type. Required. :type object_anchors_account: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccount or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -726,16 +710,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ObjectAnchorsAccount] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ObjectAnchorsAccount] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(object_anchors_account, (IO, bytes)): + if isinstance(object_anchors_account, (IOBase, bytes)): _content = object_anchors_account else: _json = self._serialize.body(object_anchors_account, "ObjectAnchorsAccount") @@ -753,10 +735,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -772,7 +755,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}" + } @overload def create( @@ -842,8 +827,8 @@ def create( :type resource_group_name: str :param account_name: Name of an Mixed Reality Account. Required. :type account_name: str - :param object_anchors_account: Object Anchors Account parameter. Is either a model type or a IO - type. Required. + :param object_anchors_account: Object Anchors Account parameter. Is either a + ObjectAnchorsAccount type or a IO type. Required. :type object_anchors_account: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccount or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -864,16 +849,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ObjectAnchorsAccount] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ObjectAnchorsAccount] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(object_anchors_account, (IO, bytes)): + if isinstance(object_anchors_account, (IOBase, bytes)): _content = object_anchors_account else: _json = self._serialize.body(object_anchors_account, "ObjectAnchorsAccount") @@ -891,10 +874,11 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -910,11 +894,13 @@ def create( deserialized = self._deserialize("ObjectAnchorsAccount", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}" + } @distributed_trace def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.AccountKeys: @@ -940,10 +926,8 @@ def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountKeys] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AccountKeys] = kwargs.pop("cls", None) request = build_list_keys_request( resource_group_name=resource_group_name, @@ -955,10 +939,11 @@ def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -974,7 +959,9 @@ def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) return deserialized - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}/listKeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}/listKeys" + } @overload def regenerate_keys( @@ -1044,8 +1031,8 @@ def regenerate_keys( :type resource_group_name: str :param account_name: Name of an Mixed Reality Account. Required. :type account_name: str - :param regenerate: Required information for key regeneration. Is either a model type or a IO - type. Required. + :param regenerate: Required information for key regeneration. Is either a + AccountKeyRegenerateRequest type or a IO type. Required. :type regenerate: ~azure.mgmt.mixedreality.models.AccountKeyRegenerateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1066,16 +1053,14 @@ def regenerate_keys( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountKeys] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccountKeys] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(regenerate, (IO, bytes)): + if isinstance(regenerate, (IOBase, bytes)): _content = regenerate else: _json = self._serialize.body(regenerate, "AccountKeyRegenerateRequest") @@ -1093,10 +1078,11 @@ def regenerate_keys( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1112,4 +1098,6 @@ def regenerate_keys( return deserialized - regenerate_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}/regenerateKeys"} # type: ignore + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}/regenerateKeys" + } diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_operations.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_operations.py index 160126c71500..6ba1d5dc4c21 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_operations.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import MixedRealityClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,10 +86,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationPage] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationPage] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -116,7 +107,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -132,7 +123,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -140,14 +131,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationPage", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -159,4 +151,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.MixedReality/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.MixedReality/operations"} diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_remote_rendering_accounts_operations.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_remote_rendering_accounts_operations.py index 63694ff246d6..fd2bebc1c341 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_remote_rendering_accounts_operations.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_remote_rendering_accounts_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +30,6 @@ from .._serialization import Serializer from .._vendor import MixedRealityClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +41,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +52,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,9 +67,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +82,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -107,9 +99,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +117,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,9 +132,7 @@ def build_get_request(resource_group_name: str, account_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +150,7 @@ def build_get_request(resource_group_name: str, account_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -179,10 +167,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -200,7 +186,7 @@ def build_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,10 +205,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -240,7 +224,7 @@ def build_create_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -259,9 +243,7 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -279,7 +261,7 @@ def build_list_keys_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -296,10 +278,8 @@ def build_regenerate_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -317,7 +297,7 @@ def build_regenerate_keys_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -362,10 +342,8 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.RemoteRenderi _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RemoteRenderingAccountPage] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RemoteRenderingAccountPage] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -386,7 +364,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -402,7 +380,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -410,14 +388,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RemoteRenderingAccountPage", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -429,7 +408,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/remoteRenderingAccounts"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/remoteRenderingAccounts" + } @distributed_trace def list_by_resource_group( @@ -448,10 +429,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RemoteRenderingAccountPage] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RemoteRenderingAccountPage] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -473,7 +452,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -489,7 +468,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -497,14 +476,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RemoteRenderingAccountPage", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -516,7 +496,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -544,10 +526,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -559,10 +539,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -574,7 +555,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}" + } @distributed_trace def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.RemoteRenderingAccount: @@ -600,10 +583,8 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RemoteRenderingAccount] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RemoteRenderingAccount] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -615,10 +596,11 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -634,7 +616,9 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}" + } @overload def update( @@ -704,8 +688,8 @@ def update( :type resource_group_name: str :param account_name: Name of an Mixed Reality Account. Required. :type account_name: str - :param remote_rendering_account: Remote Rendering Account parameter. Is either a model type or - a IO type. Required. + :param remote_rendering_account: Remote Rendering Account parameter. Is either a + RemoteRenderingAccount type or a IO type. Required. :type remote_rendering_account: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -726,16 +710,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RemoteRenderingAccount] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RemoteRenderingAccount] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(remote_rendering_account, (IO, bytes)): + if isinstance(remote_rendering_account, (IOBase, bytes)): _content = remote_rendering_account else: _json = self._serialize.body(remote_rendering_account, "RemoteRenderingAccount") @@ -753,10 +735,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -772,7 +755,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}" + } @overload def create( @@ -842,8 +827,8 @@ def create( :type resource_group_name: str :param account_name: Name of an Mixed Reality Account. Required. :type account_name: str - :param remote_rendering_account: Remote Rendering Account parameter. Is either a model type or - a IO type. Required. + :param remote_rendering_account: Remote Rendering Account parameter. Is either a + RemoteRenderingAccount type or a IO type. Required. :type remote_rendering_account: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -864,16 +849,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RemoteRenderingAccount] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RemoteRenderingAccount] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(remote_rendering_account, (IO, bytes)): + if isinstance(remote_rendering_account, (IOBase, bytes)): _content = remote_rendering_account else: _json = self._serialize.body(remote_rendering_account, "RemoteRenderingAccount") @@ -891,10 +874,11 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -910,11 +894,13 @@ def create( deserialized = self._deserialize("RemoteRenderingAccount", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}" + } @distributed_trace def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.AccountKeys: @@ -940,10 +926,8 @@ def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountKeys] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AccountKeys] = kwargs.pop("cls", None) request = build_list_keys_request( resource_group_name=resource_group_name, @@ -955,10 +939,11 @@ def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -974,7 +959,9 @@ def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) return deserialized - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}/listKeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}/listKeys" + } @overload def regenerate_keys( @@ -1044,8 +1031,8 @@ def regenerate_keys( :type resource_group_name: str :param account_name: Name of an Mixed Reality Account. Required. :type account_name: str - :param regenerate: Required information for key regeneration. Is either a model type or a IO - type. Required. + :param regenerate: Required information for key regeneration. Is either a + AccountKeyRegenerateRequest type or a IO type. Required. :type regenerate: ~azure.mgmt.mixedreality.models.AccountKeyRegenerateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1066,16 +1053,14 @@ def regenerate_keys( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountKeys] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccountKeys] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(regenerate, (IO, bytes)): + if isinstance(regenerate, (IOBase, bytes)): _content = regenerate else: _json = self._serialize.body(regenerate, "AccountKeyRegenerateRequest") @@ -1093,10 +1078,11 @@ def regenerate_keys( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1112,4 +1098,6 @@ def regenerate_keys( return deserialized - regenerate_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}/regenerateKeys"} # type: ignore + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}/regenerateKeys" + } diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_spatial_anchors_accounts_operations.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_spatial_anchors_accounts_operations.py index 6dcfb9e59514..8bf472c407ae 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_spatial_anchors_accounts_operations.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_spatial_anchors_accounts_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +30,6 @@ from .._serialization import Serializer from .._vendor import MixedRealityClientMixinABC, _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +41,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +52,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,9 +67,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +82,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -107,9 +99,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +117,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,9 +132,7 @@ def build_get_request(resource_group_name: str, account_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +150,7 @@ def build_get_request(resource_group_name: str, account_name: str, subscription_ ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -179,10 +167,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -200,7 +186,7 @@ def build_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,10 +205,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -240,7 +224,7 @@ def build_create_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -259,9 +243,7 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -279,7 +261,7 @@ def build_list_keys_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -296,10 +278,8 @@ def build_regenerate_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -317,7 +297,7 @@ def build_regenerate_keys_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -362,10 +342,8 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SpatialAnchor _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SpatialAnchorsAccountPage] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SpatialAnchorsAccountPage] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -386,7 +364,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -402,7 +380,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -410,14 +388,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SpatialAnchorsAccountPage", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -429,7 +408,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/spatialAnchorsAccounts"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/spatialAnchorsAccounts" + } @distributed_trace def list_by_resource_group( @@ -448,10 +429,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SpatialAnchorsAccountPage] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SpatialAnchorsAccountPage] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -473,7 +452,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -489,7 +468,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -497,14 +476,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SpatialAnchorsAccountPage", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -516,7 +496,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -544,10 +526,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -559,10 +539,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -574,7 +555,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}" + } @distributed_trace def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.SpatialAnchorsAccount: @@ -600,10 +583,8 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SpatialAnchorsAccount] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SpatialAnchorsAccount] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -615,10 +596,11 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -634,7 +616,9 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}" + } @overload def update( @@ -704,8 +688,8 @@ def update( :type resource_group_name: str :param account_name: Name of an Mixed Reality Account. Required. :type account_name: str - :param spatial_anchors_account: Spatial Anchors Account parameter. Is either a model type or a - IO type. Required. + :param spatial_anchors_account: Spatial Anchors Account parameter. Is either a + SpatialAnchorsAccount type or a IO type. Required. :type spatial_anchors_account: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -726,16 +710,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SpatialAnchorsAccount] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SpatialAnchorsAccount] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(spatial_anchors_account, (IO, bytes)): + if isinstance(spatial_anchors_account, (IOBase, bytes)): _content = spatial_anchors_account else: _json = self._serialize.body(spatial_anchors_account, "SpatialAnchorsAccount") @@ -753,10 +735,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -772,7 +755,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}" + } @overload def create( @@ -842,8 +827,8 @@ def create( :type resource_group_name: str :param account_name: Name of an Mixed Reality Account. Required. :type account_name: str - :param spatial_anchors_account: Spatial Anchors Account parameter. Is either a model type or a - IO type. Required. + :param spatial_anchors_account: Spatial Anchors Account parameter. Is either a + SpatialAnchorsAccount type or a IO type. Required. :type spatial_anchors_account: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -864,16 +849,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SpatialAnchorsAccount] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SpatialAnchorsAccount] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(spatial_anchors_account, (IO, bytes)): + if isinstance(spatial_anchors_account, (IOBase, bytes)): _content = spatial_anchors_account else: _json = self._serialize.body(spatial_anchors_account, "SpatialAnchorsAccount") @@ -891,10 +874,11 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -910,11 +894,13 @@ def create( deserialized = self._deserialize("SpatialAnchorsAccount", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}" + } @distributed_trace def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.AccountKeys: @@ -940,10 +926,8 @@ def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountKeys] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AccountKeys] = kwargs.pop("cls", None) request = build_list_keys_request( resource_group_name=resource_group_name, @@ -955,10 +939,11 @@ def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -974,7 +959,9 @@ def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) return deserialized - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}/listKeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}/listKeys" + } @overload def regenerate_keys( @@ -1044,8 +1031,8 @@ def regenerate_keys( :type resource_group_name: str :param account_name: Name of an Mixed Reality Account. Required. :type account_name: str - :param regenerate: Required information for key regeneration. Is either a model type or a IO - type. Required. + :param regenerate: Required information for key regeneration. Is either a + AccountKeyRegenerateRequest type or a IO type. Required. :type regenerate: ~azure.mgmt.mixedreality.models.AccountKeyRegenerateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1066,16 +1053,14 @@ def regenerate_keys( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountKeys] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccountKeys] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(regenerate, (IO, bytes)): + if isinstance(regenerate, (IOBase, bytes)): _content = regenerate else: _json = self._serialize.body(regenerate, "AccountKeyRegenerateRequest") @@ -1093,10 +1078,11 @@ def regenerate_keys( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1112,4 +1098,6 @@ def regenerate_keys( return deserialized - regenerate_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}/regenerateKeys"} # type: ignore + regenerate_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}/regenerateKeys" + } diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/delete_object_anchors_account.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/objectanchors/delete.py similarity index 92% rename from sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/delete_object_anchors_account.py rename to sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/objectanchors/delete.py index 9deb2f6501ad..03fa0c1b75b6 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/delete_object_anchors_account.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/objectanchors/delete.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mixedreality # USAGE - python delete_object_anchors_account.py + python delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,11 +29,10 @@ def main(): subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", ) - response = client.object_anchors_accounts.delete( + client.object_anchors_accounts.delete( resource_group_name="MyResourceGroup", account_name="MyAccount", ) - print(response) # x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/object-anchors/Delete.json diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/get_object_anchors_account.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/objectanchors/get.py similarity index 97% rename from sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/get_object_anchors_account.py rename to sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/objectanchors/get.py index 1dd5d4ba12f4..dfe6d0809716 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/get_object_anchors_account.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/objectanchors/get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mixedreality # USAGE - python get_object_anchors_account.py + python get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_object_anchors_accounts_by_resource_group.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/objectanchors/get_by_resource_group.py similarity index 96% rename from sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_object_anchors_accounts_by_resource_group.py rename to sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/objectanchors/get_by_resource_group.py index 2d7d38012730..c92d53379f39 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_object_anchors_accounts_by_resource_group.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/objectanchors/get_by_resource_group.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mixedreality # USAGE - python list_object_anchors_accounts_by_resource_group.py + python get_by_resource_group.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_object_anchors_accounts_by_subscription.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/objectanchors/get_by_subscription.py similarity index 96% rename from sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_object_anchors_accounts_by_subscription.py rename to sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/objectanchors/get_by_subscription.py index a1ffd007ccde..9f147532dfdf 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_object_anchors_accounts_by_subscription.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/objectanchors/get_by_subscription.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mixedreality # USAGE - python list_object_anchors_accounts_by_subscription.py + python get_by_subscription.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_object_anchors_account_key.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/objectanchors/list_keys.py similarity index 97% rename from sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_object_anchors_account_key.py rename to sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/objectanchors/list_keys.py index 93ba692dfb18..77c9194db67c 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_object_anchors_account_key.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/objectanchors/list_keys.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mixedreality # USAGE - python list_object_anchors_account_key.py + python list_keys.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/update_object_anchors_account.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/objectanchors/patch.py similarity index 97% rename from sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/update_object_anchors_account.py rename to sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/objectanchors/patch.py index 99fe799d2548..e8cc460dff3b 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/update_object_anchors_account.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/objectanchors/patch.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mixedreality # USAGE - python update_object_anchors_account.py + python patch.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/create_object_anchors_account.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/objectanchors/put.py similarity index 97% rename from sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/create_object_anchors_account.py rename to sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/objectanchors/put.py index b17ad3f371f4..5d25df4ada8d 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/create_object_anchors_account.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/objectanchors/put.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mixedreality # USAGE - python create_object_anchors_account.py + python put.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/regenerate_object_anchors_account_keys.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/objectanchors/regenerate_key.py similarity index 96% rename from sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/regenerate_object_anchors_account_keys.py rename to sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/objectanchors/regenerate_key.py index b21b26583770..0d2d2e2ba69b 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/regenerate_object_anchors_account_keys.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/objectanchors/regenerate_key.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mixedreality # USAGE - python regenerate_object_anchors_account_keys.py + python regenerate_key.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/check_local_name_availability.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/proxy/check_name_availability_for_local_uniqueness.py similarity index 96% rename from sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/check_local_name_availability.py rename to sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/proxy/check_name_availability_for_local_uniqueness.py index 80fe1cf0c6ce..56c6b4dfda9d 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/check_local_name_availability.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/proxy/check_name_availability_for_local_uniqueness.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mixedreality # USAGE - python check_local_name_availability.py + python check_name_availability_for_local_uniqueness.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_available_operations.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/proxy/exposing_available_operations.py similarity index 97% rename from sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_available_operations.py rename to sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/proxy/exposing_available_operations.py index 938dd15334e3..6d7cae4d0f4e 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_available_operations.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/proxy/exposing_available_operations.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mixedreality # USAGE - python list_available_operations.py + python exposing_available_operations.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/delete_remote_rendering_account.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/remoterendering/delete.py similarity index 92% rename from sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/delete_remote_rendering_account.py rename to sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/remoterendering/delete.py index a19e224f291c..0bc69e9a189b 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/delete_remote_rendering_account.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/remoterendering/delete.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mixedreality # USAGE - python delete_remote_rendering_account.py + python delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,11 +29,10 @@ def main(): subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", ) - response = client.remote_rendering_accounts.delete( + client.remote_rendering_accounts.delete( resource_group_name="MyResourceGroup", account_name="MyAccount", ) - print(response) # x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/remote-rendering/Delete.json diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/get_remote_rendering_account.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/remoterendering/get.py similarity index 97% rename from sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/get_remote_rendering_account.py rename to sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/remoterendering/get.py index 764e7ee9da3b..616f4478d545 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/get_remote_rendering_account.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/remoterendering/get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mixedreality # USAGE - python get_remote_rendering_account.py + python get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_remote_rendering_accounts_by_resource_group.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/remoterendering/get_by_resource_group.py similarity index 96% rename from sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_remote_rendering_accounts_by_resource_group.py rename to sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/remoterendering/get_by_resource_group.py index 8c2c8e473fc6..743dd1aa9fe8 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_remote_rendering_accounts_by_resource_group.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/remoterendering/get_by_resource_group.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mixedreality # USAGE - python list_remote_rendering_accounts_by_resource_group.py + python get_by_resource_group.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_remote_rendering_accounts_by_subscription.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/remoterendering/get_by_subscription.py similarity index 96% rename from sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_remote_rendering_accounts_by_subscription.py rename to sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/remoterendering/get_by_subscription.py index f0d03bdad725..6c32dc1d47a8 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_remote_rendering_accounts_by_subscription.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/remoterendering/get_by_subscription.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mixedreality # USAGE - python list_remote_rendering_accounts_by_subscription.py + python get_by_subscription.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_remote_rendering_account_key.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/remoterendering/list_keys.py similarity index 97% rename from sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_remote_rendering_account_key.py rename to sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/remoterendering/list_keys.py index e9630b503040..571153e9331e 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_remote_rendering_account_key.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/remoterendering/list_keys.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mixedreality # USAGE - python list_remote_rendering_account_key.py + python list_keys.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/update_remote_rendering_account.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/remoterendering/patch.py similarity index 97% rename from sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/update_remote_rendering_account.py rename to sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/remoterendering/patch.py index fc8f069d1107..d622428136e5 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/update_remote_rendering_account.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/remoterendering/patch.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mixedreality # USAGE - python update_remote_rendering_account.py + python patch.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/create_remote_rendering_account.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/remoterendering/put.py similarity index 97% rename from sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/create_remote_rendering_account.py rename to sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/remoterendering/put.py index 8ca3d282b860..0853a8f70f32 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/create_remote_rendering_account.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/remoterendering/put.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mixedreality # USAGE - python create_remote_rendering_account.py + python put.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/regenerate_remote_rendering_account_keys.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/remoterendering/regenerate_key.py similarity index 96% rename from sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/regenerate_remote_rendering_account_keys.py rename to sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/remoterendering/regenerate_key.py index ddc7495cac8a..560440a52888 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/regenerate_remote_rendering_account_keys.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/remoterendering/regenerate_key.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mixedreality # USAGE - python regenerate_remote_rendering_account_keys.py + python regenerate_key.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/delete_spatial_anchors_account.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/spatialanchors/delete.py similarity index 92% rename from sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/delete_spatial_anchors_account.py rename to sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/spatialanchors/delete.py index 1c3db073ca22..cffe8d95a0cd 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/delete_spatial_anchors_account.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/spatialanchors/delete.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mixedreality # USAGE - python delete_spatial_anchors_account.py + python delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,11 +29,10 @@ def main(): subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", ) - response = client.spatial_anchors_accounts.delete( + client.spatial_anchors_accounts.delete( resource_group_name="MyResourceGroup", account_name="MyAccount", ) - print(response) # x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/spatial-anchors/Delete.json diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/get_spatial_anchors_account.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/spatialanchors/get.py similarity index 97% rename from sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/get_spatial_anchors_account.py rename to sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/spatialanchors/get.py index e6d7483274c6..2722761584e4 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/get_spatial_anchors_account.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/spatialanchors/get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mixedreality # USAGE - python get_spatial_anchors_account.py + python get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_spatial_anchor_accounts_by_resource_group.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/spatialanchors/get_by_resource_group.py similarity index 96% rename from sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_spatial_anchor_accounts_by_resource_group.py rename to sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/spatialanchors/get_by_resource_group.py index 6fa05209a844..a4b56625fa75 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_spatial_anchor_accounts_by_resource_group.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/spatialanchors/get_by_resource_group.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mixedreality # USAGE - python list_spatial_anchor_accounts_by_resource_group.py + python get_by_resource_group.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_spatial_anchors_accounts_by_subscription.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/spatialanchors/get_by_subscription.py similarity index 96% rename from sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_spatial_anchors_accounts_by_subscription.py rename to sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/spatialanchors/get_by_subscription.py index 7c6827784ef5..bbe721e3d51a 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_spatial_anchors_accounts_by_subscription.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/spatialanchors/get_by_subscription.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mixedreality # USAGE - python list_spatial_anchors_accounts_by_subscription.py + python get_by_subscription.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_spatial_anchor_account_key.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/spatialanchors/list_keys.py similarity index 97% rename from sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_spatial_anchor_account_key.py rename to sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/spatialanchors/list_keys.py index 796ce7b546a1..7bd6c2768348 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_spatial_anchor_account_key.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/spatialanchors/list_keys.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mixedreality # USAGE - python list_spatial_anchor_account_key.py + python list_keys.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/update_spatial_anchors_account.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/spatialanchors/patch.py similarity index 97% rename from sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/update_spatial_anchors_account.py rename to sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/spatialanchors/patch.py index 99c7dcc523b0..41e71287be5e 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/update_spatial_anchors_account.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/spatialanchors/patch.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mixedreality # USAGE - python update_spatial_anchors_account.py + python patch.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/create_spatial_anchor_account.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/spatialanchors/put.py similarity index 97% rename from sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/create_spatial_anchor_account.py rename to sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/spatialanchors/put.py index 1e541a37b16d..41919c5e684a 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/create_spatial_anchor_account.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/spatialanchors/put.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mixedreality # USAGE - python create_spatial_anchor_account.py + python put.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/regenerate_spatial_anchors_account_keys.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/spatialanchors/regenerate_key.py similarity index 96% rename from sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/regenerate_spatial_anchors_account_keys.py rename to sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/spatialanchors/regenerate_key.py index 712f7a52a7bf..5ec4fa2224f3 100644 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/regenerate_spatial_anchors_account_keys.py +++ b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/spatialanchors/regenerate_key.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mixedreality # USAGE - python regenerate_spatial_anchors_account_keys.py + python regenerate_key.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,