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

Method _make_unbound_method

Lib/functools.py:453–470  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

451 __repr__ = _partial_repr
452
453 def _make_unbound_method(self):
454 def _method(cls_or_self, /, *args, **keywords):
455 phcount = self._phcount
456 if phcount:
457 try:
458 pto_args = self._merger(self.args + args)
459 args = args[phcount:]
460 except IndexError:
461 raise TypeError("missing positional arguments "
462 "in 'partialmethod' call; expected "
463 f"at least {phcount}, got {len(args)}")
464 else:
465 pto_args = self.args
466 keywords = {**self.keywords, **keywords}
467 return self.func(cls_or_self, *pto_args, *args, **keywords)
468 _method.__isabstractmethod__ = self.__isabstractmethod__
469 _method.__partialmethod__ = self
470 return _method
471
472 def __get__(self, obj, cls=None):
473 get = getattr(self.func, "__get__", None)

Callers 1

__get__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected