Skip to content

Commit e30b22d

Browse files
Enable pyright and fix all type checking errors
Co-authored-by: kristapratico <[email protected]>
1 parent 60fea4c commit e30b22d

File tree

7 files changed

+15
-17
lines changed

7 files changed

+15
-17
lines changed

sdk/communication/azure-communication-identity/azure/communication/identity/_generated/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from ._client import CommunicationIdentityClient
1010

1111
try:
12-
from ._patch import __all__ as _patch_all
12+
from ._patch import __all__ as _patch_all # type: ignore
1313
from ._patch import * # pylint: disable=unused-wildcard-import
1414
except ImportError:
1515
_patch_all = []

sdk/communication/azure-communication-identity/azure/communication/identity/_generated/_serialization.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
579579
"[]": self.serialize_iter,
580580
"{}": self.serialize_dict,
581581
}
582-
self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {}
582+
self.dependencies: Dict[str, Any] = dict(classes) if classes else {}
583583
self.key_transformer = full_restapi_key_transformer
584584
self.client_side_validation = True
585585

@@ -1419,7 +1419,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
14191419
"duration": (isodate.Duration, datetime.timedelta),
14201420
"iso-8601": (datetime.datetime),
14211421
}
1422-
self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {}
1422+
self.dependencies: Dict[str, Any] = dict(classes) if classes else {}
14231423
self.key_extractors = [rest_key_extractor, xml_key_extractor]
14241424
# Additional properties only works if the "rest_key_extractor" is used to
14251425
# extract the keys. Making it to work whatever the key extractor is too much
@@ -1620,14 +1620,14 @@ def _instantiate_model(self, response, attrs, additional_properties=None):
16201620
if callable(response):
16211621
subtype = getattr(response, "_subtype_map", {})
16221622
try:
1623-
readonly = [k for k, v in response._validation.items() if v.get("readonly")]
1624-
const = [k for k, v in response._validation.items() if v.get("constant")]
1623+
readonly = [k for k, v in response._validation.items() if v.get("readonly")] # type: ignore
1624+
const = [k for k, v in response._validation.items() if v.get("constant")] # type: ignore
16251625
kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const}
16261626
response_obj = response(**kwargs)
16271627
for attr in readonly:
16281628
setattr(response_obj, attr, attrs.get(attr))
16291629
if additional_properties:
1630-
response_obj.additional_properties = additional_properties
1630+
response_obj.additional_properties = additional_properties # type: ignore
16311631
return response_obj
16321632
except TypeError as err:
16331633
msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore

sdk/communication/azure-communication-identity/azure/communication/identity/_generated/aio/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from ._client import CommunicationIdentityClient
1010

1111
try:
12-
from ._patch import __all__ as _patch_all
12+
from ._patch import __all__ as _patch_all # type: ignore
1313
from ._patch import * # pylint: disable=unused-wildcard-import
1414
except ImportError:
1515
_patch_all = []

sdk/communication/azure-communication-identity/azure/communication/identity/_shared/policy.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
# -------------------------------------------------------------------------
66

77
import hashlib
8-
import urllib
98
import base64
109
import hmac
11-
from urllib.parse import ParseResult, urlparse
10+
from urllib.parse import ParseResult, urlparse, unquote
1211
from typing import Union
1312
from azure.core.credentials import AzureKeyCredential
1413
from azure.core.pipeline.policies import SansIOHTTPPolicy
@@ -91,7 +90,7 @@ def _sign_request(self, request):
9190
pass
9291

9392
if self._decode_url:
94-
query_url = urllib.parse.unquote(query_url)
93+
query_url = unquote(query_url)
9594

9695
signed_headers = "x-ms-date;host;x-ms-content-sha256"
9796

sdk/communication/azure-communication-identity/azure/communication/identity/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66

77
VERSION = "1.5.1"
88

9-
SDK_MONIKER = f"communication-identity/{VERSION}" # type: str
9+
SDK_MONIKER: str = f"communication-identity/{VERSION}"

sdk/communication/azure-communication-identity/azure/communication/identity/aio/_communication_identity_client_async.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,11 @@ async def revoke_tokens(self, user: CommunicationUserIdentifier, **kwargs) -> No
180180
@distributed_trace_async
181181
async def get_token_for_teams_user(
182182
self,
183-
aad_token, # type: str
184-
client_id, # type: str
185-
user_object_id, # type: str
183+
aad_token: str,
184+
client_id: str,
185+
user_object_id: str,
186186
**kwargs
187-
):
188-
# type: (...) -> AccessToken
187+
) -> AccessToken:
189188
"""Exchanges an Azure AD access token of a Teams User for a new Communication Identity access token.
190189
191190
:param aad_token: an Azure AD access token of a Teams User
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[tool.azure-sdk-build]
2-
pyright = false
2+
pyright = true

0 commit comments

Comments
 (0)