Skip to content

Commit

Permalink
Import TypedDict from typing_extensions on Python < 3.9.2
Browse files Browse the repository at this point in the history
Fixes #44

Signed-off-by: Pedro Algarvio <[email protected]>
  • Loading branch information
s0undt3ch committed May 18, 2023
1 parent cb013cf commit cd3c95d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelog/44.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Import `TypedDict` from typing_extensions on Python < 3.9.2
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ importlib-metadata>=3.4.0,<5.0.0; python_version < "3.8"
psutil
pydantic>=1.8.2
salt>=3005
typing-extensions; python_version < "3.9"
typing-extensions; python_version < "3.9.2"
7 changes: 4 additions & 3 deletions src/saf/collect/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import logging
import os
import pathlib
import sys
from typing import AsyncIterator
from typing import List
from typing import Type
Expand All @@ -21,10 +22,10 @@
from saf.models import CollectedEvent
from saf.models import PipelineRunContext

try:
from typing import TypedDict # type: ignore[attr-defined]
except ImportError:
if sys.version_info < (3, 9, 2):
from typing_extensions import TypedDict
else:
from typing import TypedDict # type: ignore[attr-defined,no-redef]

log = logging.getLogger(__name__)

Expand Down

0 comments on commit cd3c95d

Please sign in to comment.