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

Method add_function

Tools/clinic/libclinic/dsl_parser.py:732–749  ·  view source on GitHub ↗
(self, func: Function)

Source from the content-addressed store, hash-verified

730 self.next(self.state_parameters_start)
731
732 def add_function(self, func: Function) -> None:
733 # Insert a self converter automatically.
734 tp, name = correct_name_for_self(func)
735 if func.cls and tp == "PyObject *":
736 func.self_converter = self_converter(name, name, func,
737 type=func.cls.typedef)
738 else:
739 func.self_converter = self_converter(name, name, func)
740 func.parameters[name] = Parameter(
741 name,
742 inspect.Parameter.POSITIONAL_ONLY,
743 function=func,
744 converter=func.self_converter
745 )
746
747 self.block.signatures.append(func)
748 self.function = func
749 (func.cls or func.module).functions.append(func)
750
751 # Now entering the parameters section. The rules, formally stated:
752 #

Callers 1

state_modulename_nameMethod · 0.95

Calls 4

correct_name_for_selfFunction · 0.90
self_converterClass · 0.90
ParameterClass · 0.90
appendMethod · 0.45

Tested by

no test coverage detected