Skip to content

Commit f79d1c7

Browse files
authored
[EH/SB/EG] next* (#40483)
* next* * shouldnt return * pylint * this * this * tis
1 parent f9e29db commit f79d1c7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+76
-99
lines changed

Diff for: eng/pylintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[MASTER]
2-
py-version=3.9
2+
py-version=3.8
33
ignore-patterns=test_*,conftest,setup
44
reports=no
55

Diff for: sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_helpers.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -88,17 +88,15 @@ def _get_authentication_policy(credential, bearer_token_policy=BearerTokenCreden
8888
)
8989

9090

91-
def _is_cloud_event(event):
92-
# type: (Any) -> bool
91+
def _is_cloud_event(event: Any) -> bool:
9392
required = ("id", "source", "specversion", "type")
9493
try:
9594
return all((_ in event for _ in required)) and event["specversion"] == "1.0"
9695
except TypeError:
9796
return False
9897

9998

100-
def _is_eventgrid_event_format(event):
101-
# type: (Any) -> bool
99+
def _is_eventgrid_event_format(event: Any) -> bool:
102100
required = ("subject", "eventType", "data", "dataVersion", "id", "eventTime")
103101
try:
104102
return all((prop in event for prop in required))

Diff for: sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_policies.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ class CloudEventDistributedTracingPolicy(SansIOHTTPPolicy):
2727

2828
_CONTENT_TYPE = "application/cloudevents-batch+json; charset=utf-8"
2929

30-
def on_request(self, request):
31-
# type: (PipelineRequest) -> None
30+
def on_request(self, request: "PipelineRequest") -> None:
3231
try:
3332
traceparent = request.http_request.headers["traceparent"]
3433
tracestate = request.http_request.headers["tracestate"]

Diff for: sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_publisher_client.py

+9-10
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,10 @@ def __init__(
116116
self._api_version = api_version if api_version is not None else DEFAULT_API_VERSION
117117

118118
@staticmethod
119-
def _policies(credential, **kwargs):
120-
# type: (Union[AzureKeyCredential, AzureSasCredential, TokenCredential], Any) -> List[Any]
119+
def _policies(
120+
credential: Union["AzureKeyCredential", "AzureSasCredential", "TokenCredential"],
121+
**kwargs: Any
122+
) -> List[Any]:
121123
auth_policy = _get_authentication_policy(credential)
122124
sdk_moniker = "eventgrid/{}".format(VERSION)
123125
policies = [
@@ -234,16 +236,13 @@ def send(self, events: SendType, *, channel_name: Optional[str] = None, **kwargs
234236
map_error(status_code=response.status_code, response=response, error_map=error_map)
235237
raise HttpResponseError(response=response)
236238

237-
def close(self):
238-
# type: () -> None
239-
"""Close the :class:`~azure.eventgrid.EventGridPublisherClient` session."""
240-
return self._client.close()
239+
def close(self) -> None:
240+
"""Closes the EventGridPublisherClient session."""
241+
self._client.close()
241242

242-
def __enter__(self):
243-
# type: () -> EventGridPublisherClient
243+
def __enter__(self) -> "EventGridPublisherClient":
244244
self._client.__enter__()
245245
return self
246246

247-
def __exit__(self, *args):
248-
# type: (*Any) -> None
247+
def __exit__(self, *args) -> None:
249248
self._client.__exit__(*args)

Diff for: sdk/eventgrid/azure-eventgrid/azure/eventgrid/_legacy/_signature_credential_policy.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ class EventGridSasCredentialPolicy(SansIOHTTPPolicy):
2020
:raises: ValueError or TypeError
2121
"""
2222

23-
def __init__(self, credential, name, **kwargs): # pylint: disable=unused-argument
24-
# type: (AzureSasCredential, str, Any) -> None
23+
def __init__(self, credential: "AzureSasCredential", name: str, **kwargs: Any) -> None: # pylint: disable=unused-argument
2524
super(EventGridSasCredentialPolicy, self).__init__()
2625
self._credential = credential
2726
if not name:

Diff for: sdk/eventgrid/azure-eventgrid/azure/eventgrid/_model_base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ def _deserialize(cls, data, exist_discriminators):
633633
discriminator_value = data.find(xml_name).text # pyright: ignore
634634
else:
635635
discriminator_value = data.get(discriminator._rest_name)
636-
mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore
636+
mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member
637637
return mapped_cls._deserialize(data, exist_discriminators)
638638

639639
def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.Any]:

Diff for: sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/aio/_client_async.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# license information.
55
# --------------------------------------------------------------------------
66
# TODO: Check types of kwargs (issue exists for this)
7-
import asyncio
7+
import asyncio # pylint:disable=do-not-import-asyncio
88
import logging
99
import time
1010
import queue

Diff for: sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/aio/_connection_async.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from urllib.parse import urlparse
1111
import socket
1212
from ssl import SSLError
13-
import asyncio
13+
import asyncio # pylint:disable=do-not-import-asyncio
1414
from typing import Any, Dict, List, Tuple, Optional, NamedTuple, Type, Union, cast
1515

1616
from ._transport_async import AsyncTransport

Diff for: sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/aio/_sender_async.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import uuid
88
import logging
99
import time
10-
import asyncio
10+
import asyncio # pylint:disable=do-not-import-asyncio
1111

1212
from .._encode import encode_payload
1313
from ._link_async import Link

Diff for: sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/aio/_session_async.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import uuid
99
import logging
1010
import time
11-
import asyncio
11+
import asyncio # pylint:disable=do-not-import-asyncio
1212
from typing import Optional, Union
1313

1414
from ..constants import ConnectionState, SessionState, SessionTransferState, Role
@@ -105,8 +105,7 @@ async def _on_connection_state_change(self):
105105
if self.state not in [SessionState.DISCARDING, SessionState.UNMAPPED]:
106106
await self._set_state(SessionState.DISCARDING)
107107

108-
def _get_next_output_handle(self):
109-
# type: () -> int
108+
def _get_next_output_handle(self) -> int:
110109
"""Get the next available outgoing handle number within the max handle limit.
111110
112111
:raises ValueError: If maximum handle has been reached.

Diff for: sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/aio/_transport_async.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
# THE POSSIBILITY OF SUCH DAMAGE.
3333
# -------------------------------------------------------------------------
3434

35-
import asyncio
35+
import asyncio # pylint:disable=do-not-import-asyncio
3636
import errno
3737
import socket
3838
import ssl

Diff for: sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/session.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ def from_incoming_frame(cls, connection, channel):
8181
new_session = cls(connection, channel)
8282
return new_session
8383

84-
def _set_state(self, new_state):
85-
# type: (SessionState) -> None
84+
def _set_state(self, new_state: SessionState) -> None:
8685
"""Update the session state.
8786
:param ~pyamqp.constants.SessionState new_state: The new state to set.
8887
"""
@@ -104,8 +103,7 @@ def _on_connection_state_change(self):
104103
if self.state not in [SessionState.DISCARDING, SessionState.UNMAPPED]:
105104
self._set_state(SessionState.DISCARDING)
106105

107-
def _get_next_output_handle(self):
108-
# type: () -> int
106+
def _get_next_output_handle(self) -> int:
109107
"""Get the next available outgoing handle number within the max handle limit.
110108
111109
:raises ValueError: If maximum handle has been reached.
@@ -374,8 +372,7 @@ def _incoming_detach(self, frame):
374372
)
375373
)
376374

377-
def _wait_for_response(self, wait, end_state):
378-
# type: (Union[bool, float], SessionState) -> None
375+
def _wait_for_response(self, wait: Union[bool, float], end_state: SessionState) -> None:
379376
if wait is True:
380377
self._connection.listen(wait=False)
381378
while self.state != end_state:
@@ -398,8 +395,7 @@ def begin(self, wait=False):
398395
elif not self.allow_pipelined_open:
399396
raise ValueError("Connection has been configured to not allow piplined-open. Please set 'wait' parameter.")
400397

401-
def end(self, error=None, wait=False):
402-
# type: (Optional[AMQPError], bool) -> None
398+
def end(self, error: Optional[AMQPError] = None, wait: bool = False) -> None:
403399
try:
404400
if self.state not in [SessionState.UNMAPPED, SessionState.DISCARDING]:
405401
self._outgoing_end(error=error)

Diff for: sdk/eventhub/azure-eventhub/azure/eventhub/aio/_async_utils.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
# Licensed under the MIT License. See License.txt in the project root for
44
# license information.
55
# --------------------------------------------------------------------------
6-
import asyncio
6+
import asyncio # pylint:disable=do-not-import-asyncio
77
import sys
8-
from asyncio import Semaphore
9-
108

119
def get_dict_with_loop_if_needed(loop):
1210
if sys.version_info >= (3, 10):
@@ -17,7 +15,7 @@ def get_dict_with_loop_if_needed(loop):
1715
return {}
1816

1917

20-
async def semaphore_acquire_with_timeout(semaphore: Semaphore, timeout=None):
18+
async def semaphore_acquire_with_timeout(semaphore: asyncio.Semaphore, timeout=None):
2119
try:
2220
return await asyncio.wait_for(semaphore.acquire(), timeout=timeout)
2321
except asyncio.TimeoutError:

Diff for: sdk/eventhub/azure-eventhub/azure/eventhub/aio/_buffered_producer/_buffered_producer_async.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
# Licensed under the MIT License. See License.txt in the project root for license information.
44
# --------------------------------------------------------------------------------------------
55
from __future__ import annotations
6-
import asyncio
6+
import asyncio # pylint:disable=do-not-import-asyncio
77
import logging
88
import queue
99
import time
10-
from asyncio import Lock
1110
from typing import Optional, Callable, Awaitable, TYPE_CHECKING
1211

1312
from .._producer_async import EventHubProducer
@@ -39,7 +38,7 @@ def __init__(
3938
self._max_buffer_len = max_buffer_length
4039
self._cur_buffered_len = 0
4140
self._producer: EventHubProducer = producer
42-
self._lock = Lock()
41+
self._lock = asyncio.Lock()
4342
self._max_wait_time = max_wait_time
4443
self._on_success = self.failsafe_callback(on_success)
4544
self._on_error = self.failsafe_callback(on_error)

Diff for: sdk/eventhub/azure-eventhub/azure/eventhub/aio/_buffered_producer/_buffered_producer_dispatcher_async.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
# Licensed under the MIT License. See License.txt in the project root for license information.
44
# --------------------------------------------------------------------------------------------
55
from __future__ import annotations
6-
import asyncio
6+
import asyncio # pylint:disable=do-not-import-asyncio
77
import logging
88
from typing import Dict, List, Callable, Optional, Awaitable, TYPE_CHECKING
9-
from asyncio import Lock
109

1110
from ._partition_resolver_async import PartitionResolver
1211
from ...aio._producer_async import EventHubProducer
@@ -37,7 +36,7 @@ def __init__(
3736
):
3837
self._buffered_producers: Dict[str, BufferedProducer] = {}
3938
self._partition_ids: List[str] = partitions
40-
self._lock = Lock()
39+
self._lock = asyncio.Lock()
4140
self._on_success = on_success
4241
self._on_error = on_error
4342
self._create_producer = create_producer

Diff for: sdk/eventhub/azure-eventhub/azure/eventhub/aio/_buffered_producer/_partition_resolver_async.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
jenkins-hash lookup3 algorithm implementation
77
"""
88

9-
from asyncio import Lock
9+
from asyncio import Lock # pylint:disable=do-not-import-asyncio
1010
from ..._buffered_producer._partition_resolver import (
1111
generate_hash_code,
1212
)

Diff for: sdk/eventhub/azure-eventhub/azure/eventhub/aio/_client_base_async.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from __future__ import annotations
66

77
import logging
8-
import asyncio
8+
import asyncio # pylint: disable=do-not-import-asyncio
99
import time
1010
import functools
1111
from typing import TYPE_CHECKING, Any, Dict, List, Callable, Optional, Union, cast

Diff for: sdk/eventhub/azure-eventhub/azure/eventhub/aio/_connection_manager_async.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from __future__ import annotations
77
from typing import TYPE_CHECKING, Any, Dict, Optional, Union
8-
from asyncio import Lock
8+
from asyncio import Lock # pylint:disable=do-not-import-asyncio
99

1010
from .._connection_manager import _ConnectionMode
1111
from .._constants import TransportType

Diff for: sdk/eventhub/azure-eventhub/azure/eventhub/aio/_consumer_async.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# --------------------------------------------------------------------------------------------
55
from __future__ import annotations
66
import uuid
7-
import asyncio
7+
import asyncio # pylint: disable=do-not-import-asyncio
88
import logging
99
from collections import deque
1010
from typing import TYPE_CHECKING, Callable, Awaitable, Dict, Optional, Union, List, Any, Deque

Diff for: sdk/eventhub/azure-eventhub/azure/eventhub/aio/_consumer_client_async.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# --------------------------------------------------------------------------------------------
55

66
from __future__ import annotations
7-
import asyncio
7+
import asyncio # pylint:disable=do-not-import-asyncio
88
import logging
99
import datetime
1010
import warnings

Diff for: sdk/eventhub/azure-eventhub/azure/eventhub/aio/_eventprocessor/event_processor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
cast,
1818
)
1919
import uuid
20-
import asyncio
20+
import asyncio # pylint:disable=do-not-import-asyncio
2121
import logging
2222
import time
2323
from functools import partial

Diff for: sdk/eventhub/azure-eventhub/azure/eventhub/aio/_eventprocessor/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Licensed under the MIT License. See License.txt in the project root for license information.
44
# -----------------------------------------------------------------------------------
55

6-
import asyncio
6+
import asyncio # pylint:disable=do-not-import-asyncio
77

88

99
def get_running_loop() -> asyncio.AbstractEventLoop:

Diff for: sdk/eventhub/azure-eventhub/azure/eventhub/aio/_producer_async.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# --------------------------------------------------------------------------------------------
55
from __future__ import annotations
66
import uuid
7-
import asyncio
7+
import asyncio # pylint: disable=do-not-import-asyncio
88
import logging
99
from typing import Iterable, Union, Optional, Any, AnyStr, List, TYPE_CHECKING, cast
1010

Diff for: sdk/eventhub/azure-eventhub/azure/eventhub/aio/_producer_client_async.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) Microsoft Corporation. All rights reserved.
33
# Licensed under the MIT License. See License.txt in the project root for license information.
44
# --------------------------------------------------------------------------------------------
5-
import asyncio
5+
import asyncio # pylint:disable=do-not-import-asyncio
66
import logging
77
import time
88
import warnings

Diff for: sdk/eventhub/azure-eventhub/azure/eventhub/aio/_transport/_pyamqp_transport_async.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# --------------------------------------------------------------------------------------------
55

66
from __future__ import annotations
7-
import asyncio
7+
import asyncio # pylint:disable=do-not-import-asyncio
88
import time
99
import logging
1010
from typing import Any, Callable, Dict, List, Optional, Union, cast, TYPE_CHECKING

Diff for: sdk/eventhub/azure-eventhub/azure/eventhub/aio/_transport/_uamqp_transport_async.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# --------------------------------------------------------------------------------------------
55

66
from __future__ import annotations
7-
import asyncio
7+
import asyncio # pylint:disable=do-not-import-asyncio
88
import time
99
import logging
1010
from typing import Callable, Dict, Union, cast, TYPE_CHECKING, List, Optional, Any

Diff for: sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/aio/_client_async.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# license information.
55
# --------------------------------------------------------------------------
66
# TODO: Check types of kwargs (issue exists for this)
7-
import asyncio
7+
import asyncio # pylint:disable=do-not-import-asyncio
88
import logging
99
import time
1010
import queue

Diff for: sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/aio/_connection_async.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from urllib.parse import urlparse
1111
import socket
1212
from ssl import SSLError
13-
import asyncio
13+
import asyncio # pylint:disable=do-not-import-asyncio
1414
from typing import Any, Dict, List, Tuple, Optional, NamedTuple, Type, Union, cast
1515

1616
from ._transport_async import AsyncTransport

Diff for: sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/aio/_sender_async.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import uuid
88
import logging
99
import time
10-
import asyncio
10+
import asyncio # pylint:disable=do-not-import-asyncio
1111

1212
from .._encode import encode_payload
1313
from ._link_async import Link

Diff for: sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/aio/_session_async.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import uuid
99
import logging
1010
import time
11-
import asyncio
11+
import asyncio # pylint:disable=do-not-import-asyncio
1212
from typing import Optional, Union
1313

1414
from ..constants import ConnectionState, SessionState, SessionTransferState, Role
@@ -105,8 +105,7 @@ async def _on_connection_state_change(self):
105105
if self.state not in [SessionState.DISCARDING, SessionState.UNMAPPED]:
106106
await self._set_state(SessionState.DISCARDING)
107107

108-
def _get_next_output_handle(self):
109-
# type: () -> int
108+
def _get_next_output_handle(self) -> int:
110109
"""Get the next available outgoing handle number within the max handle limit.
111110
112111
:raises ValueError: If maximum handle has been reached.

0 commit comments

Comments
 (0)