-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add docutils definitions and (incomplete) modules #5192
Merged
Merged
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
98372ea
Add various incomplete docutils modules
srittau 585dc72
Complete docutils/__init__.pyi
srittau 4e3f9eb
Populate docutils.frontend and .io
srittau 78d958b
Move recommonmark_wrapper.pyi to correct package
srittau 272c739
Partly add docutils parsers
srittau 40fe72f
Use absolute imports
srittau dcef9b9
Use absolute imports
srittau 9d29e9e
Work around mypy bugs with generic types
srittau 6e791f2
Split OpenTextMode
srittau 15a42fb
Use file modes from _typeshed
srittau 89c75e4
Fix OpenTextMode
srittau File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,42 @@ | ||
from typing import Any | ||
from collections.abc import Sequence | ||
from typing import Any, ClassVar, NamedTuple, Optional, Tuple, Union | ||
|
||
def __getattr__(name: str) -> Any: ... | ||
__docformat__: str | ||
__version__: str | ||
|
||
class _VersionInfo(NamedTuple): | ||
major: int | ||
minor: int | ||
micro: int | ||
releaselevel: str | ||
serial: int | ||
release: bool | ||
|
||
class VersionInfo(_VersionInfo): | ||
def __new__( | ||
cls, major: int = ..., minor: int = ..., micro: int = ..., releaselevel: str = ..., serial: int = ..., release: bool = ... | ||
) -> VersionInfo: ... | ||
|
||
__version_info__: VersionInfo | ||
__version_details__: str | ||
|
||
class ApplicationError(Exception): ... | ||
class DataError(ApplicationError): ... | ||
|
||
class SettingsSpec: | ||
settings_spec: ClassVar[Tuple[Any, ...]] | ||
settings_defaults: ClassVar[Optional[dict[Any, Any]]] | ||
settings_default_overrides: ClassVar[Optional[dict[Any, Any]]] | ||
relative_path_settings: ClassVar[Tuple[Any, ...]] | ||
config_section: ClassVar[Optional[str]] | ||
config_section_dependencies: ClassVar[Optional[Tuple[str, ...]]] | ||
|
||
class TransformSpec: | ||
def get_transforms(self) -> list[Any]: ... | ||
default_transforms: ClassVar[Tuple[Any, ...]] | ||
unknown_reference_resolvers: ClassVar[list[Any]] | ||
|
||
class Component(SettingsSpec, TransformSpec): | ||
component_type: ClassVar[Optional[str]] | ||
supported: ClassVar[Tuple[str, ...]] | ||
def supports(self, format: str) -> bool: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from typing import Any | ||
|
||
def __getattr__(name: str) -> Any: ... # incomplete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
from typing import Any | ||
|
||
html_parts: Any | ||
|
||
def __getattr__(name: str) -> Any: ... | ||
def __getattr__(name: str) -> Any: ... # incomplete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import optparse | ||
from configparser import RawConfigParser | ||
from typing import Any, ClassVar, Optional, Tuple | ||
|
||
from docutils import SettingsSpec | ||
from docutils.utils import DependencyList | ||
|
||
__docformat__: str | ||
|
||
def store_multiple(option, opt, value, parser, *args, **kwargs) -> None: ... | ||
def read_config_file(option, opt, value, parser) -> None: ... | ||
def validate_encoding(setting, value, option_parser, config_parser: Optional[Any] = ..., config_section: Optional[Any] = ...): ... | ||
def validate_encoding_error_handler( | ||
setting, value, option_parser, config_parser: Optional[Any] = ..., config_section: Optional[Any] = ... | ||
): ... | ||
def validate_encoding_and_error_handler( | ||
setting, value, option_parser, config_parser: Optional[Any] = ..., config_section: Optional[Any] = ... | ||
): ... | ||
def validate_boolean( | ||
setting, value, option_parser, config_parser: Optional[Any] = ..., config_section: Optional[Any] = ... | ||
) -> bool: ... | ||
def validate_nonnegative_int( | ||
setting, value, option_parser, config_parser: Optional[Any] = ..., config_section: Optional[Any] = ... | ||
) -> int: ... | ||
def validate_threshold( | ||
setting, value, option_parser, config_parser: Optional[Any] = ..., config_section: Optional[Any] = ... | ||
) -> int: ... | ||
def validate_colon_separated_string_list( | ||
setting, value, option_parser, config_parser: Optional[Any] = ..., config_section: Optional[Any] = ... | ||
) -> list[str]: ... | ||
def validate_comma_separated_list( | ||
setting, value, option_parser, config_parser: Optional[Any] = ..., config_section: Optional[Any] = ... | ||
) -> list[str]: ... | ||
def validate_url_trailing_slash( | ||
setting, value, option_parser, config_parser: Optional[Any] = ..., config_section: Optional[Any] = ... | ||
) -> str: ... | ||
def validate_dependency_file( | ||
setting, value, option_parser, config_parser: Optional[Any] = ..., config_section: Optional[Any] = ... | ||
) -> DependencyList: ... | ||
def validate_strip_class( | ||
setting, value, option_parser, config_parser: Optional[Any] = ..., config_section: Optional[Any] = ... | ||
): ... | ||
def validate_smartquotes_locales( | ||
setting, value, option_parser, config_parser: Optional[Any] = ..., config_section: Optional[Any] = ... | ||
) -> list[tuple[str, str]]: ... | ||
def make_paths_absolute(pathdict, keys, base_path: Optional[Any] = ...) -> None: ... | ||
def make_one_path_absolute(base_path, path) -> str: ... | ||
def filter_settings_spec(settings_spec, *exclude, **replace) -> Tuple[Any, ...]: ... | ||
|
||
class Values(optparse.Values): | ||
def update(self, other_dict, option_parser) -> None: ... | ||
def copy(self) -> Values: ... | ||
|
||
class Option(optparse.Option): ... | ||
|
||
class OptionParser(optparse.OptionParser, SettingsSpec): | ||
standard_config_files: ClassVar[list[str]] | ||
threshold_choices: ClassVar[list[str]] | ||
thresholds: ClassVar[dict[str, int]] | ||
booleans: ClassVar[dict[str, bool]] | ||
default_error_encoding: ClassVar[str] | ||
default_error_encoding_error_handler: ClassVar[str] | ||
config_section: ClassVar[str] | ||
version_template: ClassVar[str] | ||
def __getattr__(self, name: str) -> Any: ... # incomplete | ||
|
||
class ConfigParser(RawConfigParser): | ||
def __getattr__(self, name: str) -> Any: ... # incomplete | ||
|
||
class ConfigDeprecationWarning(DeprecationWarning): ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
from typing import Any, ClassVar, Optional, Union | ||
from typing_extensions import Literal | ||
|
||
from docutils import TransformSpec | ||
|
||
__docformat__: str | ||
|
||
class InputError(IOError): ... | ||
class OutputError(IOError): ... | ||
|
||
def check_encoding(stream: Any, encoding: str) -> Optional[bool]: ... | ||
|
||
class Input(TransformSpec): | ||
component_type: ClassVar[str] | ||
default_source_path: ClassVar[Optional[str]] | ||
def read(self) -> Any: ... | ||
def __getattr__(self, name: str) -> Any: ... # incomplete | ||
|
||
class Output(TransformSpec): | ||
component_type: ClassVar[str] | ||
default_destination_path: ClassVar[Optional[str]] | ||
def __init__( | ||
self, | ||
destination: Optional[Any] = ..., | ||
destination_path: Optional[Any] = ..., | ||
encoding: Optional[str] = ..., | ||
error_handler: str = ..., | ||
) -> None: ... | ||
def write(self, data: str) -> Any: ... # returns bytes or str | ||
def encode(self, data: str) -> Any: ... # returns bytes or str | ||
|
||
class FileInput(Input): | ||
def __init__( | ||
self, | ||
source: Optional[Any] = ..., | ||
source_path: Optional[Any] = ..., | ||
encoding: Optional[str] = ..., | ||
error_handler: str = ..., | ||
autoclose: bool = ..., | ||
mode: Literal["r", "rb"] = ..., | ||
) -> None: ... | ||
def readlines(self) -> list[str]: ... | ||
def close(self) -> None: ... | ||
|
||
class FileOutput(Output): | ||
mode: ClassVar[Literal["w", "wb"]] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can also be wider; I guess we can use the aliases from |
||
def __getattr__(self, name: str) -> Any: ... # incomplete | ||
|
||
class BinaryFileOutput(FileOutput): ... | ||
|
||
class StringInput(Input): | ||
default_source_path: ClassVar[str] | ||
|
||
class StringOutput(Output): | ||
default_destination_path: ClassVar[str] | ||
destination: Union[str, bytes] # only defined after call to write() | ||
|
||
class NullInput(Input): | ||
default_source_path: ClassVar[str] | ||
def read(self) -> str: ... | ||
|
||
class NullOutput(Output): | ||
default_destination_path: ClassVar[str] | ||
def write(self, data: object) -> None: ... | ||
|
||
class DocTreeInput(Input): | ||
default_source_path: ClassVar[str] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from typing import Any | ||
|
||
def __getattr__(name: str) -> Any: ... # incomplete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
from typing import Any | ||
from typing import Any, ClassVar, Type | ||
|
||
def __getattr__(name: str) -> Any: ... | ||
from docutils import Component | ||
|
||
class Parser(Component): | ||
component_type: ClassVar[str] | ||
config_section: ClassVar[str] | ||
inputstring: Any # defined after call to setup_parse() | ||
document: Any # defined after call to setup_parse() | ||
def parse(self, inputstring: str, document) -> None: ... | ||
def setup_parse(self, inputstring: str, document) -> None: ... | ||
def finish_parse(self) -> None: ... | ||
|
||
_parser_aliases: dict[str, str] | ||
|
||
def get_parser_class(parser_name: str) -> Type[Parser]: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from typing import ClassVar, Tuple | ||
|
||
from docutils import parsers | ||
|
||
class Parser(parsers.Parser): | ||
config_section_dependencies: ClassVar[Tuple[str, ...]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from typing import Any | ||
|
||
def __getattr__(name: str) -> Any: ... # incomplete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,21 @@ | ||
from typing import Any | ||
from typing import Any, ClassVar, Optional, Tuple | ||
from typing_extensions import Literal | ||
|
||
def __getattr__(name: str) -> Any: ... | ||
from docutils import parsers | ||
|
||
class Parser(parsers.Parser): | ||
config_section_dependencies: ClassVar[Tuple[str, ...]] | ||
initial_state: Literal["Body", "RFC2822Body"] | ||
state_classes: Any | ||
inliner: Any | ||
def __init__(self, rfc2822: bool = ..., inliner: Optional[Any] = ...) -> None: ... | ||
|
||
class DirectiveError(Exception): | ||
level: Any | ||
msg: str | ||
def __init__(self, level: Any, message: str) -> None: ... | ||
|
||
class Directive: | ||
def __getattr__(self, name: str) -> Any: ... # incomplete | ||
|
||
def convert_directive_function(directive_fn): ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from typing import Any | ||
|
||
def __getattr__(name: str) -> Any: ... | ||
def __getattr__(name: str) -> Any: ... # incomplete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from typing import Any | ||
|
||
def __getattr__(name: str) -> Any: ... # incomplete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from typing import Any | ||
|
||
def __getattr__(name: str) -> Any: ... # incomplete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from typing import Any | ||
|
||
def __getattr__(name: str) -> Any: ... # incomplete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from typing import Any | ||
|
||
def __getattr__(name: str) -> Any: ... # incomplete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from typing import Any | ||
|
||
def __getattr__(name: str) -> Any: ... # incomplete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from typing import Any | ||
|
||
def __getattr__(name: str) -> Any: ... # incomplete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from collections.abc import Iterable | ||
from typing import Any, Optional | ||
|
||
from docutils.io import FileOutput | ||
|
||
class DependencyList: | ||
list: list[str] | ||
file: Optional[FileOutput] | ||
def __init__(self, output_file: Optional[str] = ..., dependencies: Iterable[str] = ...) -> None: ... | ||
def set_output(self, output_file: Optional[str]) -> None: ... | ||
def add(self, *filenames: str) -> None: ... | ||
def close(self) -> None: ... | ||
|
||
def __getattr__(name: str) -> Any: ... # incomplete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from typing import Any | ||
|
||
def __getattr__(name: str) -> Any: ... # incomplete |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the default but not the only possibility; it also allows
rU
in Python 2 at least.