mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-30 06:35:22 +08:00
stdlib: add argument default values (#9501)
This commit is contained in:
@@ -12,13 +12,13 @@ class Driver:
|
||||
grammar: Grammar
|
||||
logger: Logger
|
||||
convert: _Convert
|
||||
def __init__(self, grammar: Grammar, convert: _Convert | None = ..., logger: Logger | None = ...) -> None: ...
|
||||
def parse_tokens(self, tokens: Iterable[Any], debug: bool = ...) -> _NL: ...
|
||||
def parse_stream_raw(self, stream: IO[str], debug: bool = ...) -> _NL: ...
|
||||
def parse_stream(self, stream: IO[str], debug: bool = ...) -> _NL: ...
|
||||
def parse_file(self, filename: StrPath, encoding: str | None = ..., debug: bool = ...) -> _NL: ...
|
||||
def parse_string(self, text: str, debug: bool = ...) -> _NL: ...
|
||||
def __init__(self, grammar: Grammar, convert: _Convert | None = None, logger: Logger | None = None) -> None: ...
|
||||
def parse_tokens(self, tokens: Iterable[Any], debug: bool = False) -> _NL: ...
|
||||
def parse_stream_raw(self, stream: IO[str], debug: bool = False) -> _NL: ...
|
||||
def parse_stream(self, stream: IO[str], debug: bool = False) -> _NL: ...
|
||||
def parse_file(self, filename: StrPath, encoding: str | None = None, debug: bool = False) -> _NL: ...
|
||||
def parse_string(self, text: str, debug: bool = False) -> _NL: ...
|
||||
|
||||
def load_grammar(
|
||||
gt: str = ..., gp: str | None = ..., save: bool = ..., force: bool = ..., logger: Logger | None = ...
|
||||
gt: str = "Grammar.txt", gp: str | None = None, save: bool = True, force: bool = False, logger: Logger | None = None
|
||||
) -> Grammar: ...
|
||||
|
||||
@@ -20,8 +20,8 @@ class Parser:
|
||||
stack: list[tuple[_DFAS, int, _RawNode]]
|
||||
rootnode: _NL | None
|
||||
used_names: set[str]
|
||||
def __init__(self, grammar: Grammar, convert: _Convert | None = ...) -> None: ...
|
||||
def setup(self, start: int | None = ...) -> None: ...
|
||||
def __init__(self, grammar: Grammar, convert: _Convert | None = None) -> None: ...
|
||||
def setup(self, start: int | None = None) -> None: ...
|
||||
def addtoken(self, type: int, value: str | None, context: _Context) -> bool: ...
|
||||
def classify(self, type: int, value: str | None, context: _Context) -> int: ...
|
||||
def shift(self, type: int, value: str | None, newstate: int, context: _Context) -> None: ...
|
||||
|
||||
@@ -11,7 +11,7 @@ class ParserGenerator:
|
||||
stream: IO[str]
|
||||
generator: Iterator[_TokenInfo]
|
||||
first: dict[str, dict[str, int]]
|
||||
def __init__(self, filename: StrPath, stream: IO[str] | None = ...) -> None: ...
|
||||
def __init__(self, filename: StrPath, stream: IO[str] | None = None) -> None: ...
|
||||
def make_grammar(self) -> PgenGrammar: ...
|
||||
def make_first(self, c: PgenGrammar, name: str) -> dict[int, int]: ...
|
||||
def make_label(self, c: PgenGrammar, label: str) -> int: ...
|
||||
@@ -26,13 +26,13 @@ class ParserGenerator:
|
||||
def parse_alt(self) -> tuple[NFAState, NFAState]: ...
|
||||
def parse_item(self) -> tuple[NFAState, NFAState]: ...
|
||||
def parse_atom(self) -> tuple[NFAState, NFAState]: ...
|
||||
def expect(self, type: int, value: Any | None = ...) -> str: ...
|
||||
def expect(self, type: int, value: Any | None = None) -> str: ...
|
||||
def gettoken(self) -> None: ...
|
||||
def raise_error(self, msg: str, *args: Any) -> NoReturn: ...
|
||||
|
||||
class NFAState:
|
||||
arcs: list[tuple[str | None, NFAState]]
|
||||
def addarc(self, next: NFAState, label: str | None = ...) -> None: ...
|
||||
def addarc(self, next: NFAState, label: str | None = None) -> None: ...
|
||||
|
||||
class DFAState:
|
||||
nfaset: dict[NFAState, Any]
|
||||
@@ -43,4 +43,4 @@ class DFAState:
|
||||
def unifystate(self, old: DFAState, new: DFAState) -> None: ...
|
||||
def __eq__(self, other: DFAState) -> bool: ... # type: ignore[override]
|
||||
|
||||
def generate_grammar(filename: StrPath = ...) -> PgenGrammar: ...
|
||||
def generate_grammar(filename: StrPath = "Grammar.txt") -> PgenGrammar: ...
|
||||
|
||||
@@ -43,9 +43,9 @@ class Node(Base):
|
||||
self,
|
||||
type: int,
|
||||
children: list[_NL],
|
||||
context: Any | None = ...,
|
||||
prefix: str | None = ...,
|
||||
fixers_applied: list[Any] | None = ...,
|
||||
context: Any | None = None,
|
||||
prefix: str | None = None,
|
||||
fixers_applied: list[Any] | None = None,
|
||||
) -> None: ...
|
||||
def set_child(self, i: int, child: _NL) -> None: ...
|
||||
def insert_child(self, i: int, child: _NL) -> None: ...
|
||||
@@ -58,7 +58,7 @@ class Leaf(Base):
|
||||
value: str
|
||||
fixers_applied: list[Any]
|
||||
def __init__(
|
||||
self, type: int, value: str, context: _Context | None = ..., prefix: str | None = ..., fixers_applied: list[Any] = ...
|
||||
self, type: int, value: str, context: _Context | None = None, prefix: str | None = None, fixers_applied: list[Any] = ...
|
||||
) -> None: ...
|
||||
def __unicode__(self) -> str: ...
|
||||
|
||||
@@ -69,23 +69,23 @@ class BasePattern:
|
||||
content: str | None
|
||||
name: str | None
|
||||
def optimize(self) -> BasePattern: ... # sic, subclasses are free to optimize themselves into different patterns
|
||||
def match(self, node: _NL, results: _Results | None = ...) -> bool: ...
|
||||
def match_seq(self, nodes: list[_NL], results: _Results | None = ...) -> bool: ...
|
||||
def match(self, node: _NL, results: _Results | None = None) -> bool: ...
|
||||
def match_seq(self, nodes: list[_NL], results: _Results | None = None) -> bool: ...
|
||||
def generate_matches(self, nodes: list[_NL]) -> Iterator[tuple[int, _Results]]: ...
|
||||
|
||||
class LeafPattern(BasePattern):
|
||||
def __init__(self, type: int | None = ..., content: str | None = ..., name: str | None = ...) -> None: ...
|
||||
def __init__(self, type: int | None = None, content: str | None = None, name: str | None = None) -> None: ...
|
||||
|
||||
class NodePattern(BasePattern):
|
||||
wildcards: bool
|
||||
def __init__(self, type: int | None = ..., content: str | None = ..., name: str | None = ...) -> None: ...
|
||||
def __init__(self, type: int | None = None, content: str | None = None, name: str | None = None) -> None: ...
|
||||
|
||||
class WildcardPattern(BasePattern):
|
||||
min: int
|
||||
max: int
|
||||
def __init__(self, content: str | None = ..., min: int = ..., max: int = ..., name: str | None = ...) -> None: ...
|
||||
def __init__(self, content: str | None = None, min: int = 0, max: int = 2147483647, name: str | None = None) -> None: ...
|
||||
|
||||
class NegatedPattern(BasePattern):
|
||||
def __init__(self, content: str | None = ...) -> None: ...
|
||||
def __init__(self, content: str | None = None) -> None: ...
|
||||
|
||||
def generate_matches(patterns: list[BasePattern], nodes: list[_NL]) -> Iterator[tuple[int, _Results]]: ...
|
||||
|
||||
@@ -8,7 +8,7 @@ from .pgen2.grammar import Grammar
|
||||
_Driver: TypeAlias = Any # really lib2to3.driver.Driver
|
||||
_BottomMatcher: TypeAlias = Any # really lib2to3.btm_matcher.BottomMatcher
|
||||
|
||||
def get_all_fix_names(fixer_pkg: str, remove_prefix: bool = ...) -> list[str]: ...
|
||||
def get_all_fix_names(fixer_pkg: str, remove_prefix: bool = True) -> list[str]: ...
|
||||
def get_fixers_from_package(pkg_name: str) -> list[str]: ...
|
||||
|
||||
class FixerError(Exception): ...
|
||||
@@ -33,25 +33,25 @@ class RefactoringTool:
|
||||
bmi_pre_order: list[Any]
|
||||
bmi_post_order: list[Any]
|
||||
def __init__(
|
||||
self, fixer_names: Iterable[str], options: Mapping[str, Any] | None = ..., explicit: Container[str] | None = ...
|
||||
self, fixer_names: Iterable[str], options: Mapping[str, Any] | None = None, explicit: Container[str] | None = None
|
||||
) -> None: ...
|
||||
def get_fixers(self) -> tuple[list[Any], list[Any]]: ...
|
||||
def log_error(self, msg: str, *args: Any, **kwds: Any) -> NoReturn: ...
|
||||
def log_message(self, msg: str, *args: Any) -> None: ...
|
||||
def log_debug(self, msg: str, *args: Any) -> None: ...
|
||||
def print_output(self, old_text: str, new_text: str, filename: str, equal): ...
|
||||
def refactor(self, items: Iterable[str], write: bool = ..., doctests_only: bool = ...) -> None: ...
|
||||
def refactor_dir(self, dir_name: str, write: bool = ..., doctests_only: bool = ...) -> None: ...
|
||||
def refactor(self, items: Iterable[str], write: bool = False, doctests_only: bool = False) -> None: ...
|
||||
def refactor_dir(self, dir_name: str, write: bool = False, doctests_only: bool = False) -> None: ...
|
||||
def _read_python_source(self, filename: str) -> tuple[str, str]: ...
|
||||
def refactor_file(self, filename: str, write: bool = ..., doctests_only: bool = ...) -> None: ...
|
||||
def refactor_file(self, filename: str, write: bool = False, doctests_only: bool = False) -> None: ...
|
||||
def refactor_string(self, data: str, name: str): ...
|
||||
def refactor_stdin(self, doctests_only: bool = ...) -> None: ...
|
||||
def refactor_stdin(self, doctests_only: bool = False) -> None: ...
|
||||
def refactor_tree(self, tree, name: str) -> bool: ...
|
||||
def traverse_by(self, fixers, traversal) -> None: ...
|
||||
def processed_file(
|
||||
self, new_text: str, filename: str, old_text: str | None = ..., write: bool = ..., encoding: str | None = ...
|
||||
self, new_text: str, filename: str, old_text: str | None = None, write: bool = False, encoding: str | None = None
|
||||
) -> None: ...
|
||||
def write_file(self, new_text: str, filename: str, old_text: str, encoding: str | None = ...) -> None: ...
|
||||
def write_file(self, new_text: str, filename: str, old_text: str, encoding: str | None = None) -> None: ...
|
||||
PS1: ClassVar[str]
|
||||
PS2: ClassVar[str]
|
||||
def refactor_docstring(self, input: str, filename: str) -> str: ...
|
||||
@@ -68,4 +68,6 @@ class MultiprocessingUnsupported(Exception): ...
|
||||
class MultiprocessRefactoringTool(RefactoringTool):
|
||||
queue: Any | None
|
||||
output_lock: Any | None
|
||||
def refactor(self, items: Iterable[str], write: bool = ..., doctests_only: bool = ..., num_processes: int = ...) -> None: ...
|
||||
def refactor(
|
||||
self, items: Iterable[str], write: bool = False, doctests_only: bool = False, num_processes: int = 1
|
||||
) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user