Skip to content

Commit 70a1689

Browse files
committed
revert change
1 parent 9e861b8 commit 70a1689

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

generate_self_schema.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
from collections.abc import Callable
1212
from datetime import date, datetime, time, timedelta
1313
from pathlib import Path
14-
from typing import TYPE_CHECKING, Any, Dict, ForwardRef, List, Set, Type, TypeVar, Union
14+
from typing import TYPE_CHECKING, Any, Dict, ForwardRef, List, Set, Type, Union
1515

16-
from typing_extensions import TypeVar as TeTypeVar
1716
from typing_extensions import get_args, get_origin, is_typeddict
1817

1918
TypingUnionType = Type[Union[str, int]]
@@ -44,7 +43,7 @@
4443
schema_ref_validator = {'type': 'definition-ref', 'schema_ref': 'root-schema'}
4544

4645

47-
def get_schema(obj) -> core_schema.CoreSchema: # noqa: C901
46+
def get_schema(obj) -> core_schema.CoreSchema:
4847
if isinstance(obj, str):
4948
return {'type': obj}
5049
elif obj in (datetime, timedelta, date, time, bool, int, float, str):
@@ -53,18 +52,13 @@ def get_schema(obj) -> core_schema.CoreSchema: # noqa: C901
5352
return type_dict_schema(obj)
5453
elif obj == Any or obj == type:
5554
return {'type': 'any'}
56-
elif isinstance(obj, (TypeVar, TeTypeVar)):
57-
return {'type': 'any'}
5855
if isinstance(obj, type) and issubclass(obj, core_schema.Protocol):
5956
return {'type': 'callable'}
6057

6158
origin = get_origin(obj)
6259
assert origin is not None, f'origin cannot be None, obj={obj}, you probably need to fix generate_self_schema.py'
6360
if origin is Union:
6461
return union_schema(obj)
65-
elif is_typeddict(origin):
66-
# a generic typeddict
67-
return get_schema(origin)
6862
elif obj is Callable or origin is Callable:
6963
return {'type': 'callable'}
7064
elif origin is core_schema.Literal:

0 commit comments

Comments
 (0)