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

Method accept_maybe_cache

mypy/checkexpr.py:6207–6217  ·  view source on GitHub ↗
(self, node: Expression, type_context: Type | None = None)

Source from the content-addressed store, hash-verified

6205 return result
6206
6207 def accept_maybe_cache(self, node: Expression, type_context: Type | None = None) -> Type:
6208 binder_version = self.chk.binder.version
6209 with self.msg.filter_errors(filter_errors=True, save_filtered_errors=True) as msg:
6210 with self.chk.local_type_map as type_map:
6211 typ = node.accept(self)
6212 messages = msg.filtered_errors()
6213 if binder_version == self.chk.binder.version and not self.chk.current_node_deferred:
6214 self.expr_cache[(node, type_context)] = (binder_version, typ, messages, type_map)
6215 self.chk.store_types(type_map)
6216 self.msg.add_errors(messages)
6217 return typ
6218
6219 def named_type(self, name: str) -> Instance:
6220 """Return an instance type with type given by the name and no type

Callers 1

acceptMethod · 0.95

Calls 5

filter_errorsMethod · 0.80
filtered_errorsMethod · 0.80
store_typesMethod · 0.80
add_errorsMethod · 0.80
acceptMethod · 0.45

Tested by

no test coverage detected