Skip to content

Commit 8f4fff6

Browse files
authored
[EH] next-pylint (Azure#38896)
* eh pylint * remove * fix * update
1 parent f98d6ad commit 8f4fff6

36 files changed

+91
-181
lines changed

sdk/eventhub/azure-eventhub/azure/eventhub/_client_base.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ def _backoff(
393393
)
394394
if backoff <= self._config.backoff_max and (
395395
timeout_time is None or time.time() + backoff <= timeout_time
396-
): # pylint:disable=no-else-return
396+
):
397397
time.sleep(backoff)
398398
_LOGGER.info(
399399
"%r has an exception (%r). Retrying...",
@@ -411,7 +411,6 @@ def _backoff(
411411
def _management_request( # pylint:disable=inconsistent-return-statements
412412
self, mgmt_msg: Union[uamqp_Message, Message], op_type: bytes
413413
) -> Any:
414-
# pylint:disable=assignment-from-none
415414
retried_times = 0
416415
last_exception = None
417416
while retried_times <= self._config.max_retries:
@@ -420,7 +419,7 @@ def _management_request( # pylint:disable=inconsistent-return-statements
420419
self._address, mgmt_auth=mgmt_auth, config=self._config
421420
)
422421
try:
423-
conn = self._conn_manager.get_connection( # pylint:disable=assignment-from-none
422+
conn = self._conn_manager.get_connection(
424423
endpoint=self._address.hostname, auth=mgmt_auth
425424
)
426425
mgmt_client.open(connection=conn)

sdk/eventhub/azure-eventhub/azure/eventhub/_common.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959

6060
if TYPE_CHECKING:
6161
try:
62-
from uamqp import ( # pylint: disable=unused-import
62+
from uamqp import (
6363
Message, # not importing as uamqp_Message, b/c type is exposed to user
6464
BatchMessage,
6565
)
@@ -143,7 +143,6 @@ def __init__(
143143
self.correlation_id = None
144144

145145
def __repr__(self) -> str:
146-
# pylint: disable=bare-except
147146
try:
148147
body_str = self.body_as_str()
149148
except Exception as e: # pylint: disable=broad-except
@@ -230,7 +229,6 @@ def _from_message(
230229
message: Union["Message", pyamqp_Message],
231230
raw_amqp_message: Optional[AmqpAnnotatedMessage] = None,
232231
) -> EventData:
233-
# pylint:disable=protected-access
234232
"""Internal use only.
235233
236234
Creates an EventData object from a raw uamqp message and, if provided, AmqpAnnotatedMessage.
@@ -242,13 +240,11 @@ def _from_message(
242240
:rtype: ~azure.eventhub.EventData
243241
"""
244242
event_data = cls(body="")
245-
# pylint: disable=protected-access
246243
event_data._message = message
247244
event_data._raw_amqp_message = raw_amqp_message if raw_amqp_message else AmqpAnnotatedMessage(message=message)
248245
return event_data
249246

250247
def _decode_non_data_body_as_str(self, encoding: str = "UTF-8") -> str:
251-
# pylint: disable=protected-access
252248
body = self.raw_amqp_message.body
253249
if self.body_type == AmqpMessageBodyType.VALUE:
254250
if not body:

sdk/eventhub/azure-eventhub/azure/eventhub/_consumer.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def __init__(self, client: "EventHubConsumerClient", source: str, **kwargs: Any)
111111
if owner_level is not None:
112112
link_properties[EPOCH_SYMBOL] = int(owner_level)
113113
link_property_timeout_ms = (
114-
self._client._config.receive_timeout or self._timeout # pylint:disable=protected-access
114+
self._client._config.receive_timeout or self._timeout
115115
) * self._amqp_transport.TIMEOUT_FACTOR
116116
link_properties[TIMEOUT_SYMBOL] = int(link_property_timeout_ms)
117117
self._link_properties: Union[Dict[uamqp_AMQPType, uamqp_AMQPType], Dict[types.AMQPTypes, types.AMQPTypes]] = (
@@ -158,7 +158,6 @@ def _open_with_retry(self) -> None:
158158
self._do_retryable_operation(self._open, operation_need_param=False)
159159

160160
def _message_received(self, message: Union[uamqp_Message, Message]) -> None:
161-
# pylint:disable=protected-access
162161
self._message_buffer.append(message)
163162

164163
def _next_message_in_buffer(self):
@@ -245,7 +244,7 @@ def receive(self, batch=False, max_batch_size=300, max_wait_time=None):
245244
if batch:
246245
events_for_callback = []
247246
for _ in range(min(max_batch_size, len(self._message_buffer))):
248-
events_for_callback.append(self._next_message_in_buffer()) # pylint: disable=protected-access
247+
events_for_callback.append(self._next_message_in_buffer())
249248
self._on_event_received(events_for_callback)
250249
else:
251250
self._on_event_received(self._next_message_in_buffer() if self._message_buffer else None)

sdk/eventhub/azure-eventhub/azure/eventhub/_eventprocessor/_eventprocessor_mixin.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
)
1919

2020
if TYPE_CHECKING:
21-
# pylint: disable=ungrouped-imports
2221
from .._common import EventData
2322
from .._consumer import EventHubConsumer
2423
from ..aio._consumer_async import EventHubConsumer as EventHubConsumerAsync

sdk/eventhub/azure-eventhub/azure/eventhub/_eventprocessor/event_processor.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,9 @@ def __init__(
7878
prefetch: Optional[int] = None,
7979
track_last_enqueued_event_properties: bool = False,
8080
) -> None:
81-
# pylint: disable=line-too-long
8281
self._consumer_group = consumer_group
8382
self._eventhub_client = eventhub_client
84-
self._namespace = eventhub_client._address.hostname # pylint: disable=protected-access
83+
self._namespace = eventhub_client._address.hostname
8584
self._eventhub_name = eventhub_client.eventhub_name
8685
self._event_handler = on_event
8786
self._batch = batch
@@ -240,7 +239,7 @@ def _on_event_received(
240239

241240
with receive_context_manager(
242241
self._eventhub_client, links=links, start_time=self._last_received_time
243-
): # pylint:disable=protected-access
242+
):
244243
self._last_received_time = time.time_ns()
245244

246245
with process_context_manager(self._eventhub_client, links=links, is_batch=is_batch):

sdk/eventhub/azure-eventhub/azure/eventhub/_eventprocessor/ownership_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __init__(
4141
self.cached_parition_ids: List[str] = []
4242
self.owned_partitions: Iterable[Dict[str, Any]] = []
4343
self.eventhub_client = eventhub_client
44-
self.fully_qualified_namespace = eventhub_client._address.hostname # pylint: disable=protected-access
44+
self.fully_qualified_namespace = eventhub_client._address.hostname
4545
self.eventhub_name = eventhub_client.eventhub_name
4646
self.consumer_group = consumer_group
4747
self.owner_id = owner_id

sdk/eventhub/azure-eventhub/azure/eventhub/_producer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def send(
264264
links = [link] if link else []
265265

266266
self._unsent_events = [wrapper_event_data._message] # pylint: disable=protected-access
267-
with send_context_manager(self._client, links=links): # pylint: disable=protected-access
267+
with send_context_manager(self._client, links=links):
268268
self._send_event_data_with_retry(timeout=timeout)
269269

270270
def close(self) -> None:

sdk/eventhub/azure-eventhub/azure/eventhub/_producer_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ def _buffered_send_event(
319319
timeout: Optional[float] = None,
320320
partition_id: Optional[str] = None,
321321
partition_key: Optional[str] = None,
322-
**kwargs: Any, # pylint: disable=unused-argument
322+
**kwargs: Any,
323323
) -> None:
324324
set_event_partition_key(event, partition_key, self._amqp_transport)
325325
timeout_time = time.time() + timeout if timeout else None
@@ -565,7 +565,7 @@ def send_event(
565565
timeout: Optional[float] = None,
566566
partition_id: Optional[str] = None,
567567
partition_key: Optional[str] = None,
568-
**kwargs: Any, # pylint: disable=unused-argument
568+
**kwargs: Any,
569569
) -> None:
570570
"""
571571
Sends an event data.

sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/_connection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
)
4343

4444

45-
def get_local_timeout(now: float, idle_timeout: Optional[float], last_frame_received_time: float) -> bool:
45+
def get_local_timeout(now: float, idle_timeout: float, last_frame_received_time: float) -> bool:
4646
"""Check whether the local timeout has been reached since a new incoming frame was received.
4747
4848
:param float now: The current time to check against.
@@ -90,7 +90,7 @@ class Connection: # pylint:disable=too-many-instance-attributes
9090
and 1 for transport type AmqpOverWebsocket.
9191
"""
9292

93-
def __init__( # pylint:disable=too-many-locals,too-many-statements
93+
def __init__( # pylint:disable=too-many-locals
9494
self,
9595
endpoint: str,
9696
*,

sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/_decode.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# Licensed under the MIT License. See License.txt in the project root for
44
# license information.
55
# --------------------------------------------------------------------------
6-
# pylint: disable=redefined-builtin, import-error
7-
86
import struct
97
import uuid
108
import logging

0 commit comments

Comments
 (0)