Skip to content

Commit

Permalink
remove dependency on fix (Azure#30891)
Browse files Browse the repository at this point in the history
* remove dependency on fix

* update
  • Loading branch information
xiangyan99 authored Jul 12, 2023
1 parent f4ff2cb commit cf31b2f
Show file tree
Hide file tree
Showing 38 changed files with 45 additions and 114 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# pylint: skip-file

from enum import Enum
from six import with_metaclass
from typing import Mapping, Optional, Union, Any

try:
Expand All @@ -15,8 +14,7 @@

from azure.core import CaseInsensitiveEnumMeta


class CommunicationIdentifierKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
class CommunicationIdentifierKind(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Communication Identifier Kind.
For checking yet unknown identifiers it is better to rely on the presence of the `raw_id` property,
Expand All @@ -32,7 +30,7 @@ class CommunicationIdentifierKind(with_metaclass(CaseInsensitiveEnumMeta, str, E
MICROSOFT_BOT = "microsoft_bot"


class CommunicationCloudEnvironment(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
class CommunicationCloudEnvironment(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The cloud environment that the identifier belongs to"""

PUBLIC = "PUBLIC"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from threading import Lock, Condition, Timer, TIMEOUT_MAX, Event
from datetime import timedelta
from typing import Any
import six
from .utils import get_current_utc_as_int
from .utils import create_access_token

Expand All @@ -32,7 +31,7 @@ class CommunicationTokenCredential(object):
_DEFAULT_AUTOREFRESH_INTERVAL_MINUTES = 10

def __init__(self, token: str, **kwargs: Any):
if not isinstance(token, six.string_types):
if not isinstance(token, str):
raise TypeError("Token must be a string.")
self._token = create_access_token(token)
self._token_refresher = kwargs.pop('token_refresher', None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from datetime import timedelta
from typing import Any
import sys
import six
from .utils import get_current_utc_as_int
from .utils import create_access_token
from .utils_async import AsyncTimer
Expand All @@ -34,7 +33,7 @@ class CommunicationTokenCredential(object):
_DEFAULT_AUTOREFRESH_INTERVAL_MINUTES = 10

def __init__(self, token: str, **kwargs: Any):
if not isinstance(token, six.string_types):
if not isinstance(token, str):
raise TypeError("Token must be a string.")
self._token = create_access_token(token)
self._token_refresher = kwargs.pop('token_refresher', None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
install_requires=[
"msrest>=0.7.1",
"azure-core<2.0.0,>=1.24.0",
'six>=1.11.0'
],
extras_require={
":python_version<'3.8'": ["typing-extensions"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,11 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from enum import Enum, EnumMeta
from six import with_metaclass
from enum import Enum
from azure.core import CaseInsensitiveEnumMeta

class _CaseInsensitiveEnumMeta(EnumMeta):
def __getitem__(self, name):
return super().__getitem__(name.upper())

def __getattr__(cls, name):
"""Return the enum member matching `name`
We use __getattr__ instead of descriptors or inserting into the enum
class' __dict__ in order to support `name` and `value` being both
properties for enum members (which live in the class' __dict__) and
enum members themselves.
"""
try:
return cls._member_map_[name.upper()]
except KeyError:
raise AttributeError(name)


class ChatMessageType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
class ChatMessageType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The chat message type.
"""

Expand All @@ -36,7 +20,7 @@ class ChatMessageType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
PARTICIPANT_ADDED = "participantAdded"
PARTICIPANT_REMOVED = "participantRemoved"

class CommunicationCloudEnvironmentModel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
class CommunicationCloudEnvironmentModel(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The cloud that the identifier belongs to.
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# pylint: skip-file

from enum import Enum
from six import with_metaclass
from typing import Mapping, Optional, Union, Any

try:
Expand All @@ -16,7 +15,7 @@
from azure.core import CaseInsensitiveEnumMeta


class CommunicationIdentifierKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
class CommunicationIdentifierKind(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Communication Identifier Kind.
For checking yet unknown identifiers it is better to rely on the presence of the `raw_id` property,
Expand All @@ -32,7 +31,7 @@ class CommunicationIdentifierKind(with_metaclass(CaseInsensitiveEnumMeta, str, E
MICROSOFT_BOT = "microsoft_bot"


class CommunicationCloudEnvironment(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
class CommunicationCloudEnvironment(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The cloud environment that the identifier belongs to"""

PUBLIC = "PUBLIC"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from threading import Lock, Condition, Timer, TIMEOUT_MAX, Event
from datetime import timedelta
from typing import Any
import six
from .utils import get_current_utc_as_int
from .utils import create_access_token

Expand All @@ -32,7 +31,7 @@ class CommunicationTokenCredential(object):
_DEFAULT_AUTOREFRESH_INTERVAL_MINUTES = 10

def __init__(self, token: str, **kwargs: Any):
if not isinstance(token, six.string_types):
if not isinstance(token, str):
raise TypeError("Token must be a string.")
self._token = create_access_token(token)
self._token_refresher = kwargs.pop('token_refresher', None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from datetime import timedelta
from typing import Any
import sys
import six
from .utils import get_current_utc_as_int
from .utils import create_access_token
from .utils_async import AsyncTimer
Expand All @@ -34,7 +33,7 @@ class CommunicationTokenCredential(object):
_DEFAULT_AUTOREFRESH_INTERVAL_MINUTES = 10

def __init__(self, token: str, **kwargs: Any):
if not isinstance(token, six.string_types):
if not isinstance(token, str):
raise TypeError("Token must be a string.")
self._token = create_access_token(token)
self._token_refresher = kwargs.pop('token_refresher', None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from datetime import datetime
from uuid import uuid4

import six
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.pipeline.policies import AsyncBearerTokenCredentialPolicy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union, Tuple
from datetime import datetime

import six
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.pipeline.policies import AsyncBearerTokenCredentialPolicy
Expand Down
1 change: 0 additions & 1 deletion sdk/communication/azure-communication-chat/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
install_requires=[
"msrest>=0.7.1",
"azure-core<2.0.0,>=1.24.0",
'six>=1.11.0'
],
extras_require={
":python_version<'3.8'": ["typing-extensions"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# pylint: skip-file

from enum import Enum
from six import with_metaclass
from typing import Mapping, Optional, Union, Any

try:
Expand All @@ -16,7 +15,7 @@
from azure.core import CaseInsensitiveEnumMeta


class CommunicationIdentifierKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
class CommunicationIdentifierKind(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Communication Identifier Kind.
For checking yet unknown identifiers it is better to rely on the presence of the `raw_id` property,
Expand All @@ -32,7 +31,7 @@ class CommunicationIdentifierKind(with_metaclass(CaseInsensitiveEnumMeta, str, E
MICROSOFT_BOT = "microsoft_bot"


class CommunicationCloudEnvironment(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
class CommunicationCloudEnvironment(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The cloud environment that the identifier belongs to"""

PUBLIC = "PUBLIC"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from threading import Lock, Condition, Timer, TIMEOUT_MAX, Event
from datetime import timedelta
from typing import Any
import six
from .utils import get_current_utc_as_int
from .utils import create_access_token

Expand All @@ -32,7 +31,7 @@ class CommunicationTokenCredential(object):
_DEFAULT_AUTOREFRESH_INTERVAL_MINUTES = 10

def __init__(self, token: str, **kwargs: Any):
if not isinstance(token, six.string_types):
if not isinstance(token, str):
raise TypeError("Token must be a string.")
self._token = create_access_token(token)
self._token_refresher = kwargs.pop('token_refresher', None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from datetime import timedelta
from typing import Any
import sys
import six
from .utils import get_current_utc_as_int
from .utils import create_access_token
from .utils_async import AsyncTimer
Expand All @@ -34,7 +33,7 @@ class CommunicationTokenCredential(object):
_DEFAULT_AUTOREFRESH_INTERVAL_MINUTES = 10

def __init__(self, token: str, **kwargs: Any):
if not isinstance(token, six.string_types):
if not isinstance(token, str):
raise TypeError("Token must be a string.")
self._token = create_access_token(token)
self._token_refresher = kwargs.pop('token_refresher', None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# pylint: skip-file

from enum import Enum
from six import with_metaclass
from typing import Mapping, Optional, Union, Any

try:
Expand All @@ -16,7 +15,7 @@
from azure.core import CaseInsensitiveEnumMeta


class CommunicationIdentifierKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
class CommunicationIdentifierKind(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Communication Identifier Kind.
For checking yet unknown identifiers it is better to rely on the presence of the `raw_id` property,
Expand All @@ -32,7 +31,7 @@ class CommunicationIdentifierKind(with_metaclass(CaseInsensitiveEnumMeta, str, E
MICROSOFT_BOT = "microsoft_bot"


class CommunicationCloudEnvironment(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
class CommunicationCloudEnvironment(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The cloud environment that the identifier belongs to"""

PUBLIC = "PUBLIC"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from threading import Lock, Condition, Timer, TIMEOUT_MAX, Event
from datetime import timedelta
from typing import Any
import six
from .utils import get_current_utc_as_int
from .utils import create_access_token

Expand All @@ -32,7 +31,7 @@ class CommunicationTokenCredential(object):
_DEFAULT_AUTOREFRESH_INTERVAL_MINUTES = 10

def __init__(self, token: str, **kwargs: Any):
if not isinstance(token, six.string_types):
if not isinstance(token, str):
raise TypeError("Token must be a string.")
self._token = create_access_token(token)
self._token_refresher = kwargs.pop("token_refresher", None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from datetime import timedelta
from typing import Any
import sys
import six
from .utils import get_current_utc_as_int
from .utils import create_access_token
from .utils_async import AsyncTimer
Expand All @@ -34,7 +33,7 @@ class CommunicationTokenCredential(object):
_DEFAULT_AUTOREFRESH_INTERVAL_MINUTES = 10

def __init__(self, token: str, **kwargs: Any):
if not isinstance(token, six.string_types):
if not isinstance(token, str):
raise TypeError("Token must be a string.")
self._token = create_access_token(token)
self._token_refresher = kwargs.pop("token_refresher", None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# pylint: skip-file

from enum import Enum
from six import with_metaclass
from typing import Mapping, Optional, Union, Any

try:
Expand All @@ -16,7 +15,7 @@
from azure.core import CaseInsensitiveEnumMeta


class CommunicationIdentifierKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
class CommunicationIdentifierKind(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Communication Identifier Kind.
For checking yet unknown identifiers it is better to rely on the presence of the `raw_id` property,
Expand All @@ -32,7 +31,7 @@ class CommunicationIdentifierKind(with_metaclass(CaseInsensitiveEnumMeta, str, E
MICROSOFT_BOT = "microsoft_bot"


class CommunicationCloudEnvironment(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
class CommunicationCloudEnvironment(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The cloud environment that the identifier belongs to"""

PUBLIC = "PUBLIC"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from threading import Lock, Condition, Timer, TIMEOUT_MAX, Event
from datetime import timedelta
from typing import Any
import six
from .utils import get_current_utc_as_int
from .utils import create_access_token

Expand All @@ -32,7 +31,7 @@ class CommunicationTokenCredential(object):
_DEFAULT_AUTOREFRESH_INTERVAL_MINUTES = 10

def __init__(self, token: str, **kwargs: Any):
if not isinstance(token, six.string_types):
if not isinstance(token, str):
raise TypeError("Token must be a string.")
self._token = create_access_token(token)
self._token_refresher = kwargs.pop('token_refresher', None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from datetime import timedelta
from typing import Any
import sys
import six
from .utils import get_current_utc_as_int
from .utils import create_access_token
from .utils_async import AsyncTimer
Expand All @@ -34,7 +33,7 @@ class CommunicationTokenCredential(object):
_DEFAULT_AUTOREFRESH_INTERVAL_MINUTES = 10

def __init__(self, token: str, **kwargs: Any):
if not isinstance(token, six.string_types):
if not isinstance(token, str):
raise TypeError("Token must be a string.")
self._token = create_access_token(token)
self._token_refresher = kwargs.pop('token_refresher', None)
Expand Down
1 change: 0 additions & 1 deletion sdk/communication/azure-communication-jobrouter/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
install_requires = [
'azure-core<2.0.0,>=1.25.0',
'msrest>=0.6.21',
'six>=1.11.0',
'python-dateutil>=2.8.0'
],
extras_require = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ def process_request(self, request):

def process_response(self, response):
if _is_text_payload_internal(response) and 'body' in response:
import six
try:
if isinstance(response['body'], dict) \
and 'string' in response['body']:
Expand All @@ -146,7 +145,7 @@ def process_response(self, response):
if body == b"":
return response

body_is_string = isinstance(body, six.string_types)
body_is_string = isinstance(body, str)
if body_is_string and body and not body.isspace():
body = json.loads(body)

Expand Down
Loading

0 comments on commit cf31b2f

Please sign in to comment.