MCPcopy Index your code
hub / github.com/python/cpython / __get__

Method __get__

Lib/functools.py:472–489  ·  view source on GitHub ↗
(self, obj, cls=None)

Source from the content-addressed store, hash-verified

470 return _method
471
472 def __get__(self, obj, cls=None):
473 get = getattr(self.func, "__get__", None)
474 result = None
475 if get is not None:
476 new_func = get(obj, cls)
477 if new_func is not self.func:
478 # Assume __get__ returning something new indicates the
479 # creation of an appropriate callable
480 result = partial(new_func, *self.args, **self.keywords)
481 try:
482 result.__self__ = new_func.__self__
483 except AttributeError:
484 pass
485 if result is None:
486 # If the underlying descriptor didn't do anything, treat this
487 # like an instance method
488 result = self._make_unbound_method().__get__(obj, cls)
489 return result
490
491 @property
492 def __isabstractmethod__(self):

Callers

nothing calls this directly

Calls 4

_make_unbound_methodMethod · 0.95
partialClass · 0.85
getFunction · 0.70
__get__Method · 0.45

Tested by

no test coverage detected