@@ -155,13 +155,12 @@ class DoctypeTransformer(lark.visitors.Transformer):
155155 [('tuple', 0, 5), ('int', 9, 12)]
156156 """
157157
158- def __init__ (self , * , inspector = None , replace_doctypes = None , ** kwargs ):
158+ def __init__ (self , * , types_db = None , replace_doctypes = None , ** kwargs ):
159159 """
160160 Parameters
161161 ----------
162- inspector : ~.StaticInspector
163- A dictionary mapping atomic names used in doctypes to information such
164- as where to import from or how to replace the name itself.
162+ types_db : ~.TypesDatabase
163+ A static database of collected types usable as an annotation.
165164 replace_doctypes : dict[str, str], optional
166165 Replacements for human-friendly aliases.
167166 kwargs : dict[Any, Any], optional
@@ -170,7 +169,7 @@ def __init__(self, *, inspector=None, replace_doctypes=None, **kwargs):
170169 if replace_doctypes is None :
171170 replace_doctypes = {}
172171
173- self .inspector = inspector
172+ self .types_db = types_db
174173 self .replace_doctypes = replace_doctypes
175174
176175 self ._collected_imports = None
@@ -302,16 +301,16 @@ def contains(self, tree):
302301 def literals (self , tree ):
303302 out = ", " .join (tree .children )
304303 out = f"Literal[{ out } ]"
305- if self .inspector is not None :
306- _ , known_import = self .inspector .query ("Literal" )
304+ if self .types_db is not None :
305+ _ , known_import = self .types_db .query ("Literal" )
307306 if known_import :
308307 self ._collected_imports .add (known_import )
309308 return out
310309
311310 def _find_import (self , qualname , meta ):
312311 """Match type names to known imports."""
313- if self .inspector is not None :
314- annotation_name , known_import = self .inspector .query (qualname )
312+ if self .types_db is not None :
313+ annotation_name , known_import = self .types_db .query (qualname )
315314 else :
316315 annotation_name = None
317316 known_import = None
0 commit comments