2121
2222import mypy .nodes
2323from mypy .bogus_type import Bogus
24- from mypy .nodes import (
25- ARG_POS ,
26- ARG_STAR ,
27- ARG_STAR2 ,
28- INVARIANT ,
29- ArgKind ,
30- FakeInfo ,
31- FuncDef ,
32- SymbolNode ,
33- )
24+ from mypy .nodes import ARG_POS , ARG_STAR , ARG_STAR2 , INVARIANT , ArgKind , FakeInfo , SymbolNode
3425from mypy .options import Options
3526from mypy .state import state
3627from mypy .util import IdMapper
@@ -1841,8 +1832,6 @@ class CallableType(FunctionLike):
18411832 "from_type_type" , # Was this callable generated by analyzing Type[...]
18421833 # instantiation?
18431834 "is_bound" , # Is this a bound method?
1844- "def_extras" , # Information about original definition we want to serialize.
1845- # This is used for more detailed error messages.
18461835 "type_guard" , # T, if -> TypeGuard[T] (ret_type is bool in this case).
18471836 "type_is" , # T, if -> TypeIs[T] (ret_type is bool in this case).
18481837 "from_concatenate" , # whether this callable is from a concatenate object
@@ -1869,7 +1858,6 @@ def __init__(
18691858 special_sig : str | None = None ,
18701859 from_type_type : bool = False ,
18711860 is_bound : bool = False ,
1872- def_extras : dict [str , Any ] | None = None ,
18731861 type_guard : Type | None = None ,
18741862 type_is : Type | None = None ,
18751863 from_concatenate : bool = False ,
@@ -1902,22 +1890,6 @@ def __init__(
19021890 self .from_concatenate = from_concatenate
19031891 self .imprecise_arg_kinds = imprecise_arg_kinds
19041892 self .is_bound = is_bound
1905- if def_extras :
1906- self .def_extras = def_extras
1907- elif isinstance (definition , FuncDef ):
1908- # This information would be lost if we don't have definition
1909- # after serialization, but it is useful in error messages.
1910- # TODO: decide how to add more info here (file, line, column)
1911- # without changing interface hash.
1912- first_arg : str | None = None
1913- if definition .arg_names and definition .info and not definition .is_static :
1914- if getattr (definition , "arguments" , None ):
1915- first_arg = definition .arguments [0 ].variable .name
1916- else :
1917- first_arg = definition .arg_names [0 ]
1918- self .def_extras = {"first_arg" : first_arg }
1919- else :
1920- self .def_extras = {}
19211893 self .type_guard = type_guard
19221894 self .type_is = type_is
19231895 self .unpack_kwargs = unpack_kwargs
@@ -1939,7 +1911,6 @@ def copy_modified(
19391911 special_sig : Bogus [str | None ] = _dummy ,
19401912 from_type_type : Bogus [bool ] = _dummy ,
19411913 is_bound : Bogus [bool ] = _dummy ,
1942- def_extras : Bogus [dict [str , Any ]] = _dummy ,
19431914 type_guard : Bogus [Type | None ] = _dummy ,
19441915 type_is : Bogus [Type | None ] = _dummy ,
19451916 from_concatenate : Bogus [bool ] = _dummy ,
@@ -1964,7 +1935,6 @@ def copy_modified(
19641935 special_sig = special_sig if special_sig is not _dummy else self .special_sig ,
19651936 from_type_type = from_type_type if from_type_type is not _dummy else self .from_type_type ,
19661937 is_bound = is_bound if is_bound is not _dummy else self .is_bound ,
1967- def_extras = def_extras if def_extras is not _dummy else dict (self .def_extras ),
19681938 type_guard = type_guard if type_guard is not _dummy else self .type_guard ,
19691939 type_is = type_is if type_is is not _dummy else self .type_is ,
19701940 from_concatenate = (
@@ -2291,7 +2261,6 @@ def serialize(self) -> JsonDict:
22912261 "is_ellipsis_args" : self .is_ellipsis_args ,
22922262 "implicit" : self .implicit ,
22932263 "is_bound" : self .is_bound ,
2294- "def_extras" : dict (self .def_extras ),
22952264 "type_guard" : self .type_guard .serialize () if self .type_guard is not None else None ,
22962265 "type_is" : (self .type_is .serialize () if self .type_is is not None else None ),
22972266 "from_concatenate" : self .from_concatenate ,
@@ -2314,7 +2283,6 @@ def deserialize(cls, data: JsonDict) -> CallableType:
23142283 is_ellipsis_args = data ["is_ellipsis_args" ],
23152284 implicit = data ["implicit" ],
23162285 is_bound = data ["is_bound" ],
2317- def_extras = data ["def_extras" ],
23182286 type_guard = (
23192287 deserialize_type (data ["type_guard" ]) if data ["type_guard" ] is not None else None
23202288 ),
0 commit comments