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

Method state_parameter

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

Source from the content-addressed store, hash-verified

831 p.group = -p.group
832
833 def state_parameter(self, line: str) -> None:
834 assert isinstance(self.function, Function)
835
836 if not self.valid_line(line):
837 return
838
839 if self.parameter_continuation:
840 line = self.parameter_continuation + ' ' + line.lstrip()
841 self.parameter_continuation = ''
842
843 assert self.indent.depth == 2
844 indent = self.indent.infer(line)
845 if indent == -1:
846 # we outdented, must be to definition column
847 return self.next(self.state_function_docstring, line)
848
849 if indent == 1:
850 # we indented, must be to new parameter docstring column
851 return self.next(self.state_parameter_docstring_start, line)
852
853 line = line.rstrip()
854 if line.endswith('\\'):
855 self.parameter_continuation = line[:-1]
856 return
857
858 line = line.lstrip()
859 version: VersionTuple | None = None
860 match = self.from_version_re.fullmatch(line)
861 if match:
862 line = match[1]
863 version = self.parse_version(match[2])
864
865 func = self.function
866 match line:
867 case '*':
868 self.parse_star(func, version)
869 case '[':
870 self.parse_opening_square_bracket(func)
871 case ']':
872 self.parse_closing_square_bracket(func)
873 case '/':
874 self.parse_slash(func, version)
875 case param:
876 self.parse_parameter(param)
877
878 def parse_parameter(self, line: str) -> None:
879 assert self.function is not None

Callers

nothing calls this directly

Calls 12

valid_lineMethod · 0.95
nextMethod · 0.95
parse_versionMethod · 0.95
parse_starMethod · 0.95
parse_slashMethod · 0.95
parse_parameterMethod · 0.95
inferMethod · 0.80
lstripMethod · 0.45
rstripMethod · 0.45
endswithMethod · 0.45

Tested by

no test coverage detected