8000 gh-104050: Argument Clinic: Annotate Clinic.parse() by erlend-aasland · Pull Request #106760 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-104050: Argument Clinic: Annotate Clinic.parse() #106760

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
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
8000
Diff view
Diff view
14 changes: 10 additions & 4 deletions Tools/clinic/clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2044,10 +2044,16 @@ def write_file(filename: str, new_contents: str) -> None:
raise


class Parser:

@abc.abstractmethod
def parse(self, block: Block) -> None: ...


ClassDict = dict[str, "Class"]
DestinationDict = dict[str, Destination]
ModuleDict = dict[str, "Module"]
ParserDict = dict[str, "DSLParser"]
ParserDict = dict[str, Parser]

clinic = None
class Clinic:
Expand Down Expand Up @@ -2197,7 +2203,7 @@ def get_destination_buffer(
d = self.get_destination(name)
return d.buffers[item]

def parse(self, input):
def parse(self, input: str) -> str:
printer = self.printer
self.block_parser = BlockParser(input, self.language, verify=self.verify)
for block in self.block_parser:
Expand Down Expand Up @@ -2333,7 +2339,7 @@ def compute_checksum(
return s


class PythonParser:
class PythonParser(Parser):
def __init__(self, clinic: Clinic) -> None:
pass

Expand Down Expand Up @@ -4353,7 +4359,7 @@ class ParamState(enum.IntEnum):
RIGHT_SQUARE_AFTER = 6


class DSLParser:
class DSLParser(Parser):
function: Function | None
state: StateKeeper
keyword_only: bool
Expand Down
0