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

Method normalize_function_kind

Tools/clinic/libclinic/dsl_parser.py:580–600  ·  view source on GitHub ↗
(self, fullname: str)

Source from the content-addressed store, hash-verified

578 return names
579
580 def normalize_function_kind(self, fullname: str) -> None:
581 # Fetch the method name and possibly class.
582 fields = fullname.split('.')
583 name = fields.pop()
584 _, cls = self.clinic._module_and_class(fields)
585
586 # Check special method requirements.
587 if name in unsupported_special_methods:
588 fail(f"{name!r} is a special method and cannot be converted to Argument Clinic!")
589 if name == '__init__' and (self.kind is not CALLABLE or not cls):
590 fail(f"{name!r} must be a normal method; got '{self.kind}'!")
591 if name == '__new__' and (self.kind is not CLASS_METHOD or not cls):
592 fail("'__new__' must be a class method!")
593 if self.kind in {GETTER, SETTER} and not cls:
594 fail("@getter and @setter must be methods")
595
596 # Normalise self.kind.
597 if name == '__new__':
598 self.kind = METHOD_NEW
599 elif name == '__init__':
600 self.kind = METHOD_INIT
601
602 def resolve_return_converter(
603 self, full_name: str, forced_converter: str

Callers 1

parse_function_namesMethod · 0.95

Calls 4

failFunction · 0.90
_module_and_classMethod · 0.80
splitMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected