MCPcopy Index your code
hub / github.com/ipython/ipython / _unbind_method

Function _unbind_method

IPython/core/guarded_eval.py:68–86  ·  view source on GitHub ↗

Get unbound method for given bound method. Returns None if cannot get unbound method, or method is already unbound.

(func: Callable)

Source from the content-addressed store, hash-verified

66
67
68def _unbind_method(func: Callable) -> Union[Callable, None]:
69 """Get unbound method for given bound method.
70
71 Returns None if cannot get unbound method, or method is already unbound.
72 """
73 owner = getattr(func, "__self__", None)
74 owner_class = type(owner)
75 name = getattr(func, "__name__", None)
76 instance_dict_overrides = getattr(owner, "__dict__", None)
77 if (
78 owner is not None
79 and name
80 and (
81 not instance_dict_overrides
82 or (instance_dict_overrides and name not in instance_dict_overrides)
83 )
84 ):
85 return getattr(owner_class, name)
86 return None
87
88
89@undoc

Callers 2

test_unbind_methodFunction · 0.90
can_callMethod · 0.85

Calls

no outgoing calls

Tested by 1

test_unbind_methodFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…