MCPcopy Index your code
hub / github.com/RustPython/RustPython / ismethod

Method ismethod

Lib/test/test_pyclbr.py:88–102  ·  view source on GitHub ↗
(oclass, obj, name)

Source from the content-addressed store, hash-verified

86 dict = pyclbr.readmodule_ex(moduleName)
87
88 def ismethod(oclass, obj, name):
89 classdict = oclass.__dict__
90 if isinstance(obj, MethodType):
91 # could be a classmethod
92 if (not isinstance(classdict[name], ClassMethodType) or
93 obj.__self__ is not oclass):
94 return False
95 elif not isinstance(obj, FunctionType):
96 return False
97
98 objname = obj.__name__
99 if objname.startswith("__") and not objname.endswith("__"):
100 if stripped_typename := oclass.__name__.lstrip('_'):
101 objname = f"_{stripped_typename}{objname}"
102 return objname == name
103
104 # Make sure the toplevel functions and classes are the same.
105 for name, value in dict.items():

Callers 4

_finddocFunction · 0.80
_is_bound_methodFunction · 0.80
describeFunction · 0.80
_find_linenoMethod · 0.80

Calls 4

isinstanceFunction · 0.85
startswithMethod · 0.45
endswithMethod · 0.45
lstripMethod · 0.45

Tested by

no test coverage detected