Skip to content

Commit c1c6f3e

Browse files
authored
[Communication] - Sms - Fixed pylint issues (#36361)
* [Communication] - Sms - Updated project documentation README.md and CHANGELOG.md * Fixed docstring and method signature on"send" function * Removed unnecessary overwrites in the function "send" * Rolled back spell check changes in README.md * Rolled back spell check changes in README.md
1 parent 19eeddc commit c1c6f3e

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

sdk/communication/azure-communication-sms/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
### Bugs Fixed
1010

1111
### Other Changes
12-
Python 2.7 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).
12+
- Python 2.7 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).
1313

1414
## 1.0.1 (2021-06-08)
1515

sdk/communication/azure-communication-sms/azure/communication/sms/_sms_client.py

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# license information.
55
# --------------------------------------------------------------------------
66

7-
from typing import Union
7+
from typing import List, Union, Any, Optional
88
from uuid import uuid4
99
from azure.core.tracing.decorator import distributed_trace
1010
from azure.communication.sms._generated.models import (
@@ -20,7 +20,8 @@
2020
from ._shared.utils import parse_connection_str, get_current_utc_time
2121
from ._version import SDK_MONIKER
2222

23-
class SmsClient(object): # pylint: disable=client-accepts-api-version-keyword
23+
24+
class SmsClient(object): # pylint: disable=client-accepts-api-version-keyword
2425
"""A client to interact with the AzureCommunicationService Sms gateway.
2526
2627
This client provides operations to send an SMS via a phone number.
@@ -30,17 +31,18 @@ class SmsClient(object): # pylint: disable=client-accepts-api-version-keyword
3031
:param Union[TokenCredential, AzureKeyCredential] credential:
3132
The credential we use to authenticate against the service.
3233
"""
34+
3335
def __init__(
34-
self, endpoint, # type: str
35-
credential, # type: Union[TokenCredential, AzureKeyCredential]
36-
**kwargs # type: Any
37-
):
36+
self, endpoint, # type: str
37+
credential, # type: Union[TokenCredential, AzureKeyCredential]
38+
**kwargs # type: Any
39+
):
3840
# type: (...) -> None
3941
try:
4042
if not endpoint.lower().startswith('http'):
4143
endpoint = "https://" + endpoint
4244
except AttributeError:
43-
raise ValueError("Account URL must be a string.") # pylint: disable=raise-missing-from
45+
raise ValueError("Account URL must be a string.") # pylint: disable=raise-missing-from
4446

4547
if not credential:
4648
raise ValueError(
@@ -56,8 +58,8 @@ def __init__(
5658

5759
@classmethod
5860
def from_connection_string(cls, conn_str, # type: str
59-
**kwargs # type: Any
60-
): # type: (...) -> SmsClient
61+
**kwargs # type: Any
62+
): # type: (...) -> SmsClient
6163
"""Create SmsClient from a Connection String.
6264
6365
:param str conn_str:
@@ -79,17 +81,20 @@ def from_connection_string(cls, conn_str, # type: str
7981
return cls(endpoint, access_key, **kwargs)
8082

8183
@distributed_trace
82-
def send(self, from_, # type: str
83-
to, # type: Union[str, List[str]]
84-
message, # type: str
85-
**kwargs #type: Any
86-
): # type: (...) -> [SmsSendResult]
84+
def send(self, from_, # type: str
85+
to, # type: Union[str, List[str]]
86+
message, # type: str,
87+
*,
88+
enable_delivery_report: bool = False,
89+
tag: Optional[str] = None,
90+
**kwargs: Any
91+
): # type: (...) -> [SmsSendResult]
8792
"""Sends SMSs to phone numbers.
8893
8994
:param str from_: The sender of the SMS.
9095
:param to: The single recipient or the list of recipients of the SMS.
9196
:type to: Union[str, List[str]]
92-
:param str message: The message in the SMS
97+
:param str message: The message in the SMS.
9398
:keyword bool enable_delivery_report: Enable this flag to receive a delivery report for this
9499
message on the Azure Resource EventGrid.
95100
:keyword str tag: Use this field to provide metadata that will then be sent back in the corresponding
@@ -101,9 +106,6 @@ def send(self, from_, # type: str
101106
if isinstance(to, str):
102107
to = [to]
103108

104-
enable_delivery_report = kwargs.pop('enable_delivery_report', False)
105-
tag = kwargs.pop('tag', None)
106-
107109
sms_send_options = SmsSendOptions(
108110
enable_delivery_report=enable_delivery_report,
109111
tag=tag

0 commit comments

Comments
 (0)