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

Method dump

mypy/nodes.py:4146–4174  ·  view source on GitHub ↗

Return a string dump of the contents of the TypeInfo.

(
        self, str_conv: mypy.strconv.StrConv, type_str_conv: mypy.types.TypeStrVisitor
    )

Source from the content-addressed store, hash-verified

4144 )
4145
4146 def dump(
4147 self, str_conv: mypy.strconv.StrConv, type_str_conv: mypy.types.TypeStrVisitor
4148 ) -> str:
4149 """Return a string dump of the contents of the TypeInfo."""
4150
4151 base: str = ""
4152
4153 def type_str(typ: mypy.types.Type) -> str:
4154 return typ.accept(type_str_conv)
4155
4156 head = "TypeInfo" + str_conv.format_id(self)
4157 if self.bases:
4158 base = f"Bases({', '.join(type_str(base) for base in self.bases)})"
4159 mro = "Mro({})".format(
4160 ", ".join(item.fullname + str_conv.format_id(item) for item in self.mro)
4161 )
4162 names = []
4163 for name in sorted(self.names):
4164 description = name + str_conv.format_id(self.names[name].node)
4165 node = self.names[name].node
4166 if isinstance(node, Var) and node.type:
4167 description += f" ({type_str(node.type)})"
4168 names.append(description)
4169 items = [f"Name({self.fullname})", base, mro, ("Names", names)]
4170 if self.declared_metaclass:
4171 items.append(f"DeclaredMetaclass({type_str(self.declared_metaclass)})")
4172 if self.metaclass_type:
4173 items.append(f"MetaclassType({type_str(self.metaclass_type)})")
4174 return mypy.strconv.dump_tagged(items, head, str_conv=str_conv)
4175
4176 def serialize(self) -> JsonDict:
4177 # NOTE: This is where all ClassDefs originate, so there shouldn't be duplicates.

Callers 5

__str__Method · 0.95
on_finishMethod · 0.45
serveMethod · 0.45
mainFunction · 0.45
save_cacheFunction · 0.45

Calls 6

sortedFunction · 0.85
isinstanceFunction · 0.85
format_idMethod · 0.80
appendMethod · 0.80
joinMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected