Skip to content

Commit

Permalink
Switch to sys.version_info checks
Browse files Browse the repository at this point in the history
  • Loading branch information
TeamSpen210 committed May 15, 2024
1 parent b183b47 commit 26031bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/test/test_events.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the events manager and collections."""
from __future__ import annotations
from unittest.mock import create_autospec

import pytest
Expand Down
8 changes: 4 additions & 4 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@
copyreg.add_extension('srctools.keyvalues', 'Keyvalues', 246)

lcm: Callable[[int, int], int]
try:
if sys.version_info >= (3, 9):
from math import lcm
except ImportError:
else:
def lcm(a: int, b: int) -> int:
"""Calculate the lowest common multiple.
Expand All @@ -93,9 +93,9 @@ def lcm(a: int, b: int) -> int:
return (a * b) // math.gcd(a, b)


try:
if sys.version_info >= (3, 10):
from contextlib import aclosing
except ImportError: # TODO Directly use stdlib when we drop 3.9 and below
else: # TODO Directly use stdlib when we drop 3.9 and below
from async_generator import aclosing # type: ignore # noqa


Expand Down

0 comments on commit 26031bf

Please sign in to comment.