21
21
22
22
import mypy .nodes
23
23
from 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
34
25
from mypy .options import Options
35
26
from mypy .state import state
36
27
from mypy .util import IdMapper
@@ -1841,8 +1832,6 @@ class CallableType(FunctionLike):
1841
1832
"from_type_type" , # Was this callable generated by analyzing Type[...]
1842
1833
# instantiation?
1843
1834
"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.
1846
1835
"type_guard" , # T, if -> TypeGuard[T] (ret_type is bool in this case).
1847
1836
"type_is" , # T, if -> TypeIs[T] (ret_type is bool in this case).
1848
1837
"from_concatenate" , # whether this callable is from a concatenate object
@@ -1869,7 +1858,6 @@ def __init__(
1869
1858
special_sig : str | None = None ,
1870
1859
from_type_type : bool = False ,
1871
1860
is_bound : bool = False ,
1872
- def_extras : dict [str , Any ] | None = None ,
1873
1861
type_guard : Type | None = None ,
1874
1862
type_is : Type | None = None ,
1875
1863
from_concatenate : bool = False ,
@@ -1902,22 +1890,6 @@ def __init__(
1902
1890
self .from_concatenate = from_concatenate
1903
1891
self .imprecise_arg_kinds = imprecise_arg_kinds
1904
1892
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 = {}
1921
1893
self .type_guard = type_guard
1922
1894
self .type_is = type_is
1923
1895
self .unpack_kwargs = unpack_kwargs
@@ -1939,7 +1911,6 @@ def copy_modified(
1939
1911
special_sig : Bogus [str | None ] = _dummy ,
1940
1912
from_type_type : Bogus [bool ] = _dummy ,
1941
1913
is_bound : Bogus [bool ] = _dummy ,
1942
- def_extras : Bogus [dict [str , Any ]] = _dummy ,
1943
1914
type_guard : Bogus [Type | None ] = _dummy ,
1944
1915
type_is : Bogus [Type | None ] = _dummy ,
1945
1916
from_concatenate : Bogus [bool ] = _dummy ,
@@ -1964,7 +1935,6 @@ def copy_modified(
1964
1935
special_sig = special_sig if special_sig is not _dummy else self .special_sig ,
1965
1936
from_type_type = from_type_type if from_type_type is not _dummy else self .from_type_type ,
1966
1937
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 ),
1968
1938
type_guard = type_guard if type_guard is not _dummy else self .type_guard ,
1969
1939
type_is = type_is if type_is is not _dummy else self .type_is ,
1970
1940
from_concatenate = (
@@ -2291,7 +2261,6 @@ def serialize(self) -> JsonDict:
2291
2261
"is_ellipsis_args" : self .is_ellipsis_args ,
2292
2262
"implicit" : self .implicit ,
2293
2263
"is_bound" : self .is_bound ,
2294
- "def_extras" : dict (self .def_extras ),
2295
2264
"type_guard" : self .type_guard .serialize () if self .type_guard is not None else None ,
2296
2265
"type_is" : (self .type_is .serialize () if self .type_is is not None else None ),
2297
2266
"from_concatenate" : self .from_concatenate ,
@@ -2314,7 +2283,6 @@ def deserialize(cls, data: JsonDict) -> CallableType:
2314
2283
is_ellipsis_args = data ["is_ellipsis_args" ],
2315
2284
implicit = data ["implicit" ],
2316
2285
is_bound = data ["is_bound" ],
2317
- def_extras = data ["def_extras" ],
2318
2286
type_guard = (
2319
2287
deserialize_type (data ["type_guard" ]) if data ["type_guard" ] is not None else None
2320
2288
),
0 commit comments