[PyYAML] type the whole Emitter class (#10750)

This commit is contained in:
Pascal Corpet
2023-09-23 16:07:09 +02:00
committed by GitHub
parent e1b60060ec
commit e6fb59c994

View File

@@ -1,7 +1,10 @@
from typing import Any, Protocol, TypeVar
from collections.abc import Callable
from typing import Any, NoReturn, Protocol, TypeVar
from yaml.error import YAMLError
from .events import Event
_T_contra = TypeVar("_T_contra", str, bytes, contravariant=True)
class _WriteStream(Protocol[_T_contra]):
@@ -26,94 +29,100 @@ class ScalarAnalysis:
) -> None: ...
class Emitter:
DEFAULT_TAG_PREFIXES: Any
DEFAULT_TAG_PREFIXES: dict[str, str]
stream: _WriteStream[Any]
encoding: Any
states: Any
state: Any
events: Any
event: Any
indents: Any
indent: Any
flow_level: Any
root_context: Any
sequence_context: Any
mapping_context: Any
simple_key_context: Any
line: Any
column: Any
whitespace: Any
indention: Any
open_ended: Any
canonical: Any
allow_unicode: Any
best_indent: Any
best_width: Any
best_line_break: Any
tag_prefixes: Any
prepared_anchor: Any
prepared_tag: Any
analysis: Any
style: Any
encoding: str | None
states: list[Callable[[], None]]
state: Callable[[], None] | None
events: list[Event]
event: Event | None
indents: list[int | None]
indent: int | None
flow_level: int
root_context: bool
sequence_context: bool
mapping_context: bool
simple_key_context: bool
line: int
column: int
whitespace: bool
indention: bool
open_ended: bool
canonical: bool | None
allow_unicode: bool | None
best_indent: int
best_width: int
best_line_break: str
tag_prefixes: dict[str, str] | None
prepared_anchor: str | None
prepared_tag: str | None
analysis: ScalarAnalysis | None
style: str | None
def __init__(
self, stream: _WriteStream[Any], canonical=None, indent=None, width=None, allow_unicode=None, line_break=None
self,
stream: _WriteStream[Any],
canonical: bool | None = ...,
indent: int | None = ...,
width: int | None = ...,
allow_unicode: bool | None = ...,
line_break: str | None = ...,
) -> None: ...
def dispose(self): ...
def emit(self, event): ...
def need_more_events(self): ...
def need_events(self, count): ...
def increase_indent(self, flow=False, indentless=False): ...
def expect_stream_start(self): ...
def expect_nothing(self): ...
def expect_first_document_start(self): ...
def expect_document_start(self, first=False): ...
def expect_document_end(self): ...
def expect_document_root(self): ...
def expect_node(self, root=False, sequence=False, mapping=False, simple_key=False): ...
def expect_alias(self): ...
def expect_scalar(self): ...
def expect_flow_sequence(self): ...
def expect_first_flow_sequence_item(self): ...
def expect_flow_sequence_item(self): ...
def expect_flow_mapping(self): ...
def expect_first_flow_mapping_key(self): ...
def expect_flow_mapping_key(self): ...
def expect_flow_mapping_simple_value(self): ...
def expect_flow_mapping_value(self): ...
def expect_block_sequence(self): ...
def expect_first_block_sequence_item(self): ...
def expect_block_sequence_item(self, first=False): ...
def expect_block_mapping(self): ...
def expect_first_block_mapping_key(self): ...
def expect_block_mapping_key(self, first=False): ...
def expect_block_mapping_simple_value(self): ...
def expect_block_mapping_value(self): ...
def check_empty_sequence(self): ...
def check_empty_mapping(self): ...
def check_empty_document(self): ...
def check_simple_key(self): ...
def process_anchor(self, indicator): ...
def process_tag(self): ...
def choose_scalar_style(self): ...
def process_scalar(self): ...
def prepare_version(self, version): ...
def prepare_tag_handle(self, handle): ...
def prepare_tag_prefix(self, prefix): ...
def prepare_tag(self, tag): ...
def prepare_anchor(self, anchor): ...
def analyze_scalar(self, scalar): ...
def flush_stream(self): ...
def write_stream_start(self): ...
def write_stream_end(self): ...
def write_indicator(self, indicator, need_whitespace, whitespace=False, indention=False): ...
def write_indent(self): ...
def write_line_break(self, data=None): ...
def write_version_directive(self, version_text): ...
def write_tag_directive(self, handle_text, prefix_text): ...
def write_single_quoted(self, text, split=True): ...
ESCAPE_REPLACEMENTS: Any
def write_double_quoted(self, text, split=True): ...
def determine_block_hints(self, text): ...
def write_folded(self, text): ...
def write_literal(self, text): ...
def write_plain(self, text, split=True): ...
def dispose(self) -> None: ...
def emit(self, event: Event) -> None: ...
def need_more_events(self) -> bool: ...
def need_events(self, count: int) -> bool: ...
def increase_indent(self, flow: bool = ..., indentless: bool = ...) -> None: ...
def expect_stream_start(self) -> None: ...
def expect_nothing(self) -> NoReturn: ...
def expect_first_document_start(self) -> None: ...
def expect_document_start(self, first: bool = False) -> None: ...
def expect_document_end(self) -> None: ...
def expect_document_root(self) -> None: ...
def expect_node(self, root: bool = ..., sequence: bool = ..., mapping: bool = ..., simple_key: bool = ...) -> None: ...
def expect_alias(self) -> None: ...
def expect_scalar(self) -> None: ...
def expect_flow_sequence(self) -> None: ...
def expect_first_flow_sequence_item(self) -> None: ...
def expect_flow_sequence_item(self) -> None: ...
def expect_flow_mapping(self) -> None: ...
def expect_first_flow_mapping_key(self) -> None: ...
def expect_flow_mapping_key(self) -> None: ...
def expect_flow_mapping_simple_value(self) -> None: ...
def expect_flow_mapping_value(self) -> None: ...
def expect_block_sequence(self) -> None: ...
def expect_first_block_sequence_item(self) -> None: ...
def expect_block_sequence_item(self, first: bool = ...) -> None: ...
def expect_block_mapping(self) -> None: ...
def expect_first_block_mapping_key(self) -> None: ...
def expect_block_mapping_key(self, first: bool = ...) -> None: ...
def expect_block_mapping_simple_value(self) -> None: ...
def expect_block_mapping_value(self) -> None: ...
def check_empty_sequence(self) -> bool: ...
def check_empty_mapping(self) -> bool: ...
def check_empty_document(self) -> bool: ...
def check_simple_key(self) -> bool: ...
def process_anchor(self, indicator: str) -> None: ...
def process_tag(self) -> None: ...
def choose_scalar_style(self) -> str: ...
def process_scalar(self) -> None: ...
def prepare_version(self, version) -> str: ...
def prepare_tag_handle(self, handle: str) -> str: ...
def prepare_tag_prefix(self, prefix: str) -> str: ...
def prepare_tag(self, tag: str) -> str: ...
def prepare_anchor(self, anchor: str) -> str: ...
def analyze_scalar(self, scalar: str) -> ScalarAnalysis: ...
def flush_stream(self) -> None: ...
def write_stream_start(self) -> None: ...
def write_stream_end(self) -> None: ...
def write_indicator(self, indicator: str, need_whitespace: bool, whitespace: bool = ..., indention: bool = ...) -> None: ...
def write_indent(self) -> None: ...
def write_line_break(self, data: str | None = ...) -> None: ...
def write_version_directive(self, version_text: str) -> None: ...
def write_tag_directive(self, handle_text: str, prefix_text: str) -> None: ...
def write_single_quoted(self, text: str, split: bool = ...) -> None: ...
ESCAPE_REPLACEMENTS: dict[str, str]
def write_double_quoted(self, text: str, split: bool = ...) -> None: ...
def determine_block_hints(self, text: str) -> str: ...
def write_folded(self, text: str) -> None: ...
def write_literal(self, text: str) -> None: ...
def write_plain(self, text: str, split: bool = ...) -> None: ...