MCPcopy Index your code
hub / github.com/python/mypy / deserialize

Method deserialize

mypy/plugins/attrs.py:207–230  ·  view source on GitHub ↗

Return the Attribute that was serialized.

(
        cls, info: TypeInfo, data: JsonDict, api: SemanticAnalyzerPluginInterface
    )

Source from the content-addressed store, hash-verified

205
206 @classmethod
207 def deserialize(
208 cls, info: TypeInfo, data: JsonDict, api: SemanticAnalyzerPluginInterface
209 ) -> Attribute:
210 """Return the Attribute that was serialized."""
211 raw_init_type = data["init_type"]
212 init_type = deserialize_and_fixup_type(raw_init_type, api) if raw_init_type else None
213 raw_converter_init_type = data["converter_init_type"]
214 converter_init_type = (
215 deserialize_and_fixup_type(raw_converter_init_type, api)
216 if raw_converter_init_type
217 else None
218 )
219
220 return Attribute(
221 data["name"],
222 data["alias"],
223 info,
224 data["has_default"],
225 data["init"],
226 data["kw_only"],
227 Converter(converter_init_type) if data["has_converter"] else None,
228 Context(line=data["context_line"], column=data["context_column"]),
229 init_type,
230 )
231
232 def expand_typevar_from_subtype(self, sub_type: TypeInfo) -> None:
233 """Expands type vars in the context of a subtype when an attribute is inherited

Callers 1

_analyze_classFunction · 0.45

Calls 4

ContextClass · 0.90
AttributeClass · 0.85
ConverterClass · 0.85

Tested by

no test coverage detected