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

Method parse_function_names

Tools/clinic/libclinic/dsl_parser.py:561–578  ·  view source on GitHub ↗
(self, line: str)

Source from the content-addressed store, hash-verified

559 self.next(self.state_modulename_name, line)
560
561 def parse_function_names(self, line: str) -> FunctionNames:
562 left, as_, right = line.partition(' as ')
563 full_name = left.strip()
564 c_basename = right.strip()
565 if as_ and not c_basename:
566 fail("No C basename provided after 'as' keyword")
567 if not c_basename:
568 fields = full_name.split(".")
569 if fields[-1] == '__new__':
570 fields.pop()
571 c_basename = "_".join(fields)
572 if not libclinic.is_legal_py_identifier(full_name):
573 fail(f"Illegal function name: {full_name!r}")
574 if not libclinic.is_legal_c_identifier(c_basename):
575 fail(f"Illegal C basename: {c_basename!r}")
576 names = FunctionNames(full_name=full_name, c_basename=c_basename)
577 self.normalize_function_kind(names.full_name)
578 return names
579
580 def normalize_function_kind(self, fullname: str) -> None:
581 # Fetch the method name and possibly class.

Callers 1

state_modulename_nameMethod · 0.95

Calls 8

failFunction · 0.90
FunctionNamesClass · 0.85
partitionMethod · 0.45
stripMethod · 0.45
splitMethod · 0.45
popMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected