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

Method get_method_and_class

mypyc/ir/class_ir.py:321–334  ·  view source on GitHub ↗
(
        self, name: str, *, prefer_method: bool = False
    )

Source from the content-addressed store, hash-verified

319 return f"{exported_name(self.fullname)}Object"
320
321 def get_method_and_class(
322 self, name: str, *, prefer_method: bool = False
323 ) -> tuple[FuncIR, ClassIR] | None:
324 for ir in self.mro:
325 if name in ir.methods:
326 func_ir = ir.methods[name]
327 if not prefer_method and func_ir.decl.implicit:
328 # This is an implicit accessor, so there is also an attribute definition
329 # which the caller prefers. This happens if an attribute overrides a
330 # property.
331 return None
332 return func_ir, ir
333
334 return None
335
336 def get_method(self, name: str, *, prefer_method: bool = False) -> FuncIR | None:
337 res = self.get_method_and_class(name, prefer_method=prefer_method)

Callers 4

get_methodMethod · 0.95
specialize_parent_vtableFunction · 0.80
generate_slotsFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected