MCPcopy
hub / github.com/pydantic/pydantic / to_var

Method to_var

pydantic/mypy.py:386–399  ·  view source on GitHub ↗

Based on mypy.plugins.dataclasses.DataclassAttribute.to_var.

(
        self,
        current_info: TypeInfo,
        api: SemanticAnalyzerPluginInterface,
        use_alias: bool,
        force_typevars_invariant: bool = False,
    )

Source from the content-addressed store, hash-verified

384 return self.type
385
386 def to_var(
387 self,
388 current_info: TypeInfo,
389 api: SemanticAnalyzerPluginInterface,
390 use_alias: bool,
391 force_typevars_invariant: bool = False,
392 ) -> Var:
393 """Based on mypy.plugins.dataclasses.DataclassAttribute.to_var."""
394 if use_alias and self.alias is not None:
395 name = self.alias
396 else:
397 name = self.name
398
399 return Var(name, self.expand_type(current_info, api, force_typevars_invariant))
400
401 def serialize(self) -> JsonDict:
402 """Based on mypy.plugins.dataclasses.DataclassAttribute.serialize."""

Callers 2

to_argumentMethod · 0.95
set_frozenMethod · 0.45

Calls 1

expand_typeMethod · 0.95

Tested by

no test coverage detected