MCPcopy Create free account
hub / github.com/python/mypy / reveal_locals

Method reveal_locals

mypy/messages.py:1846–1856  ·  view source on GitHub ↗
(self, type_map: dict[str, Type | None], context: Context)

Source from the content-addressed store, hash-verified

1844 self.note(f'Revealed type is "{typ.accept(visitor)}"', context)
1845
1846 def reveal_locals(self, type_map: dict[str, Type | None], context: Context) -> None:
1847 # To ensure that the output is predictable on Python < 3.6,
1848 # use an ordered dictionary sorted by variable name
1849 sorted_locals = dict(sorted(type_map.items(), key=lambda t: t[0]))
1850 if sorted_locals:
1851 self.note("Revealed local types are:", context)
1852 for k, v in sorted_locals.items():
1853 visitor = TypeStrVisitor(options=self.options)
1854 self.note(f" {k}: {v.accept(visitor) if v is not None else None}", context)
1855 else:
1856 self.note("There are no locals to reveal", context)
1857
1858 def unsupported_type_type(self, item: Type, context: Context) -> None:
1859 self.fail(

Callers 1

visit_reveal_exprMethod · 0.80

Calls 6

noteMethod · 0.95
TypeStrVisitorClass · 0.90
dictClass · 0.85
sortedFunction · 0.85
itemsMethod · 0.45
acceptMethod · 0.45

Tested by

no test coverage detected