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

Function convert_instance

mypy/exportjson.py:370–386  ·  view source on GitHub ↗
(self: Instance)

Source from the content-addressed store, hash-verified

368
369
370def convert_instance(self: Instance) -> Json:
371 ready = self.type is not NOT_READY
372 if not self.args and not self.last_known_value and not self.extra_attrs:
373 if ready:
374 return self.type.fullname
375 elif self.type_ref:
376 return self.type_ref
377
378 data: dict[str, Any] = {
379 ".class": "Instance",
380 "type_ref": self.type.fullname if ready else self.type_ref,
381 "args": [convert_type(arg) for arg in self.args],
382 }
383 if self.last_known_value is not None:
384 data["last_known_value"] = convert_type(self.last_known_value)
385 data["extra_attrs"] = convert_extra_attrs(self.extra_attrs) if self.extra_attrs else None
386 return data
387
388
389def convert_extra_attrs(self: ExtraAttrs) -> Json:

Callers 1

convert_typeFunction · 0.85

Calls 2

convert_typeFunction · 0.85
convert_extra_attrsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…