Skip to content

Commit 8fd11e5

Browse files
address lint errors
1 parent 721eb85 commit 8fd11e5

File tree

2 files changed

+66
-64
lines changed

2 files changed

+66
-64
lines changed

sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_sip_routing_client.py

+33-33
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# license information.
55
# --------------------------------------------------------------------------
66

7-
from typing import TYPE_CHECKING, List
7+
from typing import TYPE_CHECKING, List, Any
88
from urllib.parse import urlparse
99

1010
from azure.core.tracing.decorator import distributed_trace
@@ -33,13 +33,12 @@ class SipRoutingClient(object):
3333
this default value may result in unsupported behavior.
3434
:paramtype api_version: str
3535
"""
36-
3736
def __init__(
3837
self,
39-
endpoint, # type: str
40-
credential, # type: TokenCredential
41-
**kwargs # type: Any
42-
): # type: (...) -> SipRoutingClient
38+
endpoint: str,
39+
credential: "TokenCredential",
40+
**kwargs: Any
41+
) -> None:
4342

4443
if not credential:
4544
raise ValueError("credential can not be None")
@@ -63,10 +62,9 @@ def __init__(
6362
@classmethod
6463
def from_connection_string(
6564
cls,
66-
conn_str, # type: str
67-
**kwargs # type: Any
68-
):
69-
# type: (...) -> SipRoutingClient
65+
conn_str: str,
66+
**kwargs: Any
67+
) -> "SipRoutingClient":
7068
"""Factory method for creating client from connection string.
7169
7270
:param str conn_str: Connection string containing endpoint and credentials.
@@ -79,9 +77,9 @@ def from_connection_string(
7977
@distributed_trace
8078
def get_trunk(
8179
self,
82-
trunk_fqdn, # type: str
83-
**kwargs # type: Any
84-
): # type: (...) -> SipTrunk
80+
trunk_fqdn: str,
81+
**kwargs: Any
82+
) -> SipTrunk:
8583
"""Retrieve a single SIP trunk.
8684
8785
:param trunk_fqdn: FQDN of the desired SIP trunk.
@@ -101,9 +99,9 @@ def get_trunk(
10199
@distributed_trace
102100
def set_trunk(
103101
self,
104-
trunk, # type: SipTrunk
105-
**kwargs # type: Any
106-
): # type: (...) -> None
102+
trunk: SipTrunk,
103+
**kwargs: Any
104+
) -> None:
107105
"""Modifies SIP trunk with the given FQDN. If it doesn't exist, adds a new trunk.
108106
109107
:param trunk: Trunk object to be set.
@@ -120,9 +118,9 @@ def set_trunk(
120118
@distributed_trace
121119
def delete_trunk(
122120
self,
123-
trunk_fqdn, # type: str
124-
**kwargs # type: Any
125-
): # type: (...) -> None
121+
trunk_fqdn: str,
122+
**kwargs: Any
123+
) -> None:
126124
"""Deletes SIP trunk.
127125
128126
:param trunk_fqdn: FQDN of the trunk to be deleted.
@@ -138,8 +136,9 @@ def delete_trunk(
138136

139137
@distributed_trace
140138
def list_trunks(
141-
self, **kwargs # type: Any
142-
): # type: (...) -> ItemPaged[SipTrunk]
139+
self,
140+
**kwargs: Any
141+
) -> ItemPaged[SipTrunk]:
143142
"""Retrieves the currently configured SIP trunks.
144143
145144
:returns: Current SIP trunks configuration.
@@ -159,8 +158,9 @@ def get_next(nextLink=None):
159158

160159
@distributed_trace
161160
def list_routes(
162-
self, **kwargs # type: Any
163-
): # type: (...) -> ItemPaged[SipTrunkRoute]
161+
self,
162+
**kwargs: Any
163+
) -> ItemPaged[SipTrunkRoute]:
164164
"""Retrieves the currently configured SIP routes.
165165
166166
:returns: Current SIP routes configuration.
@@ -184,9 +184,9 @@ def get_next(nextLink=None):
184184
@distributed_trace
185185
def set_trunks(
186186
self,
187-
trunks, # type: List[SipTrunk]
188-
**kwargs # type: Any
189-
): # type: (...) -> None
187+
trunks: List[SipTrunk],
188+
**kwargs: Any
189+
) -> None:
190190
"""Overwrites the list of SIP trunks.
191191
192192
:param trunks: New list of trunks to be set.
@@ -213,9 +213,9 @@ def set_trunks(
213213
@distributed_trace
214214
def set_routes(
215215
self,
216-
routes, # type: List[SipTrunkRoute]
217-
**kwargs # type: Any
218-
): # type: (...) -> None
216+
routes: List[SipTrunkRoute],
217+
**kwargs: Any
218+
) -> None:
219219
"""Overwrites the list of SIP routes.
220220
221221
:param routes: New list of routes to be set.
@@ -235,15 +235,15 @@ def set_routes(
235235
]
236236
self._rest_service.sip_routing.update(body=SipConfiguration(routes=routes_internal), **kwargs)
237237

238-
def _list_trunks_(self, **kwargs):
238+
def _list_trunks_(self, **kwargs: Any) -> List[SipTrunk]:
239239
config = self._rest_service.sip_routing.get(**kwargs)
240240
return [SipTrunk(fqdn=k, sip_signaling_port=v.sip_signaling_port) for k, v in config.trunks.items()]
241241

242242
def _update_trunks_(
243243
self,
244-
trunks, # type: List[SipTrunk]
245-
**kwargs # type: Any
246-
): # type: (...) -> SipTrunk
244+
trunks: List[SipTrunk],
245+
**kwargs: Any
246+
) -> List[SipTrunk]:
247247
trunks_internal = {x.fqdn: SipTrunkInternal(sip_signaling_port=x.sip_signaling_port) for x in trunks}
248248
modified_config = SipConfiguration(trunks=trunks_internal)
249249

sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/aio/_sip_routing_client_async.py

+33-31
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# license information.
55
# --------------------------------------------------------------------------
66

7-
from typing import TYPE_CHECKING, List
7+
from typing import TYPE_CHECKING, List, Any
88
from urllib.parse import urlparse
99

1010
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -38,10 +38,10 @@ class SipRoutingClient(object):
3838

3939
def __init__(
4040
self,
41-
endpoint, # type: str
42-
credential, # type: AsyncTokenCredential
43-
**kwargs # type: Any
44-
): # type: (...) -> SipRoutingClient
41+
endpoint: str,
42+
credential: "AsyncTokenCredential",
43+
**kwargs: Any
44+
) -> None:
4545

4646
if not credential:
4747
raise ValueError("credential can not be None")
@@ -65,9 +65,9 @@ def __init__(
6565
@classmethod
6666
def from_connection_string(
6767
cls,
68-
conn_str, # type: str
69-
**kwargs # type: Any
70-
): # type: (...) -> SipRoutingClient
68+
conn_str: str,
69+
**kwargs: Any
70+
) -> "SipRoutingClient":
7171
"""Factory method for creating client from connection string.
7272
7373
:param conn_str: Connection string containing endpoint and credentials
@@ -82,9 +82,9 @@ def from_connection_string(
8282
@distributed_trace_async
8383
async def get_trunk(
8484
self,
85-
trunk_fqdn, # type: str
86-
**kwargs # type: Any
87-
): # type: (...) -> SipTrunk
85+
trunk_fqdn: str,
86+
**kwargs: Any
87+
) -> SipTrunk:
8888
"""Retrieve a single SIP trunk.
8989
9090
:param trunk_fqdn: FQDN of the desired SIP trunk.
@@ -104,9 +104,9 @@ async def get_trunk(
104104
@distributed_trace_async
105105
async def set_trunk(
106106
self,
107-
trunk, # type: SipTrunk
108-
**kwargs # type: Any
109-
): # type: (...) -> None
107+
trunk: SipTrunk,
108+
**kwargs: Any
109+
) -> None:
110110
"""Modifies SIP trunk with the given FQDN. If it doesn't exist, adds a new trunk.
111111
112112
:param trunk: Trunk object to be set.
@@ -123,9 +123,9 @@ async def set_trunk(
123123
@distributed_trace_async
124124
async def delete_trunk(
125125
self,
126-
trunk_fqdn, # type: str
127-
**kwargs # type: Any
128-
): # type: (...) -> None
126+
trunk_fqdn: str,
127+
**kwargs: Any
128+
) -> None:
129129
"""Deletes SIP trunk.
130130
131131
:param trunk_fqdn: FQDN of the trunk to be deleted.
@@ -141,8 +141,9 @@ async def delete_trunk(
141141

142142
@distributed_trace
143143
def list_trunks(
144-
self, **kwargs # type: Any
145-
): # type: (...) -> AsyncItemPaged[SipTrunk]
144+
self,
145+
**kwargs: Any
146+
) -> AsyncItemPaged[SipTrunk]:
146147
"""Retrieves list of currently configured SIP trunks.
147148
148149
:returns: Current SIP trunks configuration.
@@ -162,8 +163,9 @@ async def get_next(nextLink=None):
162163

163164
@distributed_trace
164165
def list_routes(
165-
self, **kwargs # type: Any
166-
): # type: (...) -> AsyncItemPaged[SipTrunkRoute]
166+
self,
167+
**kwargs: Any
168+
) -> AsyncItemPaged[SipTrunkRoute]:
167169
"""Retrieves list of currently configured SIP routes.
168170
169171
:returns: Current SIP routes configuration.
@@ -187,9 +189,9 @@ async def get_next(nextLink=None):
187189
@distributed_trace_async
188190
async def set_trunks(
189191
self,
190-
trunks, # type: List[SipTrunk]
191-
**kwargs # type: Any
192-
): # type: (...) -> None
192+
trunks: List[SipTrunk],
193+
**kwargs: Any
194+
) -> None:
193195
"""Overwrites the list of SIP trunks.
194196
195197
:param trunks: New list of trunks to be set.
@@ -216,9 +218,9 @@ async def set_trunks(
216218
@distributed_trace_async
217219
async def set_routes(
218220
self,
219-
routes, # type: List[SipTrunkRoute]
220-
**kwargs # type: Any
221-
): # type: (...) -> None
221+
routes: List[SipTrunkRoute],
222+
**kwargs: Any
223+
) -> None:
222224
"""Overwrites the list of SIP routes.
223225
224226
:param routes: New list of routes to be set.
@@ -238,15 +240,15 @@ async def set_routes(
238240
]
239241
await self._rest_service.sip_routing.update(body=SipConfiguration(routes=routes_internal), **kwargs)
240242

241-
async def _list_trunks_(self, **kwargs):
243+
async def _list_trunks_(self, **kwargs: Any):
242244
config = await self._rest_service.sip_routing.get(**kwargs)
243245
return [SipTrunk(fqdn=k, sip_signaling_port=v.sip_signaling_port) for k, v in config.trunks.items()]
244246

245247
async def _update_trunks_(
246248
self,
247-
trunks, # type: List[SipTrunk]
248-
**kwargs # type: Any
249-
): # type: (...) -> SipTrunk
249+
trunks: List[SipTrunk],
250+
**kwargs: Any
251+
) -> SipTrunk:
250252
trunks_internal = {x.fqdn: SipTrunkInternal(sip_signaling_port=x.sip_signaling_port) for x in trunks}
251253
modified_config = SipConfiguration(trunks=trunks_internal)
252254

0 commit comments

Comments
 (0)