diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/_meta.json b/sdk/resourcehealth/azure-mgmt-resourcehealth/_meta.json index e86f53a0a342..bc346affce82 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/_meta.json +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/_meta.json @@ -1,11 +1,11 @@ { - "commit": "5ad969c742647212adb951f9e96858a5b2a761f9", + "commit": "ca14de928f3b6d869b5d2141a0b9701fcf0b8f1e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.1", + "@autorest/python@6.2.7", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/resourcehealth/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/resourcehealth/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.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/resourcehealth/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_configuration.py index f5442c41b4c0..1f27100b3373 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_configuration.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_configuration.py @@ -36,9 +36,8 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, - **kwargs # type: Any + **kwargs: Any ): - # type: (...) -> None if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -53,9 +52,8 @@ def __init__( def _configure( self, - **kwargs # type: Any + **kwargs: Any ): - # type: (...) -> 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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_microsoft_resource_health.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_microsoft_resource_health.py index fc2016510ecd..e2ddd28c66cd 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_microsoft_resource_health.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_microsoft_resource_health.py @@ -67,10 +67,10 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, - api_version=None, # type: Optional[str] + api_version: Optional[str]=None, base_url: str = "https://management.azure.com", - profile=KnownProfiles.default, # type: KnownProfiles - **kwargs # type: Any + profile: KnownProfiles=KnownProfiles.default, + **kwargs: Any ): self._config = MicrosoftResourceHealthConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_serialization.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_serialization.py index 240df16c57f3..2c170e28dbca 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_serialization.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,34 +38,33 @@ import re import sys import codecs +from typing import Optional, Union, AnyStr, IO, 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 +import isodate # type: ignore -from typing import Dict, Any, cast, TYPE_CHECKING +from typing import Dict, Any, cast from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback -_BOM = codecs.BOM_UTF8.decode(encoding='utf-8') +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping class RawDeserializer: # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r'^(application|text)/([a-z+.]+\+)?json$') + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") # Name used in context 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. @@ -75,12 +75,12 @@ def deserialize_from_text(cls, data, content_type=None): :type data: str or bytes or IO :param str content_type: The content type. """ - if hasattr(data, 'read'): + if hasattr(data, "read"): # Assume a stream data = cast(IO, data).read() if isinstance(data, bytes): - data_as_str = data.decode(encoding='utf-8-sig') + data_as_str = data.decode(encoding="utf-8-sig") else: # Explain to mypy the correct type. data_as_str = cast(str, data) @@ -116,7 +116,8 @@ def _json_attemp(data): try: return True, json.loads(data) except ValueError: - return False, None # Don't care about this one + return False, None # Don't care about this one + success, json_result = _json_attemp(data) if success: return json_result @@ -129,8 +130,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 @@ -139,8 +139,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): """ # Try to use content-type from headers if available content_type = None - if 'content-type' in headers: - content_type = headers['content-type'].split(";")[0].strip().lower() + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() # Ouch, this server did not declare what it sent... # Let's guess it's JSON... # Also, since Autorest was considering that an empty body was a valid JSON, @@ -152,20 +152,22 @@ def deserialize_from_http_generics(cls, body_bytes, headers): return cls.deserialize_from_text(body_bytes, content_type) return None + try: 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__) try: - _long_type = long # type: ignore + _long_type = long # type: ignore except NameError: _long_type = int + class UTC(datetime.tzinfo): """Time Zone info for handling UTC""" @@ -181,9 +183,11 @@ def dst(self, dt): """No daylight saving for UTC.""" return datetime.timedelta(hours=1) + 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 """Fixed offset in minutes east from UTC. Copy/pasted from Python doc @@ -197,7 +201,7 @@ def utcoffset(self, dt): return self.__offset def tzname(self, dt): - return str(self.__offset.total_seconds()/3600) + return str(self.__offset.total_seconds() / 3600) def __repr__(self): return "".format(self.tzname(None)) @@ -208,14 +212,17 @@ def dst(self, dt): def __getinitargs__(self): return (self.__offset,) + try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore _FLATTEN = re.compile(r"(? y, @@ -502,25 +515,25 @@ class Serializer(object): "max_items": lambda x, y: len(x) > y, "pattern": lambda x, y: not re.match(y, x, re.UNICODE), "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0 - } + "multiple": lambda x, y: x % y != 0, + } def __init__(self, classes=None): self.serialize_type = { - 'iso-8601': Serializer.serialize_iso, - 'rfc-1123': Serializer.serialize_rfc, - 'unix-time': Serializer.serialize_unix, - 'duration': Serializer.serialize_duration, - 'date': Serializer.serialize_date, - 'time': Serializer.serialize_time, - 'decimal': Serializer.serialize_decimal, - 'long': Serializer.serialize_long, - 'bytearray': Serializer.serialize_bytearray, - 'base64': Serializer.serialize_base64, - 'object': self.serialize_object, - '[]': self.serialize_iter, - '{}': self.serialize_dict - } + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } self.dependencies = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -542,14 +555,12 @@ def _serialize(self, target_obj, data_type=None, **kwargs): class_name = target_obj.__class__.__name__ if data_type: - return self.serialize_data( - target_obj, data_type, **kwargs) + return self.serialize_data(target_obj, data_type, **kwargs) if not hasattr(target_obj, "_attribute_map"): data_type = type(target_obj).__name__ if data_type in self.basic_types.values(): - return self.serialize_data( - target_obj, data_type, **kwargs) + return self.serialize_data(target_obj, data_type, **kwargs) # Force "is_xml" kwargs if we detect a XML model try: @@ -564,10 +575,10 @@ def _serialize(self, target_obj, data_type=None, **kwargs): attributes = target_obj._attribute_map for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get('readonly', False): + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): continue - if attr_name == "additional_properties" and attr_desc["key"] == '': + if attr_name == "additional_properties" and attr_desc["key"] == "": if target_obj.additional_properties is not None: serialized.update(target_obj.additional_properties) continue @@ -575,68 +586,61 @@ def _serialize(self, target_obj, data_type=None, **kwargs): orig_attr = getattr(target_obj, attr) if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) keys = keys if isinstance(keys, list) else [keys] - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc['type'], **kwargs) - + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) if is_xml_model_serialization: - xml_desc = attr_desc.get('xml', {}) - xml_name = xml_desc.get('name', attr_desc['key']) - xml_prefix = xml_desc.get('prefix', None) - xml_ns = xml_desc.get('ns', None) + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) 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) + 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', {}): + if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace + if len(splitted_tag) == 2: # Namespace 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 = _create_xml_node(xml_name, xml_prefix, xml_ns) local_node.text = unicode_str(new_attr) - serialized.append(local_node) - else: # JSON - for k in reversed(keys): + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore unflattened = {k: new_attr} new_attr = unflattened _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 except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format( - attr_name, class_name, str(target_obj)) + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise_with_traceback(SerializationError, msg, err) else: return serialized @@ -652,7 +656,7 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip('[]{}') + internal_data_type = data_type.strip("[]{}") internal_data_type = self.dependencies.get(internal_data_type, None) try: is_xml_model_serialization = kwargs["is_xml"] @@ -668,19 +672,18 @@ 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: deserializer.key_extractors = [ rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor + last_rest_key_case_insensitive_extractor, ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback( - SerializationError, "Unable to build a model: "+str(err), err) + raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) return self._serialize(data, data_type, **kwargs) @@ -695,13 +698,13 @@ def url(self, name, data, data_type, **kwargs): """ try: output = self.serialize_data(data, data_type, **kwargs) - if data_type == 'bool': + if data_type == "bool": output = json.dumps(output) - if kwargs.get('skip_quote') is True: + if kwargs.get("skip_quote") is True: output = str(output) else: - output = quote(str(output), safe='') + output = quote(str(output), safe="") except SerializationError: raise TypeError("{} must be type {}.".format(name, data_type)) else: @@ -720,27 +723,19 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [ - self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" - for d - in data - ] - if not kwargs.get('skip_quote', False): - data = [ - quote(str(d), safe='') - for d - in data - ] + data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] + if not kwargs.get("skip_quote", False): + data = [quote(str(d), safe="") for d in data] return str(self.serialize_iter(data, internal_data_type, **kwargs)) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) - if data_type == 'bool': + if data_type == "bool": output = json.dumps(output) - if kwargs.get('skip_quote') is True: + if kwargs.get("skip_quote") is True: output = str(output) else: - output = quote(str(output), safe='') + output = quote(str(output), safe="") except SerializationError: raise TypeError("{} must be type {}.".format(name, data_type)) else: @@ -756,11 +751,11 @@ def header(self, name, data, data_type, **kwargs): :raises: ValueError if data is None """ try: - if data_type in ['[str]']: + if data_type in ["[str]"]: data = ["" if d is None else d for d in data] output = self.serialize_data(data, data_type, **kwargs) - if data_type == 'bool': + if data_type == "bool": output = json.dumps(output) except SerializationError: raise TypeError("{} must be type {}.".format(name, data_type)) @@ -796,13 +791,11 @@ def serialize_data(self, data, data_type, **kwargs): iter_type = data_type[0] + data_type[-1] if iter_type in self.serialize_type: - return self.serialize_type[iter_type]( - data, data_type[1:-1], **kwargs) + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback( - SerializationError, msg.format(data, data_type), err) + raise_with_traceback(SerializationError, msg.format(data, data_type), err) else: return self._serialize(data, **kwargs) @@ -829,7 +822,7 @@ def serialize_basic(cls, data, data_type, **kwargs): custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) - if data_type == 'str': + if data_type == "str": return cls.serialize_unicode(data) return eval(data_type)(data) # nosec @@ -847,7 +840,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 @@ -886,25 +879,21 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialized.append(None) if div: - serialized = ['' if s is None else str(s) for s in serialized] + serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) - if 'xml' in serialization_ctxt or is_xml: + if "xml" in serialization_ctxt or is_xml: # XML serialization is more complicated - xml_desc = serialization_ctxt.get('xml', {}) - xml_name = xml_desc.get('name') + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") if not xml_name: - xml_name = serialization_ctxt['key'] + xml_name = serialization_ctxt["key"] # Create a wrap node if necessary (use the fact that Element and list have "append") is_wrapped = xml_desc.get("wrapped", False) node_name = xml_desc.get("itemsName", xml_name) if is_wrapped: - final_result = _create_xml_node( - xml_name, - xml_desc.get('prefix', None), - xml_desc.get('ns', None) - ) + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) else: final_result = [] # All list elements to "local_node" @@ -912,11 +901,7 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): if isinstance(el, ET.Element): el_node = el else: - el_node = _create_xml_node( - node_name, - xml_desc.get('prefix', None), - xml_desc.get('ns', None) - ) + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) if el is not None: # Otherwise it writes "None" :-p el_node.text = str(el) final_result.append(el_node) @@ -936,21 +921,16 @@ def serialize_dict(self, attr, dict_type, **kwargs): serialized = {} for key, value in attr.items(): try: - serialized[self.serialize_unicode(key)] = self.serialize_data( - value, dict_type, **kwargs) + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) except ValueError: serialized[self.serialize_unicode(key)] = None - if 'xml' in serialization_ctxt: + if "xml" in serialization_ctxt: # XML serialization is more complicated - xml_desc = serialization_ctxt['xml'] - xml_name = xml_desc['name'] + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] - final_result = _create_xml_node( - xml_name, - xml_desc.get('prefix', None), - xml_desc.get('ns', None) - ) + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) for key, value in serialized.items(): ET.SubElement(final_result, key).text = value return final_result @@ -996,8 +976,7 @@ def serialize_object(self, attr, **kwargs): serialized = {} for key, value in attr.items(): try: - serialized[self.serialize_unicode(key)] = self.serialize_object( - value, **kwargs) + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) except ValueError: serialized[self.serialize_unicode(key)] = None return serialized @@ -1006,8 +985,7 @@ def serialize_object(self, attr, **kwargs): serialized = [] for obj in attr: try: - serialized.append(self.serialize_object( - obj, **kwargs)) + serialized.append(self.serialize_object(obj, **kwargs)) except ValueError: pass return serialized @@ -1020,10 +998,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}" @@ -1045,8 +1023,8 @@ def serialize_base64(attr, **kwargs): :param attr: Object to be serialized. :rtype: str """ - encoded = b64encode(attr).decode('ascii') - return encoded.strip('=').replace('+', '-').replace('/', '_') + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod def serialize_decimal(attr, **kwargs): @@ -1113,16 +1091,20 @@ def serialize_rfc(attr, **kwargs): """ try: if not attr.tzinfo: - _LOGGER.warning( - "Datetime with no tzinfo will be considered UTC.") + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() except AttributeError: raise TypeError("RFC1123 object must be valid Datetime object.") return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], utc.tm_mday, - Serializer.months[utc.tm_mon], utc.tm_year, - utc.tm_hour, utc.tm_min, utc.tm_sec) + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) @staticmethod def serialize_iso(attr, **kwargs): @@ -1136,19 +1118,18 @@ def serialize_iso(attr, **kwargs): attr = isodate.parse_datetime(attr) try: if not attr.tzinfo: - _LOGGER.warning( - "Datetime with no tzinfo will be considered UTC.") + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() if utc.tm_year > 9999 or utc.tm_year < 1: raise OverflowError("Hit max or min date") - microseconds = str(attr.microsecond).rjust(6,'0').rstrip('0').ljust(3, '0') + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") if microseconds: - microseconds = '.'+microseconds + microseconds = "." + microseconds date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, - utc.tm_hour, utc.tm_min, utc.tm_sec) - return date + microseconds + 'Z' + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." raise_with_traceback(SerializationError, msg, err) @@ -1169,17 +1150,17 @@ def serialize_unix(attr, **kwargs): return attr try: if not attr.tzinfo: - _LOGGER.warning( - "Datetime with no tzinfo will be considered UTC.") + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) except AttributeError: raise TypeError("Unix time object must be valid Datetime object.") + def rest_key_extractor(attr, attr_desc, data): - key = attr_desc['key'] + key = attr_desc["key"] working_data = data - while '.' in key: + while "." in key: dict_keys = _FLATTEN.split(key) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) @@ -1191,15 +1172,16 @@ def rest_key_extractor(attr, attr_desc, data): # that all properties under are None as well # https://github.com/Azure/msrest-for-python/issues/197 return None - key = '.'.join(dict_keys[1:]) + key = ".".join(dict_keys[1:]) return working_data.get(key) + def rest_key_case_insensitive_extractor(attr, attr_desc, data): - key = attr_desc['key'] + key = attr_desc["key"] working_data = data - while '.' in key: + while "." in key: dict_keys = _FLATTEN.split(key) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) @@ -1211,30 +1193,33 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): # that all properties under are None as well # https://github.com/Azure/msrest-for-python/issues/197 return None - key = '.'.join(dict_keys[1:]) + key = ".".join(dict_keys[1:]) if working_data: return attribute_key_case_insensitive_extractor(key, None, working_data) + def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key. - """ - key = attr_desc['key'] + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) + def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" """ - key = attr_desc['key'] + key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + def attribute_key_extractor(attr, _, data): return data.get(attr) + def attribute_key_case_insensitive_extractor(attr, _, data): found_key = None lower_attr = attr.lower() @@ -1245,6 +1230,7 @@ def attribute_key_case_insensitive_extractor(attr, _, data): return data.get(found_key) + def _extract_name_from_internal_type(internal_type): """Given an internal type XML description, extract correct XML name with namespace. @@ -1253,7 +1239,7 @@ def _extract_name_from_internal_type(internal_type): :returns: A tuple XML name + namespace dict """ internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get('name', internal_type.__name__) + 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) @@ -1268,17 +1254,17 @@ def xml_key_extractor(attr, attr_desc, data): if not isinstance(data, ET.Element): return None - xml_desc = attr_desc.get('xml', {}) - xml_name = xml_desc.get('name', attr_desc['key']) + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) # Look for a children - is_iter_type = attr_desc['type'].startswith("[") + is_iter_type = attr_desc["type"].startswith("[") is_wrapped = xml_desc.get("wrapped", False) internal_type = attr_desc.get("internalType", None) internal_type_xml_map = getattr(internal_type, "_xml_map", {}) # Integrate namespace if necessary - xml_ns = xml_desc.get('ns', internal_type_xml_map.get("ns", None)) + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: xml_name = "{}{}".format(xml_ns, xml_name) @@ -1294,15 +1280,15 @@ def xml_key_extractor(attr, attr_desc, data): # - Wrapped node # - Internal type is an enum (considered basic types) # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or 'name' not in internal_type_xml_map)): + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): children = data.findall(xml_name) # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and 'name' in internal_type_xml_map: + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: xml_name = _extract_name_from_internal_type(internal_type) children = data.findall(xml_name) # That's an array else: - if internal_type: # Complex type, ignore itemsName and use the complex type name + if internal_type: # Complex type, ignore itemsName and use the complex type name items_name = _extract_name_from_internal_type(internal_type) else: items_name = xml_desc.get("itemsName", xml_name) @@ -1311,21 +1297,22 @@ def xml_key_extractor(attr, attr_desc, data): if len(children) == 0: if is_iter_type: if is_wrapped: - return None # is_wrapped no node, we want None + return None # is_wrapped no node, we want None else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) + else: # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name - )) + ) + ) return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty @@ -1333,6 +1320,7 @@ def xml_key_extractor(attr, attr_desc, data): raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) return children[0] + class Deserializer(object): """Response object model deserializer. @@ -1340,37 +1328,32 @@ class Deserializer(object): :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. """ - basic_types = {str: 'str', int: 'int', bool: 'bool', float: 'float'} + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - 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}]?') + 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): self.deserialize_type = { - 'iso-8601': Deserializer.deserialize_iso, - 'rfc-1123': Deserializer.deserialize_rfc, - 'unix-time': Deserializer.deserialize_unix, - 'duration': Deserializer.deserialize_duration, - 'date': Deserializer.deserialize_date, - 'time': Deserializer.deserialize_time, - 'decimal': Deserializer.deserialize_decimal, - 'long': Deserializer.deserialize_long, - 'bytearray': Deserializer.deserialize_bytearray, - 'base64': Deserializer.deserialize_base64, - 'object': self.deserialize_object, - '[]': self.deserialize_iter, - '{}': self.deserialize_dict - } + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } self.deserialize_expected_types = { - 'duration': (isodate.Duration, datetime.timedelta), - 'iso-8601': (datetime.datetime) + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), } self.dependencies = dict(classes) if classes else {} - self.key_extractors = [ - rest_key_extractor, - xml_key_extractor - ] + 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 # complicated, with no real scenario for now. @@ -1403,8 +1386,7 @@ def _deserialize(self, target_obj, data): """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, '_validation', {}).items() - if config.get('constant')] + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: for attr, mapconfig in data._attribute_map.items(): if attr in constants: @@ -1412,15 +1394,11 @@ def _deserialize(self, target_obj, data): value = getattr(data, attr) if value is None: continue - local_type = mapconfig['type'] - internal_data_type = local_type.strip('[]{}') + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): continue - setattr( - data, - attr, - self._deserialize(local_type, value) - ) + setattr(data, attr, self._deserialize(local_type, value)) return data except AttributeError: return @@ -1435,16 +1413,16 @@ 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"... - if attr == "additional_properties" and attr_desc["key"] == '': + if attr == "additional_properties" and attr_desc["key"] == "": continue raw_value = None # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip('[]{}') + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") if internal_data_type in self.dependencies: attr_desc["internalType"] = self.dependencies[internal_data_type] @@ -1452,21 +1430,18 @@ def _deserialize(self, target_obj, data): found_value = key_extractor(attr, attr_desc, data) if found_value is not None: if raw_value is not None and raw_value != found_value: - msg = ("Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" ) - _LOGGER.warning( - msg, - found_value, - key_extractor, - attr + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" ) + _LOGGER.warning(msg, found_value, key_extractor, attr) continue raw_value = found_value - value = self.deserialize_data(raw_value, attr_desc['type']) + 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) @@ -1475,14 +1450,17 @@ def _deserialize(self, target_obj, data): def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != '': + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": # Check empty string. If it's not empty, someone has a real "additionalProperties" return None if isinstance(data, ET.Element): data = {el.tag: el.text for el in data} - known_keys = {_decode_attribute_map_key(_FLATTEN.split(desc['key'])[0]) - for desc in attribute_map.values() if desc['key'] != ''} + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } present_keys = set(data.keys()) missing_keys = present_keys - known_keys return {key: data[key] for key in missing_keys} @@ -1525,8 +1503,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): return self(target_obj, data, content_type=content_type) except: _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", - exc_info=True + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) return None @@ -1554,22 +1531,16 @@ def _unpack_content(raw_data, content_type=None): return context[RawDeserializer.CONTEXT_NAME] raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - #Assume this is enough to recognize universal_http.ClientResponse without importing it + # Assume this is enough to recognize universal_http.ClientResponse without importing it if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics( - raw_data.text(), - raw_data.headers - ) + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, '_content_consumed'): - return RawDeserializer.deserialize_from_http_generics( - raw_data.text, - raw_data.headers - ) + if hasattr(raw_data, "_content_consumed"): + 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) + if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1579,14 +1550,11 @@ def _instantiate_model(self, response, attrs, additional_properties=None): :param d_attrs: The deserialized response attributes. """ if callable(response): - subtype = getattr(response, '_subtype_map', {}) + subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() - if v.get('readonly')] - const = [k for k, v in response._validation.items() - if v.get('constant')] - kwargs = {k: v for k, v in attrs.items() - if k not in subtype and k not in readonly + const} + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) @@ -1594,8 +1562,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: @@ -1659,13 +1626,10 @@ def deserialize_iter(self, attr, iter_type): """ if attr is None: return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children + if isinstance(attr, ET.Element): # If I receive an element here, get the children attr = list(attr) if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format( - iter_type, - type(attr) - )) + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) return [self.deserialize_data(a, iter_type) for a in attr] def deserialize_dict(self, attr, dict_type): @@ -1677,7 +1641,7 @@ def deserialize_dict(self, attr, dict_type): :rtype: dict """ if isinstance(attr, list): - return {x['key']: self.deserialize_data(x['value'], dict_type) for x in attr} + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} if isinstance(attr, ET.Element): # Transform value into {"Key": "value"} @@ -1698,7 +1662,7 @@ def deserialize_object(self, attr, **kwargs): # Do no recurse on XML, just return the tree as-is return attr if isinstance(attr, basestring): - return self.deserialize_basic(attr, 'str') + return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: return self.deserialize_basic(attr, self.basic_types[obj_type]) @@ -1709,8 +1673,7 @@ def deserialize_object(self, attr, **kwargs): deserialized = {} for key, value in attr.items(): try: - deserialized[key] = self.deserialize_object( - value, **kwargs) + deserialized[key] = self.deserialize_object(value, **kwargs) except ValueError: deserialized[key] = None return deserialized @@ -1719,8 +1682,7 @@ def deserialize_object(self, attr, **kwargs): deserialized = [] for obj in attr: try: - deserialized.append(self.deserialize_object( - obj, **kwargs)) + deserialized.append(self.deserialize_object(obj, **kwargs)) except ValueError: pass return deserialized @@ -1747,23 +1709,23 @@ def deserialize_basic(self, attr, data_type): if not attr: if data_type == "str": # None or '', node is empty string. - return '' + return "" else: # None or '', node with a strong type is None. # Don't try to model "empty bool" or "empty int" return None - if data_type == 'bool': + if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) elif isinstance(attr, basestring): - if attr.lower() in ['true', '1']: + if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ['false', '0']: + elif attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) - if data_type == 'str': + if data_type == "str": return self.deserialize_unicode(attr) return eval(data_type)(attr) # nosec @@ -1782,7 +1744,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) @@ -1833,7 +1795,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): @@ -1845,9 +1807,9 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = '=' * (3 - (len(attr) + 3) % 4) - attr = attr + padding - encoded = attr.replace('-', '+').replace('_', '/') + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @staticmethod @@ -1861,7 +1823,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) @@ -1876,7 +1838,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): @@ -1890,7 +1852,7 @@ def deserialize_duration(attr): attr = attr.text try: duration = isodate.parse_duration(attr) - except(ValueError, OverflowError, AttributeError) as err: + except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise_with_traceback(DeserializationError, msg, err) else: @@ -1906,7 +1868,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) @@ -1921,7 +1883,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) @@ -1936,10 +1898,9 @@ 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)) + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -1960,12 +1921,12 @@ 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) - check_decimal = attr.split('.') + check_decimal = attr.split(".") if len(check_decimal) > 1: decimal_str = "" for digit in check_decimal[1]: @@ -1980,7 +1941,7 @@ def deserialize_iso(attr): test_utc = date_obj.utctimetuple() if test_utc.tm_year > 9999 or test_utc.tm_year < 1: raise OverflowError("Hit max or min date") - except(ValueError, OverflowError, AttributeError) as err: + except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise_with_traceback(DeserializationError, msg, err) else: @@ -1996,7 +1957,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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_configuration.py index 831c1dee7d5d..7296d25f5a3e 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_configuration.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_configuration.py @@ -36,7 +36,7 @@ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - **kwargs # type: Any + **kwargs: Any ) -> None: if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_microsoft_resource_health.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_microsoft_resource_health.py index a396695bd008..2510bc1e268f 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_microsoft_resource_health.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/aio/_microsoft_resource_health.py @@ -70,7 +70,7 @@ def __init__( api_version: Optional[str] = None, base_url: str = "https://management.azure.com", profile: KnownProfiles = KnownProfiles.default, - **kwargs # type: Any + **kwargs: Any ) -> None: self._config = MicrosoftResourceHealthConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/__init__.py index 3b9fe1779056..b54ca5518ef6 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/__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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_configuration.py index c7969fcbc023..7b34753df363 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_configuration.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_configuration.py @@ -43,7 +43,7 @@ class MicrosoftResourceHealthConfiguration(Configuration): # pylint: disable=to def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(MicrosoftResourceHealthConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2015-01-01") # type: Literal["2015-01-01"] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", "2015-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -57,10 +57,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-resourcehealth/{}".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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_metadata.json b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_metadata.json index 9d9933b2fd31..dcffa09c893c 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_metadata.json +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_metadata.json @@ -48,7 +48,7 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", "required": false @@ -60,7 +60,7 @@ "required": false }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", "required": false diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_microsoft_resource_health.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_microsoft_resource_health.py index 096b2cca9b33..bcf8860e12d2 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_microsoft_resource_health.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_microsoft_resource_health.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 .._serialization import Deserializer, Serializer from ._configuration import MicrosoftResourceHealthConfiguration from .operations import ( @@ -65,7 +65,7 @@ def __init__( ) self._client = 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 @@ -100,15 +100,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: () -> MicrosoftResourceHealth + def __enter__(self) -> "MicrosoftResourceHealth": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_version.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_version.py index dfa6ee022f15..e5754a47ce68 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_version.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b2" +VERSION = "1.0.0b1" diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/__init__.py index af2371d6b6d4..e02d3fbb7c52 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_configuration.py index a2b32475851d..a8d670d658ae 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_configuration.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_configuration.py @@ -43,7 +43,7 @@ class MicrosoftResourceHealthConfiguration(Configuration): # pylint: disable=to def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(MicrosoftResourceHealthConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2015-01-01") # type: Literal["2015-01-01"] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", "2015-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_microsoft_resource_health.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_microsoft_resource_health.py index eba8efaf381b..e4277131d459 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_microsoft_resource_health.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/_microsoft_resource_health.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 MicrosoftResourceHealthConfiguration from .operations import ( @@ -65,7 +65,7 @@ def __init__( ) self._client = 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 diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/__init__.py index 470cb0f8e6d3..af3625f21163 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/__init__.py @@ -12,7 +12,7 @@ from ._operations import Operations 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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_availability_statuses_operations.py index 0d6f8cf8ddf0..8737693a6f32 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_availability_statuses_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_availability_statuses_operations.py @@ -86,8 +86,8 @@ def list_by_subscription_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -110,7 +110,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 @@ -126,7 +126,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 @@ -134,13 +134,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -154,7 +154,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses"} # type: ignore + list_by_subscription_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses" + } @distributed_trace def list_by_resource_group( @@ -181,8 +183,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", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -206,7 +208,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 @@ -222,7 +224,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 @@ -230,13 +232,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -250,7 +252,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.ResourceHealth/availabilityStatuses"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses" + } @distributed_trace_async async def get_by_resource( @@ -288,8 +292,8 @@ async def get_by_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatus] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) request = build_get_by_resource_request( resource_uri=resource_uri, @@ -301,9 +305,9 @@ async def get_by_resource( 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -321,7 +325,7 @@ async def get_by_resource( return deserialized - get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"} # type: ignore + get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"} @distributed_trace def list( @@ -353,8 +357,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -377,7 +381,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 @@ -393,7 +397,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 @@ -401,13 +405,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -421,4 +425,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses"} # type: ignore + list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_availability_statuses_operations.py index 522b6fcbdedf..0e0bb70f5698 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_availability_statuses_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_availability_statuses_operations.py @@ -92,8 +92,8 @@ async def get_by_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatus] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) request = build_get_by_resource_request( resource_uri=resource_uri, @@ -105,9 +105,9 @@ async def get_by_resource( 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -125,7 +125,9 @@ async def get_by_resource( return deserialized - get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current"} # type: ignore + get_by_resource.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current" + } @distributed_trace def list( @@ -155,8 +157,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -179,7 +181,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 @@ -195,7 +197,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 @@ -203,13 +205,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -223,4 +225,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses"} # type: ignore + list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_resources_operations.py index 8129ea7b3513..f342647ed9ea 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_resources_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_child_resources_operations.py @@ -85,8 +85,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -109,7 +109,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 @@ -125,7 +125,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 @@ -133,13 +133,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -153,4 +153,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childResources"} # type: ignore + list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childResources"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_operations.py index 3f13ab14cdd7..50be7539a9ae 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/aio/operations/_operations.py @@ -75,8 +75,8 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) request = build_list_request( api_version=api_version, @@ -85,9 +85,9 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -105,4 +105,4 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: return deserialized - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ResourceHealth/operations"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/__init__.py index c188087fe984..f254b8446c6c 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/models/__init__.py @@ -22,7 +22,7 @@ from ._microsoft_resource_health_enums import AvailabilityStateValues from ._microsoft_resource_health_enums import ReasonChronicityTypes 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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/__init__.py index 470cb0f8e6d3..af3625f21163 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/__init__.py @@ -12,7 +12,7 @@ from ._operations import Operations 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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_availability_statuses_operations.py index 5003d6939a41..1ce93cd468f1 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_availability_statuses_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_availability_statuses_operations.py @@ -47,7 +47,7 @@ def build_list_by_subscription_id_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", "2015-01-01")) # type: Literal["2015-01-01"] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_by_subscription_id_request( "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") @@ -84,7 +84,7 @@ def build_list_by_resource_group_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", "2015-01-01")) # type: Literal["2015-01-01"] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +97,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "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") @@ -118,7 +118,7 @@ def build_get_by_resource_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", "2015-01-01")) # type: Literal["2015-01-01"] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +127,7 @@ def build_get_by_resource_request( "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _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") @@ -148,7 +148,7 @@ def build_list_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", "2015-01-01")) # type: Literal["2015-01-01"] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,7 +157,7 @@ def build_list_request( "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _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") @@ -214,8 +214,8 @@ def list_by_subscription_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -238,7 +238,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 @@ -254,7 +254,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 @@ -262,13 +262,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -282,7 +282,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses"} # type: ignore + list_by_subscription_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses" + } @distributed_trace def list_by_resource_group( @@ -309,8 +311,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", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -334,7 +336,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 @@ -350,7 +352,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 @@ -358,13 +360,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -378,7 +380,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.ResourceHealth/availabilityStatuses"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses" + } @distributed_trace def get_by_resource( @@ -416,8 +420,8 @@ def get_by_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatus] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) request = build_get_by_resource_request( resource_uri=resource_uri, @@ -429,9 +433,9 @@ def get_by_resource( 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -449,7 +453,7 @@ def get_by_resource( return deserialized - get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"} # type: ignore + get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"} @distributed_trace def list( @@ -481,8 +485,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -505,7 +509,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 @@ -521,7 +525,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 @@ -529,13 +533,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -549,4 +553,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses"} # type: ignore + list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_availability_statuses_operations.py index 5abbf174bfe3..90588fa60598 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_availability_statuses_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_availability_statuses_operations.py @@ -47,7 +47,7 @@ def build_get_by_resource_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", "2015-01-01")) # type: Literal["2015-01-01"] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_get_by_resource_request( "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _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") @@ -79,7 +79,7 @@ def build_list_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", "2015-01-01")) # type: Literal["2015-01-01"] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +88,7 @@ def build_list_request( "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _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") @@ -156,8 +156,8 @@ def get_by_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatus] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) request = build_get_by_resource_request( resource_uri=resource_uri, @@ -169,9 +169,9 @@ def get_by_resource( 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -189,7 +189,9 @@ def get_by_resource( return deserialized - get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current"} # type: ignore + get_by_resource.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current" + } @distributed_trace def list( @@ -219,8 +221,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -243,7 +245,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 @@ -259,7 +261,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 @@ -267,13 +269,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -287,4 +289,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses"} # type: ignore + list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_resources_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_resources_operations.py index 5e30a63693a4..fbd77461c4a6 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_resources_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_child_resources_operations.py @@ -47,7 +47,7 @@ def build_list_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", "2015-01-01")) # type: Literal["2015-01-01"] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_request( "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _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") @@ -118,8 +118,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -142,7 +142,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 @@ -158,7 +158,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 @@ -166,13 +166,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -186,4 +186,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childResources"} # type: ignore + list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/childResources"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_operations.py index 36fca29383f6..f0f98c1335c4 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2015_01_01/operations/_operations.py @@ -43,7 +43,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", "2015-01-01")) # type: Literal["2015-01-01"] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,8 +97,8 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) # type: Literal["2015-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2015-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-01-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) request = build_list_request( api_version=api_version, @@ -107,9 +107,9 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -127,4 +127,4 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: return deserialized - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ResourceHealth/operations"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/__init__.py index 3b9fe1779056..b54ca5518ef6 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/__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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_configuration.py index f0fdb825a3d1..d0da50c9730c 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_configuration.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_configuration.py @@ -43,7 +43,7 @@ class MicrosoftResourceHealthConfiguration(Configuration): # pylint: disable=to def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(MicrosoftResourceHealthConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2018-07-01") # type: Literal["2018-07-01"] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", "2018-07-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -57,10 +57,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-resourcehealth/{}".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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_metadata.json b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_metadata.json index 00168fdb1a40..d30853a06420 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_metadata.json +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_metadata.json @@ -48,7 +48,7 @@ "service_client_specific": { "sync": { "api_version": { - "signature": "api_version=None, # type: Optional[str]", + "signature": "api_version: Optional[str]=None,", "description": "API version to use if no profile is provided, or if missing in profile.", "docstring_type": "str", "required": false @@ -60,7 +60,7 @@ "required": false }, "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "signature": "profile: KnownProfiles=KnownProfiles.default,", "description": "A profile definition, from KnownProfiles to dict.", "docstring_type": "azure.profiles.KnownProfiles", "required": false diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_microsoft_resource_health.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_microsoft_resource_health.py index 4bda6e363946..d92a8cb6d73e 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_microsoft_resource_health.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_microsoft_resource_health.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 .._serialization import Deserializer, Serializer from ._configuration import MicrosoftResourceHealthConfiguration from .operations import ( @@ -67,7 +67,7 @@ def __init__( ) self._client = 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: () -> MicrosoftResourceHealth + def __enter__(self) -> "MicrosoftResourceHealth": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_version.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_version.py index c47f66669f1b..e5754a47ce68 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_version.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/__init__.py index af2371d6b6d4..e02d3fbb7c52 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_configuration.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_configuration.py index 54157b8cda81..7a5f1b7fc164 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_configuration.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_configuration.py @@ -43,7 +43,7 @@ class MicrosoftResourceHealthConfiguration(Configuration): # pylint: disable=to def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(MicrosoftResourceHealthConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2018-07-01") # type: Literal["2018-07-01"] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", "2018-07-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_microsoft_resource_health.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_microsoft_resource_health.py index 59cf99bf0925..9cfc5899eefa 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_microsoft_resource_health.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/_microsoft_resource_health.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 MicrosoftResourceHealthConfiguration from .operations import ( @@ -67,7 +67,7 @@ def __init__( ) self._client = 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 diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/__init__.py index ce0b9cd8ad26..4d84024fc0a6 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/__init__.py @@ -13,7 +13,7 @@ from ._metadata_operations import MetadataOperations 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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_availability_statuses_operations.py index d73d591c9020..4366f2918f1e 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_availability_statuses_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_availability_statuses_operations.py @@ -87,8 +87,8 @@ def list_by_subscription_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -111,7 +111,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 @@ -127,7 +127,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 @@ -135,13 +135,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -155,7 +155,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses"} # type: ignore + list_by_subscription_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses" + } @distributed_trace def list_by_resource_group( @@ -183,8 +185,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", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -208,7 +210,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 @@ -224,7 +226,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 @@ -232,13 +234,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -252,7 +254,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.ResourceHealth/availabilityStatuses"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses" + } @distributed_trace_async async def get_by_resource( @@ -292,8 +296,8 @@ async def get_by_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatus] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) request = build_get_by_resource_request( resource_uri=resource_uri, @@ -305,9 +309,9 @@ async def get_by_resource( 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -325,7 +329,7 @@ async def get_by_resource( return deserialized - get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"} # type: ignore + get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"} @distributed_trace def list( @@ -358,8 +362,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -382,7 +386,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 @@ -398,7 +402,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 @@ -406,13 +410,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -426,4 +430,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses"} # type: ignore + list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_emerging_issues_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_emerging_issues_operations.py index 26275be46a37..1f19c1c2e295 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_emerging_issues_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_emerging_issues_operations.py @@ -80,8 +80,8 @@ async def get(self, issue_name: Union[str, _models.Enum8], **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", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EmergingIssuesGetResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.EmergingIssuesGetResult] = kwargs.pop("cls", None) request = build_get_request( issue_name=issue_name, @@ -91,9 +91,9 @@ async def get(self, issue_name: Union[str, _models.Enum8], **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 = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -111,7 +111,7 @@ async def get(self, issue_name: Union[str, _models.Enum8], **kwargs: Any) -> _mo return deserialized - get.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues/{issueName}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues/{issueName}"} @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.EmergingIssuesGetResult"]: @@ -127,8 +127,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.EmergingIssuesGetResult" _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EmergingIssueListResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.EmergingIssueListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -148,7 +148,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 @@ -164,7 +164,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 @@ -172,13 +172,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EmergingIssueListResult", 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -192,4 +192,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_events_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_events_operations.py index 3b7ce60e04d0..cf5fd38ee99b 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_events_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_events_operations.py @@ -91,8 +91,8 @@ def list_by_subscription_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Events] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.Events] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -116,7 +116,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 +132,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,13 +140,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("Events", 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -160,7 +160,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events"} # type: ignore + list_by_subscription_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events" + } @distributed_trace def list_by_single_resource( @@ -192,8 +194,8 @@ def list_by_single_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Events] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.Events] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -216,7 +218,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 @@ -232,7 +234,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 @@ -240,13 +242,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("Events", 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -260,4 +262,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_single_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/events"} # type: ignore + list_by_single_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/events"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_metadata_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_metadata_operations.py index e0b6f54472e1..03b44476404e 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_metadata_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_metadata_operations.py @@ -71,8 +71,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.MetadataEntity"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MetadataEntityListResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.MetadataEntityListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -92,7 +92,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 @@ -108,7 +108,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 @@ -116,13 +116,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("MetadataEntityListResult", 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -136,7 +136,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata"} @distributed_trace_async async def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: @@ -160,8 +160,8 @@ async def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MetadataEntity] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.MetadataEntity] = kwargs.pop("cls", None) request = build_get_entity_request( name=name, @@ -171,9 +171,9 @@ async def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -191,4 +191,4 @@ async def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: return deserialized - get_entity.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata/{name}"} # type: ignore + get_entity.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata/{name}"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_operations.py index b22e05acbcaa..e4ff11a438ea 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/aio/operations/_operations.py @@ -75,8 +75,8 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) request = build_list_request( api_version=api_version, @@ -85,9 +85,9 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -105,4 +105,4 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: return deserialized - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ResourceHealth/operations"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/__init__.py index 422674218a37..54f19b7e4f22 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/models/__init__.py @@ -53,7 +53,7 @@ from ._microsoft_resource_health_enums import SeverityValues from ._microsoft_resource_health_enums import StageValues 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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/__init__.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/__init__.py index ce0b9cd8ad26..4d84024fc0a6 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/__init__.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/__init__.py @@ -13,7 +13,7 @@ from ._metadata_operations import MetadataOperations 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/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_availability_statuses_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_availability_statuses_operations.py index 487770ac10e5..0d8204da04f8 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_availability_statuses_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_availability_statuses_operations.py @@ -47,7 +47,7 @@ def build_list_by_subscription_id_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", "2018-07-01")) # type: Literal["2018-07-01"] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_list_by_subscription_id_request( "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") @@ -84,7 +84,7 @@ def build_list_by_resource_group_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", "2018-07-01")) # type: Literal["2018-07-01"] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +97,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "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") @@ -118,7 +118,7 @@ def build_get_by_resource_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", "2018-07-01")) # type: Literal["2018-07-01"] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +127,7 @@ def build_get_by_resource_request( "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _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") @@ -148,7 +148,7 @@ def build_list_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", "2018-07-01")) # type: Literal["2018-07-01"] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,7 +157,7 @@ def build_list_request( "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _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") @@ -215,8 +215,8 @@ def list_by_subscription_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -239,7 +239,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 @@ -255,7 +255,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 @@ -263,13 +263,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -283,7 +283,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses"} # type: ignore + list_by_subscription_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses" + } @distributed_trace def list_by_resource_group( @@ -311,8 +313,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", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -336,7 +338,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 @@ -352,7 +354,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 @@ -360,13 +362,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -380,7 +382,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.ResourceHealth/availabilityStatuses"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses" + } @distributed_trace def get_by_resource( @@ -420,8 +424,8 @@ def get_by_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatus] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.AvailabilityStatus] = kwargs.pop("cls", None) request = build_get_by_resource_request( resource_uri=resource_uri, @@ -433,9 +437,9 @@ def get_by_resource( 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -453,7 +457,7 @@ def get_by_resource( return deserialized - get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"} # type: ignore + get_by_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"} @distributed_trace def list( @@ -486,8 +490,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailabilityStatusListResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.AvailabilityStatusListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -510,7 +514,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 @@ -526,7 +530,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 @@ -534,13 +538,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AvailabilityStatusListResult", 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -554,4 +558,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses"} # type: ignore + list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_emerging_issues_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_emerging_issues_operations.py index 033b9d2acd76..67e0e64497e4 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_emerging_issues_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_emerging_issues_operations.py @@ -45,7 +45,7 @@ def build_get_request(issue_name: Union[str, _models.Enum8], **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", "2018-07-01")) # type: Literal["2018-07-01"] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +54,7 @@ def build_get_request(issue_name: Union[str, _models.Enum8], **kwargs: Any) -> H "issueName": _SERIALIZER.url("issue_name", issue_name, "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") @@ -69,7 +69,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", "2018-07-01")) # type: Literal["2018-07-01"] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -125,8 +125,8 @@ def get(self, issue_name: Union[str, _models.Enum8], **kwargs: Any) -> _models.E _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EmergingIssuesGetResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.EmergingIssuesGetResult] = kwargs.pop("cls", None) request = build_get_request( issue_name=issue_name, @@ -136,9 +136,9 @@ def get(self, issue_name: Union[str, _models.Enum8], **kwargs: Any) -> _models.E 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -156,7 +156,7 @@ def get(self, issue_name: Union[str, _models.Enum8], **kwargs: Any) -> _models.E return deserialized - get.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues/{issueName}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues/{issueName}"} @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.EmergingIssuesGetResult"]: @@ -172,8 +172,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.EmergingIssuesGetResult"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EmergingIssueListResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.EmergingIssueListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -193,7 +193,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 @@ -209,7 +209,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 @@ -217,13 +217,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EmergingIssueListResult", 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -237,4 +237,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ResourceHealth/emergingIssues"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_events_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_events_operations.py index e39fc04c85e9..2fc1b98f4827 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_events_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_events_operations.py @@ -52,7 +52,7 @@ def build_list_by_subscription_id_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", "2018-07-01")) # type: Literal["2018-07-01"] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +61,7 @@ def build_list_by_subscription_id_request( "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") @@ -84,7 +84,7 @@ def build_list_by_single_resource_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", "2018-07-01")) # type: Literal["2018-07-01"] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +93,7 @@ def build_list_by_single_resource_request( "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _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") @@ -157,8 +157,8 @@ def list_by_subscription_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Events] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.Events] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -182,7 +182,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 @@ -198,7 +198,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 @@ -206,13 +206,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("Events", 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -226,7 +226,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription_id.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events"} # type: ignore + list_by_subscription_id.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events" + } @distributed_trace def list_by_single_resource( @@ -257,8 +259,8 @@ def list_by_single_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Events] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.Events] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -281,7 +283,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 @@ -297,7 +299,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 @@ -305,13 +307,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("Events", 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -325,4 +327,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_single_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/events"} # type: ignore + list_by_single_resource.metadata = {"url": "/{resourceUri}/providers/Microsoft.ResourceHealth/events"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_metadata_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_metadata_operations.py index 32e3f9f2d3e6..1636ab55b347 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_metadata_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_metadata_operations.py @@ -45,7 +45,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", "2018-07-01")) # type: Literal["2018-07-01"] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +64,7 @@ def build_get_entity_request(name: str, **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", "2018-07-01")) # type: Literal["2018-07-01"] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73,7 +73,7 @@ def build_get_entity_request(name: str, **kwargs: Any) -> HttpRequest: "name": _SERIALIZER.url("name", name, "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") @@ -116,8 +116,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.MetadataEntity"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MetadataEntityListResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.MetadataEntityListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -137,7 +137,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 @@ -153,7 +153,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 @@ -161,13 +161,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("MetadataEntityListResult", 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -181,7 +181,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata"} @distributed_trace def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: @@ -205,8 +205,8 @@ def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MetadataEntity] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.MetadataEntity] = kwargs.pop("cls", None) request = build_get_entity_request( name=name, @@ -216,9 +216,9 @@ def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -236,4 +236,4 @@ def get_entity(self, name: str, **kwargs: Any) -> _models.MetadataEntity: return deserialized - get_entity.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata/{name}"} # type: ignore + get_entity.metadata = {"url": "/providers/Microsoft.ResourceHealth/metadata/{name}"} diff --git a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_operations.py b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_operations.py index 7cff171c6533..6f8c3f7b5fbd 100644 --- a/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_operations.py +++ b/sdk/resourcehealth/azure-mgmt-resourcehealth/azure/mgmt/resourcehealth/v2018_07_01/operations/_operations.py @@ -43,7 +43,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", "2018-07-01")) # type: Literal["2018-07-01"] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,8 +97,8 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) # type: Literal["2018-07-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: Literal["2018-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2018-07-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) request = build_list_request( api_version=api_version, @@ -107,9 +107,9 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -127,4 +127,4 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: return deserialized - list.metadata = {"url": "/providers/Microsoft.ResourceHealth/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.ResourceHealth/operations"}