Skip to content

Commit

Permalink
Update converter.py
Browse files Browse the repository at this point in the history
  • Loading branch information
katsumiok committed Feb 17, 2024
1 parent 9fef68e commit 41aeece
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions pyaskit/types/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

try:
from typing import TypedDict, _TypedDictMeta, get_origin, get_args, get_type_hints

python_38 = True
except ImportError:
from typing_extensions import (
TypedDict,
Expand All @@ -13,8 +11,6 @@
get_type_hints,
)

python_38 = False

# from typing import Literal
import pyaskit.types as t

Expand All @@ -29,15 +25,7 @@ def is_typed_dict(type_hint) -> bool:
Returns:
- bool: True if the type_hint is a TypedDict, False otherwise.
"""
# Check for Python 3.8 and newer
if python_38 and isinstance(type_hint, _TypedDictMeta):
return True
# Check for compatibility with older versions using typing_extensions
if (
not python_38
and isinstance(type_hint, type)
and issubclass(type_hint, TypedDict)
):
if isinstance(type_hint, _TypedDictMeta):
return True
return False

Expand Down

0 comments on commit 41aeece

Please sign in to comment.