Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def serialize_identifier(identifier):
request_model = {"raw_id": identifier.raw_id}

if identifier.kind and identifier.kind != CommunicationIdentifierKind.UNKNOWN:
request_model[identifier.kind] = dict(identifier.properties)
request_model[str(identifier.kind)] = dict(identifier.properties) # type: ignore[assignment]
return request_model
except AttributeError:
raise TypeError( # pylint: disable=raise-missing-from
Expand All @@ -52,7 +52,7 @@ def deserialize_identifier(identifier_model):
raw_id = identifier_model.raw_id

if identifier_model.communication_user:
return CommunicationUserIdentifier(raw_id, raw_id=raw_id)
return CommunicationUserIdentifier(raw_id or "", raw_id=raw_id)
if identifier_model.phone_number:
return PhoneNumberIdentifier(identifier_model.phone_number.value, raw_id=raw_id)
if identifier_model.microsoft_teams_user:
Expand All @@ -62,4 +62,4 @@ def deserialize_identifier(identifier_model):
is_anonymous=identifier_model.microsoft_teams_user.is_anonymous,
cloud=identifier_model.microsoft_teams_user.cloud,
)
return UnknownIdentifier(raw_id)
return UnknownIdentifier(raw_id or "")
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def _sign_request(self, request):
# Need URL() to get a correct encoded key value, from "%3A" to ":", when transport is in type AioHttpTransport.
# There's a similar scenario in azure-storage-blob and azure-appconfiguration, the check logic is from there.
try:
from yarl import URL
from yarl import URL # type: ignore[import-not-found]
from azure.core.pipeline.transport import ( # pylint:disable=non-abstract-transport-import
AioHttpTransport,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
# license information.
# --------------------------------------------------------------------------

from typing import Dict, List, Tuple, Optional
from ._models import ChatParticipant
from ._generated.models import ChatError


def _to_utc_datetime(value):
return value.strftime("%Y-%m-%dT%H:%M:%SZ")
Expand All @@ -24,7 +28,7 @@ class CommunicationErrorResponseConverter(object):

@classmethod
def convert(cls, participants, chat_errors):
# type: (...) -> list[(ChatThreadParticipant, ChatError)]
# type: (...) -> List[Tuple[Optional[ChatParticipant], ChatError]]
"""
Util function to convert AddChatParticipantsResult.

Expand All @@ -41,12 +45,12 @@ def convert(cls, participants, chat_errors):
"""

def create_dict(participants):
# type: (...) -> Dict(str, ChatThreadParticipant)
# type: (...) -> Dict[str, ChatParticipant]
"""
Create dictionary of id -> ChatParticipant

:param list participants: list of ChatThreadParticipant
:return: Dictionary of id -> ChatThreadParticipant
:param list participants: list of ChatParticipant
:return: Dictionary of id -> ChatParticipant
:rtype: dict
"""
result = {}
Expand Down
2 changes: 1 addition & 1 deletion sdk/communication/azure-communication-chat/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[tool.azure-sdk-build]
mypy = false
mypy = true
pyright = false
type_check_samples = false