Skip to content

Commit e3e4f7d

Browse files
authored
[sb/eh] mypy (Azure#38797)
* mypy * add * fix idle_timeout * pylint
1 parent cf55cc0 commit e3e4f7d

File tree

13 files changed

+34
-30
lines changed

13 files changed

+34
-30
lines changed

sdk/eventhub/azure-eventhub/azure/eventhub/_connection_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def __init__( # pylint:disable=unused-argument
6262
http_proxy: Optional[str] = None,
6363
max_frame_size: int,
6464
channel_max: int,
65-
idle_timeout: float,
65+
idle_timeout: Optional[float],
6666
remote_idle_timeout_empty_frame_send_ratio: float,
6767
amqp_transport: AmqpTransport,
6868
**kwargs: Any,

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ def __init__(self, client: "EventHubConsumerClient", source: str, **kwargs: Any)
104104
link_properties: Dict[bytes, int] = {}
105105
self._error = None
106106
self._timeout = 0
107-
self._idle_timeout = (idle_timeout * self._amqp_transport.TIMEOUT_FACTOR) if idle_timeout else None
107+
self._idle_timeout: Optional[float] = \
108+
(idle_timeout * self._amqp_transport.TIMEOUT_FACTOR) if idle_timeout else None
108109
self._partition = self._source.split("/")[-1]
109110
self._name = f"EHConsumer-{uuid.uuid4()}-partition{self._partition}"
110111
if owner_level is not None:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
)
4343

4444

45-
def get_local_timeout(now: float, idle_timeout: float, last_frame_received_time: float) -> bool:
45+
def get_local_timeout(now: float, idle_timeout: Optional[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.

sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/aio/_client_async.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class AMQPClientAsync(AMQPClientSync):
6969
:paramtype channel_max: int
7070
:keyword idle_timeout: Timeout in seconds after which the Connection will close
7171
if there is no further activity.
72-
:paramtype idle_timeout: int
72+
:paramtype idle_timeout: Optional[float]
7373
:keyword auth_timeout: Timeout in seconds for CBS authentication. Otherwise this value will be ignored.
7474
Default value is 60s.
7575
:paramtype auth_timeout: int
@@ -426,7 +426,7 @@ class SendClientAsync(SendClientSync, AMQPClientAsync):
426426
:paramtype channel_max: int
427427
:keyword idle_timeout: Timeout in seconds after which the Connection will close
428428
if there is no further activity.
429-
:paramtype idle_timeout: int
429+
:paramtype idle_timeout: Optional[float]
430430
:keyword auth_timeout: Timeout in seconds for CBS authentication. Otherwise this value will be ignored.
431431
Default value is 60s.
432432
:paramtype auth_timeout: int
@@ -635,7 +635,7 @@ class ReceiveClientAsync(ReceiveClientSync, AMQPClientAsync):
635635
:paramtype channel_max: int
636636
:keyword idle_timeout: Timeout in seconds after which the Connection will close
637637
if there is no further activity.
638-
:paramtype idle_timeout: int
638+
:paramtype idle_timeout: Optional[float]
639639
:keyword auth_timeout: Timeout in seconds for CBS authentication. Otherwise this value will be ignored.
640640
Default value is 60s.
641641
:paramtype auth_timeout: int

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class AMQPClient(object): # pylint: disable=too-many-instance-attributes
8888
:paramtype channel_max: int
8989
:keyword idle_timeout: Timeout in seconds after which the Connection will close
9090
if there is no further activity.
91-
:paramtype idle_timeout: int
91+
:paramtype idle_timeout: Optional[float]
9292
:keyword auth_timeout: Timeout in seconds for CBS authentication. Otherwise this value will be ignored.
9393
Default value is 60s.
9494
:paramtype auth_timeout: int
@@ -510,7 +510,7 @@ class SendClient(AMQPClient):
510510
:paramtype channel_max: int
511511
:keyword idle_timeout: Timeout in seconds after which the Connection will close
512512
if there is no further activity.
513-
:paramtype idle_timeout: int
513+
:paramtype idle_timeout: Optional[float]
514514
:keyword auth_timeout: Timeout in seconds for CBS authentication. Otherwise this value will be ignored.
515515
Default value is 60s.
516516
:paramtype auth_timeout: int
@@ -736,7 +736,7 @@ class ReceiveClient(AMQPClient): # pylint:disable=too-many-instance-attributes
736736
:paramtype channel_max: int
737737
:keyword idle_timeout: Timeout in seconds after which the Connection will close
738738
if there is no further activity.
739-
:paramtype idle_timeout: int
739+
:paramtype idle_timeout: Optional[float]
740740
:keyword auth_timeout: Timeout in seconds for CBS authentication. Otherwise this value will be ignored.
741741
Default value is 60s.
742742
:paramtype auth_timeout: int

sdk/eventhub/azure-eventhub/azure/eventhub/_transport/_base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def create_connection(
156156
container_id: Optional[str] = None,
157157
max_frame_size: int,
158158
channel_max: int,
159-
idle_timeout: float,
159+
idle_timeout: Optional[float],
160160
properties: Optional[Dict[str, Any]],
161161
remote_idle_timeout_empty_frame_send_ratio: float,
162162
error_policy: Any,
@@ -206,7 +206,7 @@ def create_send_client(
206206
config: Configuration,
207207
target: str,
208208
auth: Union["uamqp_JWTTokenAuth", "pyamqp_JWTTokenAuth"],
209-
idle_timeout: int,
209+
idle_timeout: Optional[float],
210210
network_trace: bool,
211211
retry_policy: Any,
212212
keep_alive_interval: int,
@@ -286,7 +286,7 @@ def create_receive_client(
286286
config: Configuration,
287287
source: Union["uamqp_Source", "pyamqp_Source"],
288288
auth: Union["uamqp_JWTTokenAuth", "pyamqp_JWTTokenAuth"],
289-
idle_timeout: int,
289+
idle_timeout: Optional[float],
290290
network_trace: bool,
291291
retry_policy: Any,
292292
client_name: str,

sdk/eventhub/azure-eventhub/azure/eventhub/_transport/_pyamqp_transport.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def create_connection( # pylint:disable=unused-argument
235235
container_id: Optional[str] = None,
236236
max_frame_size: int,
237237
channel_max: int,
238-
idle_timeout: float,
238+
idle_timeout: Optional[float],
239239
properties: Optional[Dict[str, Any]] = None,
240240
remote_idle_timeout_empty_frame_send_ratio: float,
241241
error_policy: Any,
@@ -299,7 +299,7 @@ def create_send_client( # pylint: disable=unused-argument
299299
config,
300300
target: str,
301301
auth: JWTTokenAuth,
302-
idle_timeout: int,
302+
idle_timeout: Optional[float],
303303
network_trace: bool,
304304
retry_policy: Any,
305305
keep_alive_interval: int,
@@ -430,7 +430,7 @@ def create_receive_client(
430430
config,
431431
source: Source,
432432
auth: JWTTokenAuth,
433-
idle_timeout: int,
433+
idle_timeout: Optional[float],
434434
network_trace: bool,
435435
retry_policy: Any,
436436
client_name: str,

sdk/eventhub/azure-eventhub/azure/eventhub/_transport/_uamqp_transport.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ def create_connection( # pylint:disable=unused-argument
295295
container_id: Optional[str] = None,
296296
max_frame_size: int,
297297
channel_max: int,
298-
idle_timeout: float,
298+
idle_timeout: Optional[float],
299299
properties: Optional[Dict[str, Any]],
300300
remote_idle_timeout_empty_frame_send_ratio: float,
301301
error_policy: Any,
@@ -362,7 +362,7 @@ def create_send_client( # pylint: disable=unused-argument
362362
config,
363363
target: str,
364364
auth: authentication.JWTTokenAuth,
365-
idle_timeout: int,
365+
idle_timeout: Optional[float],
366366
network_trace: bool,
367367
retry_policy: Any,
368368
keep_alive_interval: int,
@@ -497,7 +497,7 @@ def create_receive_client( # pylint: disable=unused-argument
497497
config,
498498
source: Source,
499499
auth: authentication.JWTTokenAuth,
500-
idle_timeout: int,
500+
idle_timeout: Optional[float],
501501
network_trace: bool,
502502
retry_policy: Any,
503503
client_name: str,

sdk/eventhub/azure-eventhub/azure/eventhub/aio/_connection_manager_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def __init__(
5757
http_proxy: Optional[str] = None,
5858
max_frame_size: int,
5959
channel_max: int,
60-
idle_timeout: float,
60+
idle_timeout: Optional[float],
6161
remote_idle_timeout_empty_frame_send_ratio: float,
6262
amqp_transport: AmqpTransportAsync,
6363
**kwargs: Any,

sdk/eventhub/azure-eventhub/azure/eventhub/aio/_transport/_base_async.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ async def create_connection_async(
150150
container_id: Optional[str] = None,
151151
max_frame_size: int,
152152
channel_max: int,
153-
idle_timeout: float,
153+
idle_timeout: Optional[float],
154154
properties: Optional[Dict[str, Any]],
155155
remote_idle_timeout_empty_frame_send_ratio: float,
156156
error_policy: Any,
@@ -198,7 +198,7 @@ def create_send_client(
198198
config: Configuration,
199199
target: str,
200200
auth: Union["uamqp_JWTTokenAuth", "pyamqp_JWTTokenAuth"],
201-
idle_timeout: int,
201+
idle_timeout: Optional[float],
202202
network_trace: bool,
203203
retry_policy: Any,
204204
keep_alive_interval: int,
@@ -265,7 +265,7 @@ def create_receive_client(
265265
config: Configuration,
266266
source: Union["uamqp_Source", "pyamqp_Source"],
267267
auth: Union["uamqp_JWTTokenAuth", "pyamqp_JWTTokenAuth"],
268-
idle_timeout: int,
268+
idle_timeout: Optional[float],
269269
network_trace: bool,
270270
retry_policy: Any,
271271
client_name: str,

0 commit comments

Comments
 (0)