API refactor
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-10-07 16:25:52 +09:00
parent 76d0d86211
commit 91c7e04474
1171 changed files with 81940 additions and 44117 deletions

View File

@@ -57,6 +57,7 @@ from mypy.types import (
Type,
TypeOfAny,
TypeType,
TypeVarId,
TypeVarType,
UnionType,
get_proper_type,
@@ -65,7 +66,7 @@ from mypy.typevars import fill_typevars
from mypy.util import get_unique_redefinition_name
from mypy.version import __version__ as mypy_version
from pydantic.utils import is_valid_field
from pydantic.v1.utils import is_valid_field
try:
from mypy.types import TypeVarDef # type: ignore[attr-defined]
@@ -498,7 +499,11 @@ class PydanticModelTransformer:
tvd = TypeVarType(
self_tvar_name,
tvar_fullname,
-1,
(
TypeVarId(-1, namespace=ctx.cls.fullname + '.construct')
if MYPY_VERSION_TUPLE >= (1, 11)
else TypeVarId(-1)
),
[],
obj_type,
AnyType(TypeOfAny.from_omitted_generics), # type: ignore[arg-type]
@@ -858,9 +863,9 @@ def add_method(
arg_kinds.append(arg.kind)
function_type = ctx.api.named_type(f'{BUILTINS_NAME}.function')
signature = CallableType(arg_types, arg_kinds, arg_names, return_type, function_type)
if tvar_def:
signature.variables = [tvar_def]
signature = CallableType(
arg_types, arg_kinds, arg_names, return_type, function_type, variables=[tvar_def] if tvar_def else None
)
func = FuncDef(name, args, Block([PassStmt()]))
func.info = info