Skip to content

Commit f9eb294

Browse files
authored
fix int checks ranges (#4452)
1 parent a325960 commit f9eb294

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

scripts/wrappers/common/cluster/utils.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ def get_valid_connection_parts(connection):
565565
"""
566566
connection_parts = connection.split("/")
567567

568-
if len(connection_parts) not in range(2, 3):
568+
if len(connection_parts) not in [2, 3]:
569569
raise InvalidConnectionError(
570570
"Expected format: <master_IP>:<master_PORT>/<token>[/<fingerprint>]"
571571
)
@@ -582,7 +582,8 @@ def get_valid_connection_parts(connection):
582582
raise InvalidConnectionError("Invalid master IP")
583583

584584
try:
585-
if int(master_ep[1]) not in range(1, 65535):
585+
port = int(master_ep[1])
586+
if port < 1 or port > 65535:
586587
raise InvalidConnectionError("Master PORT not in range 1:65535")
587588
except ValueError:
588589
raise InvalidConnectionError("Master PORT not a number")

0 commit comments

Comments
 (0)