Skip to content

Commit

Permalink
Fix issues related to python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
synacktraa committed Oct 3, 2024
1 parent 9eab745 commit 5546618
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pip install tool-parse

- with `langchain` based integration
```sh
pip install "tool-parse[langchain]
pip install "tool-parse[langchain]"
```

## 🌟 Key Features
Expand Down
12 changes: 10 additions & 2 deletions tool_parse/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,11 @@ class TypedDictProtocol(t.Protocol):
__required_keys__: t.ClassVar[t.FrozenSet[str]]
__optional_keys__: t.ClassVar[t.FrozenSet[str]]

__subclasshook__ = classmethod(fake_subclass_hook)
if sys.version_info < (3, 12):
__subclasshook__ = classmethod(fake_subclass_hook)
else:
_is_runtime_protocol = True
__non_callable_proto_members__ = set()


TypedDict = t.TypeVar("TypedDict", bound=TypedDictProtocol)
Expand Down Expand Up @@ -317,7 +321,11 @@ class NamedTupleProtocol(t.Protocol[NTKeys]):
_field_defaults: t.ClassVar[t.Dict[str, t.Any]]
__annotations__: t.Dict[str, type]

__subclasshook__ = classmethod(fake_subclass_hook)
if sys.version_info < (3, 12):
__subclasshook__ = classmethod(fake_subclass_hook)
else:
_is_runtime_protocol = True
__non_callable_proto_members__ = set()


NamedTuple = t.TypeVar("NamedTuple", bound=NamedTupleProtocol)
Expand Down

0 comments on commit 5546618

Please sign in to comment.