MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / __init__

Method __init__

tools/python-3.11.9-amd64/Lib/functools.py:355–372  ·  view source on GitHub ↗
(self, func, /, *args, **keywords)

Source from the content-addressed store, hash-verified

353 """
354
355 def __init__(self, func, /, *args, **keywords):
356 if not callable(func) and not hasattr(func, "__get__"):
357 raise TypeError("{!r} is not callable or a descriptor"
358 .format(func))
359
360 # func could be a descriptor like classmethod which isn't callable,
361 # so we can't inherit from partial (it verifies func is callable)
362 if isinstance(func, partialmethod):
363 # flattening is mandatory in order to place cls/self before all
364 # other arguments
365 # it's also more efficient since only one function will be called
366 self.func = func.func
367 self.args = func.args + args
368 self.keywords = {**func.keywords, **keywords}
369 else:
370 self.func = func
371 self.args = args
372 self.keywords = keywords
373
374 def __repr__(self):
375 args = ", ".join(map(repr, self.args))

Callers

nothing calls this directly

Calls 2

callableFunction · 0.50
formatMethod · 0.45

Tested by

no test coverage detected