Skip to content

Commit 02f55ae

Browse files
AndyHeap-NeoTechrobsdedude
authored andcommitted
Simplify code
Signed-off-by: Rouven Bauer <[email protected]>
1 parent cf7ae93 commit 02f55ae

File tree

2 files changed

+14
-26
lines changed

2 files changed

+14
-26
lines changed

src/neo4j/_async/io/_pool.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,20 +1248,14 @@ async def on_write_failure(self, address, database):
12481248

12491249

12501250
def _check_acquisition_timeout(timeout: object) -> None:
1251-
if isinstance(timeout, int):
1252-
if timeout <= 0:
1253-
raise ValueError(
1254-
f"Connection acquisition timeout must be > 0, got {timeout}"
1255-
)
1256-
elif isinstance(timeout, float):
1257-
if math.isnan(timeout):
1258-
raise ValueError("Connection acquisition timeout must not be NaN")
1259-
if timeout <= 0:
1260-
raise ValueError(
1261-
f"Connection acquisition timeout must be > 0, got {timeout}"
1262-
)
1263-
else:
1251+
if not isinstance(timeout, (int, float)):
12641252
raise TypeError(
12651253
"Connection acquisition timeout must be a number, "
12661254
f"got {type(timeout)}"
12671255
)
1256+
if timeout <= 0:
1257+
raise ValueError(
1258+
f"Connection acquisition timeout must be > 0, got {timeout}"
1259+
)
1260+
if math.isnan(timeout):
1261+
raise ValueError("Connection acquisition timeout must not be NaN")

src/neo4j/_sync/io/_pool.py

Lines changed: 7 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)