Skip to content

Commit

Permalink
Fix Pylint warnings for the new checkers (#26269)
Browse files Browse the repository at this point in the history
  • Loading branch information
ostoliarova-msft authored Oct 25, 2022
1 parent 57562f4 commit a8794e2
Show file tree
Hide file tree
Showing 47 changed files with 3,805 additions and 1,997 deletions.
1 change: 1 addition & 0 deletions sdk/communication/azure-communication-email/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 1.0.0b2 (Unreleased)

### Features Added
- Added the ability specify the API version by an optional `api_version` keyword parameter.

### Breaking Changes

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------

from enum import Enum
from azure.core import CaseInsensitiveEnumMeta


class ApiVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta):
V2021_10_01_PREVIEW = "2021-10-01-preview"


DEFAULT_VERSION = ApiVersion.V2021_10_01_PREVIEW
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
from ._generated._azure_communication_email_service import AzureCommunicationEmailService
from ._version import SDK_MONIKER
from ._generated.models import SendEmailResult, SendStatusResult, EmailMessage
from ._api_versions import DEFAULT_VERSION

class EmailClient(object): # pylint: disable=client-accepts-api-version-keyword

class EmailClient(object):
"""A client to interact with the AzureCommunicationService Email gateway.
This client provides operations to send an email and monitor its status.
Expand All @@ -24,6 +26,10 @@ class EmailClient(object): # pylint: disable=client-accepts-api-version-keyword
The endpoint url for Azure Communication Service resource.
:param Union[TokenCredential, AzureKeyCredential] credential:
The credential we use to authenticate against the service.
:keyword api_version: Azure Communication Email API version.
Default value is "2021-10-01-preview".
Note that overriding this default value may result in unsupported behavior.
:paramtype api_version: str
"""
def __init__(
self,
Expand All @@ -40,10 +46,13 @@ def __init__(
if endpoint.endswith("/"):
endpoint = endpoint[:-1]

self._api_version = kwargs.pop("api_version", DEFAULT_VERSION)

authentication_policy = HMACCredentialsPolicy(endpoint, credential)

self._generated_client = AzureCommunicationEmailService(
endpoint,
api_version=self._api_version,
authentication_policy=authentication_policy,
sdk_moniker=SDK_MONIKER,
**kwargs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from .._generated.aio._azure_communication_email_service import AzureCommunicationEmailService
from .._version import SDK_MONIKER
from .._generated.models import SendEmailResult, SendStatusResult, EmailMessage
from .._api_versions import DEFAULT_VERSION

class EmailClient(object): # pylint: disable=client-accepts-api-version-keyword
"""A client to interact with the AzureCommunicationService Email gateway asynchronously.
Expand All @@ -24,6 +25,10 @@ class EmailClient(object): # pylint: disable=client-accepts-api-version-keyword
The endpoint url for Azure Communication Service resource.
:param Union[AsyncTokenCredential, AzureKeyCredential] credential:
The credential we use to authenticate against the service.
:keyword api_version: Azure Communication Email API version.
Default value is "2021-10-01-preview".
Note that overriding this default value may result in unsupported behavior.
:paramtype api_version: str
"""
def __init__(
self,
Expand All @@ -40,10 +45,13 @@ def __init__(
if endpoint.endswith("/"):
endpoint = endpoint[:-1]

self._api_version = kwargs.pop("api_version", DEFAULT_VERSION)

authentication_policy = HMACCredentialsPolicy(endpoint, credential)

self._generated_client = AzureCommunicationEmailService(
endpoint,
api_version=self._api_version,
authentication_policy=authentication_policy,
sdk_moniker=SDK_MONIKER,
**kwargs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Added support to customize the Communication Identity access token's validity period:
- `create_user_and_token` and `get_token` methods in both sync and async clients can now accept keyword argument `token_expires_in: ~datetime.timedelta` that provides the ability to create a Communication Identity access token with custom expiration.
- Added a new API version `ApiVersion.V2022_10_01` that is now the default API version.
- Added the ability specify the API version by an optional `api_version` keyword parameter.

## 1.2.0 (2022-08-24)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from enum import Enum
from azure.core import CaseInsensitiveEnumMeta

# pylint: disable=enum-must-be-uppercase

class ApiVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta):
V2021_03_07 = "2021-03-07"
V2022_06_01 = "2022-06-01"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@
from ._generated.models import CommunicationTokenScope


class CommunicationIdentityClient(object): # pylint: disable=client-accepts-api-version-keyword
class CommunicationIdentityClient(object):
"""Azure Communication Services Identity client.
:param str endpoint:
The endpoint url for Azure Communication Service resource.
:param TokenCredential credential:
The TokenCredential we use to authenticate against the service.
:keyword api_version: Azure Communication Identity API version.
Default value is "2022-06-01". Note that overriding this default value may result in unsupported behavior.
:paramtype api_version: str
.. admonition:: Example:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@
from .._generated.models import CommunicationTokenScope


class CommunicationIdentityClient: # pylint: disable=client-accepts-api-version-keyword
class CommunicationIdentityClient:
"""Azure Communication Services Identity client.
:param str endpoint:
The endpoint url for Azure Communication Service resource.
:param AsyncTokenCredential credential:
The AsyncTokenCredential we use to authenticate against the service.
:keyword api_version: Azure Communication Identity API version.
Default value is "2022-06-01". Note that overriding this default value may result in unsupported behavior.
:paramtype api_version: str
.. admonition:: Example:
Expand Down
3 changes: 3 additions & 0 deletions sdk/communication/azure-communication-jobrouter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## 1.0.0b1 (Unreleased)

### Features Added
- Added the ability specify the API version by an optional `api_version` keyword parameter.

### Added
- Preview release of the package.
- Add RouterClient
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
from azure.core import CaseInsensitiveEnumMeta


# pylint: disable=enum-must-be-uppercase
class ApiVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta):
V2022_07_18_preview = "2022-07-18-preview"
V2022_07_18_PREVIEW = "2022-07-18-preview"


DEFAULT_VERSION = ApiVersion.V2022_07_18_preview
DEFAULT_VERSION = ApiVersion.V2022_07_18_PREVIEW
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
_SERIALIZER = Serializer()


class RouterAdministrationClient(object): # pylint: disable=client-accepts-api-version-keyword,too-many-public-methods,too-many-lines
class RouterAdministrationClient(object): # pylint:disable=too-many-public-methods,too-many-lines
"""A client to interact with the AzureCommunicationService JobRouter service.
This client provides operations to create, update, list and delete the following entities: classification policy,
Expand All @@ -67,6 +67,10 @@ class RouterAdministrationClient(object): # pylint: disable=client-accepts-api-
The endpoint of the Azure Communication resource.
:param ~azure.core.credentials.AzureKeyCredential credential:
The credentials with which to authenticate
:keyword api_version: Azure Communication Job Router API version. Default value is "2022-07-18-preview".
Note that overriding this default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(
Expand Down Expand Up @@ -98,9 +102,9 @@ def __init__(
self._authentication_policy = HMACCredentialsPolicy(endpoint, credential.key)
self._client = AzureCommunicationJobRouterService(
self._endpoint,
api_version = self._api_version,
authentication_policy = self._authentication_policy,
sdk_moniker = SDK_MONIKER,
api_version=self._api_version,
authentication_policy=self._authentication_policy,
sdk_moniker=SDK_MONIKER,
**kwargs)

@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
_SERIALIZER = Serializer()


class RouterClient(object): # pylint: disable=client-accepts-api-version-keyword,too-many-public-methods,too-many-lines
class RouterClient(object): # pylint:disable=too-many-public-methods,too-many-lines
"""A client to interact with the AzureCommunicationService JobRouter service.
This client provides operations to create and update jobs, policies and workers.
Expand All @@ -61,6 +61,10 @@ class RouterClient(object): # pylint: disable=client-accepts-api-version-keywor
The endpoint of the Azure Communication resource.
:param ~azure.core.credentials.AzureKeyCredential credential:
The credentials with which to authenticate
:keyword api_version: Azure Communication Job Router API version.
Default value is "2022-07-18-preview".
Note that overriding this default value may result in unsupported behavior.
"""

def __init__(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
_SERIALIZER = Serializer()


class RouterAdministrationClient(object): # pylint: disable=client-accepts-api-version-keyword,too-many-public-methods,too-many-lines
class RouterAdministrationClient(object): # pylint:disable=too-many-public-methods,too-many-lines
"""A client to interact with the AzureCommunicationService JobRouter service.
This client provides operations to create, update, list and delete the following entities: classification policy,
Expand All @@ -69,6 +69,10 @@ class RouterAdministrationClient(object): # pylint: disable=client-accepts-api-
The endpoint of the Azure Communication resource.
:param ~azure.core.credentials.AzureKeyCredential credential:
The credentials with which to authenticate
:keyword api_version: Azure Communication Job Router API version.
Default value is "2022-07-18-preview".
Note that overriding this default value may result in unsupported behavior.
"""

def __init__(
Expand Down Expand Up @@ -100,7 +104,7 @@ def __init__(
self._authentication_policy = HMACCredentialsPolicy(endpoint, credential.key, decode_url=True)
self._client = AzureCommunicationJobRouterService(
self._endpoint,
api_version = self._api_version,
api_version=self._api_version,
authentication_policy=self._authentication_policy,
sdk_moniker=SDK_MONIKER,
**kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
_SERIALIZER = Serializer()


class RouterClient(object): # pylint: disable=client-accepts-api-version-keyword,too-many-public-methods,too-many-lines
class RouterClient(object): # pylint:disable=too-many-public-methods,too-many-lines
"""A client to interact with the AzureCommunicationService JobRouter service.
This client provides operations to create and update jobs, policies and workers.
Expand All @@ -63,6 +63,10 @@ class RouterClient(object): # pylint: disable=client-accepts-api-version-keywor
The endpoint of the Azure Communication resource.
:param ~azure.core.credentials.AzureKeyCredential credential:
The credentials with which to authenticate
:keyword api_version: Azure Communication Job Router API version.
Default value is "2022-07-18-preview".
Note that overriding this default value may result in unsupported behavior.
"""

def __init__(
Expand Down Expand Up @@ -94,7 +98,7 @@ def __init__(
self._authentication_policy = HMACCredentialsPolicy(endpoint, credential.key, decode_url=True)
self._client = AzureCommunicationJobRouterService(
self._endpoint,
api_version = self._api_version,
api_version=self._api_version,
authentication_policy=self._authentication_policy,
sdk_moniker=SDK_MONIKER,
**kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 1.1.0b2 (Unreleased)

### Features Added
- Added the ability specify the API version by an optional `api_version` keyword parameter.

### Breaking Changes

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------

from enum import Enum
from azure.core import CaseInsensitiveEnumMeta


class ApiVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta):
V2022_03_01_PREVIEW = "2022-03-01-preview"


DEFAULT_VERSION = ApiVersion.V2022_03_01_PREVIEW
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,24 @@
from ._shared.utils import parse_connection_str, get_authentication_policy
from ._version import SDK_MONIKER
from ._generated.models import CommunicationRelayConfiguration
from ._api_versions import DEFAULT_VERSION

if TYPE_CHECKING:
from azure.core.credentials import TokenCredential
from azure.communication.identity import CommunicationUserIdentifier
from azure.communication.networktraversal import RouteType

class CommunicationRelayClient(object): # pylint: disable=client-accepts-api-version-keyword
class CommunicationRelayClient(object):
"""Azure Communication Services Relay client.
:param str endpoint:
The endpoint url for Azure Communication Service resource.
:param TokenCredential credential:
The TokenCredential we use to authenticate against the service.
:keyword api_version: Azure Communication Network Traversal API version.
Default value is "2022-03-01-preview".
Note that overriding this default value may result in unsupported behavior.
:paramtype api_version: str
.. admonition:: Example:
.. literalinclude:: ../samples/network_traversal_samples.py
Expand All @@ -53,8 +57,10 @@ def __init__(
"You need to provide account shared key to authenticate.")

self._endpoint = endpoint
self._api_version = kwargs.pop("api_version", DEFAULT_VERSION)
self._network_traversal_service_client = CommunicationNetworkTraversalClientGen(
self._endpoint,
api_version=self._api_version,
authentication_policy=get_authentication_policy(endpoint, credential),
sdk_moniker=SDK_MONIKER,
**kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import CommunicationNetworkTraversalClient as CommunicationNetworkTraversalClientGen
from .._shared.utils import parse_connection_str, get_authentication_policy
from .._version import SDK_MONIKER
from .._api_versions import DEFAULT_VERSION

if TYPE_CHECKING:
from azure.core.credentials_async import AsyncTokenCredential
Expand All @@ -19,13 +20,17 @@
from azure.communication.networktraversal import RouteType


class CommunicationRelayClient: # pylint: disable=client-accepts-api-version-keyword
class CommunicationRelayClient:
"""Azure Communication Services Network Traversal client.
:param str endpoint:
The endpoint url for Azure Communication Service resource.
:param AsyncTokenCredential credential:
The AsyncTokenCredential we use to authenticate against the service.
:keyword api_version: Azure Communication Network Traversal API version.
Default value is "2022-03-01-preview".
Note that overriding this default value may result in unsupported behavior.
:paramtype api_version: str
.. admonition:: Example:
Expand All @@ -51,8 +56,10 @@ def __init__(
"You need to provide account shared key to authenticate.")

self._endpoint = endpoint
self._api_version = kwargs.pop("api_version", DEFAULT_VERSION)
self._network_traversal_service_client = CommunicationNetworkTraversalClientGen(
self._endpoint,
api_version=self._api_version,
authentication_policy=get_authentication_policy(endpoint, credential, decode_url=True, is_async=True),
sdk_moniker=SDK_MONIKER,
**kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Features Added
- Added new SIP routing client for handling Direct routing numbers.
- Added the ability specify the API version by an optional `api_version` keyword parameter.

### Other Changes
Python 3.6 is no longer supported. Please use Python version 3.7 or later. For more details, please read our page on [Azure SDK for Python version support policy](https://github.com/Azure/azure-sdk-for-python/wiki/Azure-SDKs-Python-version-support-policy).
Expand Down
Loading

0 comments on commit a8794e2

Please sign in to comment.