Skip to content

Commit

Permalink
refactor(factory): add compatibility with Python 3.9
Browse files Browse the repository at this point in the history
- Import TypeGuard from typing_extensions for Python versions < 3.10
- Import TypeGuard from typing for Python versions >= 3.10
- This change ensures compatibility with Python 3.9 and newer versions
  • Loading branch information
tanbro committed Jan 13, 2025
1 parent 39c0b7c commit db037d2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/sqlalchemy_dlock/factory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
from typing import Type, TypeGuard, TypeVar, Union
import sys
from typing import Type, TypeVar, Union

if sys.version_info < (3, 10): # pragma: no cover
from typing_extensions import TypeGuard
else: # pragma: no cover
from typing import TypeGuard

from sqlalchemy.engine import Connection
from sqlalchemy.ext.asyncio import AsyncConnection, AsyncSession, async_scoped_session
Expand Down

0 comments on commit db037d2

Please sign in to comment.