8000 gh-104683: Argument Clinic: Modernise parse_special_symbol() by erlend-aasland · Pull Request #106837 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-104683: Argument Clinic: Modernise parse_special_symbol() #106837

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove parse_special_symbol()
  • Loading branch information
erlend-aasland committed Jul 17, 2023
commit 8e36b5111558a5a8d888740639da1c493dc47bbd
28 changes: 10 additions & 18 deletions Tools/clinic/clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4865,10 +4865,16 @@ def state_parameter(self, line: str | None) -> None:
return

line = line.lstrip()

if line in ('*', '/', '[', ']'):
self.parse_special_symbol(line)
return
func = self.function
match line:
case '*':
return self.parse_star(func)
case '[':
return self.parse_open_bracket(func)
case ']':
return self.parse_close_bracket(func)
case '/':
return self.parse_slash(func)

match self.parameter_state:
case ParamState.START | ParamState.REQUIRED:
Expand Down Expand Up @@ -5208,20 +5214,6 @@ def parse_slash(self, function: Function) -> None:
"positional-only parameters, which is unsupported.")
p.kind = inspect.Parameter.POSITIONAL_ONLY

def parse_special_symbol(self, symbol: str):
assert isinstance(self.function, Function)
func = self.function

match symbol:
case '*':
self.parse_star(func)
case '[':
self.parse_open_bracket(func)
case ']':
self.parse_close_bracket(func)
case '/':
self.parse_slash(func)

def state_parameter_docstring_start(self, line: str | None) -> None:
self.parameter_docstring_indent = len(self.indent.margin)
assert self.indent.depth == 3
Expand Down
0