From d24ec660828bfb84d7f87394df696d5a51f14dfc Mon Sep 17 00:00:00 2001 From: cocoatomo Date: Thu, 15 Mar 2018 08:53:39 +0900 Subject: [PATCH 1/7] Type utils/math --- .../3/docutils/utils/math/__init__.pyi | 2 +- .../3/docutils/utils/math/latex2mathml.pyi | 101 +++++++++--------- 2 files changed, 52 insertions(+), 51 deletions(-) diff --git a/third_party/3/docutils/utils/math/__init__.pyi b/third_party/3/docutils/utils/math/__init__.pyi index c726c5ee3e75..b0e060b8e47b 100644 --- a/third_party/3/docutils/utils/math/__init__.pyi +++ b/third_party/3/docutils/utils/math/__init__.pyi @@ -2,4 +2,4 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -def pick_math_environment(code, numbered: bool = ...): ... +def pick_math_environment(code, numbered: bool = ...) -> str: ... diff --git a/third_party/3/docutils/utils/math/latex2mathml.pyi b/third_party/3/docutils/utils/math/latex2mathml.pyi index 234d03cf2c49..f416b8f71f9d 100644 --- a/third_party/3/docutils/utils/math/latex2mathml.pyi +++ b/third_party/3/docutils/utils/math/latex2mathml.pyi @@ -2,50 +2,51 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Any, Optional - -over: Any -Greek: Any -letters: Any -special: Any -sumintprod: Any -functions: Any -mathbb: Any -mathscr: Any -negatables: Any +from docutils import nodes +from typing import Any, Dict, List, Optional, Text, Tuple, Union + +over: Dict[str, Text] +Greek: Dict[str, Text] +letters: Dict[str, Text] +special: Dict[str, Text] +sumintprod: str +functions: List[str] +mathbb: Dict[str, Text] +mathscr: Dict[str, Text] +negatables: Dict[str, Text] class math: - nchildren: int = ... - children: Any = ... - inline: Any = ... - def __init__(self, children: Optional[Any] = ..., inline: Optional[Any] = ...) -> None: ... - def full(self): ... - def append(self, child): ... - def delete_child(self): ... - def close(self): ... - def xml(self): ... - def xml_start(self): ... - def xml_end(self): ... - def xml_body(self): ... + nchildren: Optional[int] = ... + children: Union[List[nodes.Node], nodes.Node] = ... + inline: Optional[bool] = ... + def __init__(self, children: Optional[Union[List[nodes.Node], nodes.Node]] = ..., inline: Optional[bool] = ...) -> None: ... + def full(self) -> bool: ... + def append(self, child: nodes.Node) -> nodes.Node: ... + def delete_child(self) -> nodes.Node: ... + def close(self) -> nodes.Node: ... + def xml(self) -> List[str]: ... + def xml_start(self) -> List[str]: ... + def xml_end(self) -> List[str]: ... + def xml_body(self) -> List[str]: ... class mrow(math): - def xml_start(self): ... + def xml_start(self) -> List[str]: ... class mtable(math): - def xml_start(self): ... + def xml_start(self) -> List[str]: ... class mtr(mrow): ... class mtd(mrow): ... class mx(math): nchildren: int = ... - data: Any = ... - def __init__(self, data) -> None: ... - def xml_body(self): ... + data: str = ... + def __init__(self, data: str) -> None: ... + def xml_body(self) -> List[str]: ... class mo(mx): - translation: Any = ... - def xml_body(self): ... + translation: Dict[str, str] = ... + def xml_body(self) -> List[str]: ... class mi(mx): ... class mn(mx): ... @@ -67,44 +68,44 @@ class mfrac(math): class msubsup(math): nchildren: int = ... - reversed: Any = ... - def __init__(self, children: Optional[Any] = ..., reversed: bool = ...) -> None: ... - def xml(self): ... + reversed: bool = ... + def __init__(self, children: Optional[Union[List[nodes.Node], nodes.Node]] = ..., reversed: bool = ...) -> None: ... + def xml(self) -> List[str]: ... class mfenced(math): - translation: Any = ... - openpar: Any = ... - def __init__(self, par) -> None: ... - def xml_start(self): ... + translation: Dict[str, Text] = ... + openpar: str = ... + def __init__(self, par: str) -> None: ... + def xml_start(self) -> List[str]: ... class mspace(math): nchildren: int = ... class mstyle(math): - nchildren: Any = ... + nchildren: Optional[int] = ... attrs: Any = ... - def __init__(self, children: Optional[Any] = ..., nchildren: Optional[Any] = ..., **kwargs) -> None: ... - def xml_start(self): ... + def __init__(self, children: Optional[Union[List[nodes.Node], nodes.Node]] = ..., nchildren: Optional[int] = ..., **kwargs: Any) -> None: ... + def xml_start(self) -> List[str]: ... class mover(math): nchildren: int = ... - reversed: Any = ... - def __init__(self, children: Optional[Any] = ..., reversed: bool = ...) -> None: ... - def xml(self): ... + reversed: bool = ... + def __init__(self, children: Optional[Union[List[nodes.Node], nodes.Node]] = ..., reversed: bool = ...) -> None: ... + def xml(self) -> List[str]: ... class munder(math): nchildren: int = ... class munderover(math): nchildren: int = ... - def __init__(self, children: Optional[Any] = ...) -> None: ... + def __init__(self, children: Optional[Union[List[nodes.Node], nodes.Node]] = ...) -> None: ... class mtext(math): nchildren: int = ... - text: Any = ... - def __init__(self, text) -> None: ... - def xml_body(self): ... + text: str = ... + def __init__(self, text: str) -> None: ... + def xml_body(self) -> List[str]: ... -def parse_latex_math(string, inline: bool = ...): ... -def handle_keyword(name, node, string): ... -def tex2mathml(tex_math, inline: bool = ...): ... +def parse_latex_math(string: str, inline: bool = ...) -> math: ... +def handle_keyword(name: str, node: math, string: str) -> Tuple[math, int]: ... +def tex2mathml(tex_math: str, inline: bool = ...) -> str: ... From e7951aef964d2e03e77651ea984894840ebe80f5 Mon Sep 17 00:00:00 2001 From: cocoatomo Date: Tue, 17 Jul 2018 01:13:31 +0900 Subject: [PATCH 2/7] Type utils/math/math2html.py --- .../3/docutils/utils/math/math2html.pyi | 604 +++++++++--------- 1 file changed, 303 insertions(+), 301 deletions(-) diff --git a/third_party/3/docutils/utils/math/math2html.pyi b/third_party/3/docutils/utils/math/math2html.pyi index 30302a2be7db..88588267c624 100644 --- a/third_party/3/docutils/utils/math/math2html.pyi +++ b/third_party/3/docutils/utils/math/math2html.pyi @@ -2,135 +2,135 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Any, Optional +from typing import Any, AnyStr, Callable, ClassVar, Dict, List, MutableSequence, Optional, Sequence, TextIO, Tuple, Type, TypeVar, Union class Trace: debugmode: bool = ... quietmode: bool = ... showlinesmode: bool = ... - prefix: Any = ... - def debug(cls, message): ... - def message(cls, message): ... - def error(cls, message): ... - def fatal(cls, message): ... - def show(cls, message, channel): ... - debug: Any = ... - message: Any = ... - error: Any = ... - fatal: Any = ... - show: Any = ... + prefix: ClassVar[Optional[str]] = ... + def debug(cls: Any, message: str) -> None: ... + def message(cls: Any, message: str) -> None: ... + def error(cls: Any, message: str) -> None: ... + def fatal(cls: Any, message: str) -> None: ... + def show(cls: Any, message: str, channel: TextIO) -> None: ... + debug: classmethod = ... # type: ignore + message: classmethod = ... # type: ignore + error: classmethod = ... # type: ignore + fatal: classmethod = ... # type: ignore + show: classmethod = ... # type: ignore class BibStylesConfig: - abbrvnat: Any = ... - alpha: Any = ... - authordate2: Any = ... - default: Any = ... - defaulttags: Any = ... - ieeetr: Any = ... - plain: Any = ... - vancouver: Any = ... + abbrvnat: Dict[str, str] = ... + alpha: Dict[str, str] = ... + authordate2: Dict[str, str] = ... + default: Dict[str, str] = ... + defaulttags: Dict[str, str] = ... + ieeetr: Dict[str, str] = ... + plain: Dict[str, str] = ... + vancouver: Dict[str, str] = ... class BibTeXConfig: - replaced: Any = ... + replaced: Dict[str, str] = ... class ContainerConfig: - endings: Any = ... - extracttext: Any = ... - startendings: Any = ... - starts: Any = ... - string: Any = ... - table: Any = ... + endings: Dict[str, str] = ... + extracttext: Dict[str, str] = ... + startendings: Dict[str, str] = ... + starts: Dict[str, str] = ... + string: Dict[str, str] = ... + table: Dict[str, List[str]] = ... class EscapeConfig: - chars: Any = ... - commands: Any = ... - entities: Any = ... - html: Any = ... - iso885915: Any = ... - nonunicode: Any = ... + chars: Dict[str, str] = ... + commands: Dict[str, str] = ... + entities: Dict[str, str] = ... + html: Dict[str, str] = ... + iso885915: Dict[str, str] = ... + nonunicode: Dict[str, str] = ... class FormulaConfig: - alphacommands: Any = ... - array: Any = ... - bigbrackets: Any = ... - bigsymbols: Any = ... - bracketcommands: Any = ... - combiningfunctions: Any = ... - commands: Any = ... - decoratedcommand: Any = ... - decoratingfunctions: Any = ... - endings: Any = ... - environments: Any = ... - fontfunctions: Any = ... - hybridfunctions: Any = ... - hybridsizes: Any = ... - labelfunctions: Any = ... - limitcommands: Any = ... - misccommands: Any = ... - modified: Any = ... - onefunctions: Any = ... - spacedcommands: Any = ... - starts: Any = ... - symbolfunctions: Any = ... - textfunctions: Any = ... - unmodified: Any = ... - urls: Any = ... + alphacommands: Dict[str, str] = ... + array: Dict[str, str] = ... + bigbrackets: Dict[str, List[str]] = ... + bigsymbols: Dict[str, List[str]] = ... + bracketcommands: Dict[str, str] = ... + combiningfunctions: Dict[str, str] = ... + commands: Dict[str, str] = ... + decoratedcommand: Dict[Any, Any] = ... + decoratingfunctions: Dict[str, str] = ... + endings: Dict[str, str] = ... + environments: Dict[str, List[str]] = ... + fontfunctions: Dict[str, str] = ... + hybridfunctions: Dict[str, List[str]] = ... + hybridsizes: Dict[str, str] = ... + labelfunctions: Dict[str, str] = ... + limitcommands: Dict[str, str] = ... + misccommands: Dict[str, str] = ... + modified: Dict[str, str] = ... + onefunctions: Dict[str, str] = ... + spacedcommands: Dict[str, str] = ... + starts: Dict[str, str] = ... + symbolfunctions: Dict[str, str] = ... + textfunctions: Dict[str, str] = ... + unmodified: Dict[str, List[str]] = ... + urls: Dict[str, str] = ... class GeneralConfig: - version: Any = ... + version: Dict[str, str] = ... class HeaderConfig: - parameters: Any = ... - styles: Any = ... + parameters: Dict[str, str] = ... + styles: Dict[str, List[str]] = ... class ImageConfig: - converters: Any = ... - cropboxformats: Any = ... - formats: Any = ... + converters: Dict[str, str] = ... + cropboxformats: Dict[str, str] = ... + formats: Dict[str, Union[str, List[str]]] = ... class LayoutConfig: - groupable: Any = ... + groupable: Dict[str, List[str]] = ... class NewfangleConfig: - constants: Any = ... + constants: Dict[str, str] = ... class NumberingConfig: - layouts: Any = ... - sequence: Any = ... + layouts: Dict[str, List[str]] = ... + sequence: Dict[str, List[str]] = ... class StyleConfig: - hspaces: Any = ... - quotes: Any = ... - referenceformats: Any = ... - size: Any = ... - vspaces: Any = ... + hspaces: Dict[str, str] = ... + quotes: Dict[str, str] = ... + referenceformats: Dict[str, str] = ... + size: Dict[str, List[str]] = ... + vspaces: Dict[str, str] = ... class TOCConfig: - extractplain: Any = ... - extracttitle: Any = ... + extractplain: Dict[str, List[str]] = ... + extracttitle: Dict[str, List[str]] = ... class TagConfig: - barred: Any = ... - family: Any = ... - flex: Any = ... - group: Any = ... - layouts: Any = ... - listitems: Any = ... - notes: Any = ... - script: Any = ... - shaped: Any = ... + barred: Dict[str, str] = ... + family: Dict[str, str] = ... + flex: Dict[str, str] = ... + group: Dict[str, List[str]] = ... + layouts: Dict[str, str] = ... + listitems: Dict[str, str] = ... + notes: Dict[str, str] = ... + script: Dict[str, str] = ... + shaped: Dict[str, str] = ... class TranslationConfig: - constants: Any = ... - languages: Any = ... + constants: Dict[str, str] = ... + languages: Dict[str, str] = ... class CommandLineParser: - options: Any = ... - def __init__(self, options) -> None: ... - def parseoptions(self, args): ... - def readoption(self, args): ... - def readquoted(self, args, initial): ... - def readequalskey(self, arg, args): ... + options: Type[Options] = ... + def __init__(self, options: Type[Options]) -> None: ... + def parseoptions(self, args: Sequence[str]) -> Optional[str]: ... + def readoption(self, args: Sequence[str]) -> Tuple[str, Union[str, bool, None]]: ... + def readquoted(self, args: Sequence[str], initial: str): ... + def readequalskey(self, arg: str, args: MutableSequence[str]) -> str: ... class Options: instance: Any = ... @@ -147,13 +147,13 @@ class Options: showlines: bool = ... str: bool = ... iso885915: bool = ... - css: Any = ... - favicon: str = ... + css: List[Any] = ... + favicon: __builtins__.str = ... title: Any = ... directory: Any = ... destdirectory: Any = ... toc: bool = ... - toctarget: str = ... + toctarget: __builtins__.str = ... tocfor: Any = ... forceformat: Any = ... lyxformat: bool = ... @@ -162,7 +162,7 @@ class Options: memory: bool = ... lowmem: bool = ... nobib: bool = ... - converter: str = ... + converter: __builtins__.str = ... raw: bool = ... jsmath: Any = ... mathjax: Any = ... @@ -179,283 +179,285 @@ class Options: endfoot: bool = ... supfoot: bool = ... alignfoot: bool = ... - footnotes: Any = ... - imageformat: Any = ... + footnotes: Optional[__builtins__.str] = ... + imageformat: Optional[__builtins__.str] = ... copyimages: bool = ... googlecharts: bool = ... - embedcss: Any = ... - branches: Any = ... - def parseoptions(self, args): ... - def processoptions(self): ... - def usage(self): ... - def parsefootnotes(self): ... - def showoptions(self): ... - def showversion(self): ... - def showhardversion(self): ... - def showversiondate(self): ... - def showlyxformat(self): ... + embedcss: List[Any] = ... + branches: Dict[Any, Any] = ... + def parseoptions(self, args: MutableSequence[__builtins__.str]) -> None: ... + def processoptions(self) -> None: ... + def usage(self) -> None: ... + def parsefootnotes(self) -> None: ... + def showoptions(self) -> None: ... + def showversion(self) -> None: ... + def showhardversion(self) -> None: ... + def showversiondate(self) -> None: ... + def showlyxformat(self) -> None: ... class BranchOptions: - name: Any = ... - options: Any = ... - def __init__(self, name) -> None: ... - def set(self, key, value): ... - def isselected(self): ... - def __unicode__(self): ... + name: str = ... + options: Dict[str, str] = ... + def __init__(self, name: str) -> None: ... + def set(self, key: str, value: str): ... + def isselected(self) -> bool: ... + def __unicode__(self) -> str: ... + +C = TypeVar('C') class Cloner: - def clone(cls, original): ... - def create(cls, type): ... - clone: Any = ... - create: Any = ... + def clone(cls: Any, original: C) -> C: ... + def create(cls: Any, type: Type[C]) -> C: ... + clone: classmethod = ... # type: ignore + create: classmethod = ... # type: ignore class ContainerExtractor: - allowed: Any = ... - cloned: Any = ... - extracted: Any = ... - def __init__(self, config) -> None: ... - def extract(self, container): ... - def process(self, container, list): ... - def safeclone(self, container): ... + allowed: List[str] = ... + cloned: List[str] = ... + extracted: List[str] = ... + def __init__(self, config: Dict[str, List[str]]) -> None: ... + def extract(self, container: Container) -> List[Container]: ... + def process(self, container: Container, list: List[Container]) -> None: ... + def safeclone(self, container: Container) -> Container: ... class Parser: begin: int = ... - parameters: Any = ... + parameters: Dict[str, Union[Dict[str, str], bool, str]] = ... def __init__(self) -> None: ... - def parseheader(self, reader): ... - def parseparameter(self, reader): ... - def parsexml(self, reader): ... - def parseending(self, reader, process): ... - def parsecontainer(self, reader, contents): ... - def __unicode__(self): ... + def parseheader(self, reader: LineReader) -> List[str]: ... + def parseparameter(self, reader: LineReader) -> None: ... + def parsexml(self, reader: LineReader) -> Tuple[str, Dict[str, str]]: ... + def parseending(self, reader: LineReader, process: Callable[..., None]) -> None: ... + def parsecontainer(self, reader: LineReader, contents: List[Container]) -> None: ... + def __unicode__(self) -> str: ... class LoneCommand(Parser): - def parse(self, reader): ... + def parse(self, reader) -> List[Any]: ... class TextParser(Parser): - stack: Any = ... - ending: Any = ... - endings: Any = ... - def __init__(self, container) -> None: ... - def parse(self, reader): ... - def isending(self, reader): ... + stack: List[str] = ... + ending: str = ... + endings: List[str] = ... + def __init__(self, container: Container) -> None: ... + def parse(self, reader) -> List[Container]: ... + def isending(self, reader) -> bool: ... class ExcludingParser(Parser): - def parse(self, reader): ... + def parse(self, reader: LineReader) -> List[Container]: ... class BoundedParser(ExcludingParser): - def parse(self, reader): ... + def parse(self, reader: LineReader) -> List[Container]: ... class BoundedDummy(Parser): - def parse(self, reader): ... + def parse(self, reader: LineReader) -> List[Container]: ... class StringParser(Parser): - begin: Any = ... - def parseheader(self, reader): ... - def parse(self, reader): ... + begin: int = ... + def parseheader(self, reader: LineReader) -> List[Any]: ... + def parse(self, reader: LineReader) -> List[Container]: ... class InsetParser(BoundedParser): - def parse(self, reader): ... + def parse(self, reader: LineReader) -> List[Container]: ... class ContainerOutput: - def gethtml(self, container): ... - def isempty(self): ... + def gethtml(self, container: Container) -> Any: ... + def isempty(self) -> bool: ... class EmptyOutput(ContainerOutput): - def gethtml(self, container): ... - def isempty(self): ... + def gethtml(self, container: Container) -> List[Any]: ... + def isempty(self) -> bool: ... class FixedOutput(ContainerOutput): - def gethtml(self, container): ... + def gethtml(self, container: Container) -> List[AnyStr]: ... class ContentsOutput(ContainerOutput): - def gethtml(self, container): ... + def gethtml(self, container: Container) -> List[AnyStr]: ... class TaggedOutput(ContentsOutput): tag: Any = ... breaklines: bool = ... empty: bool = ... - def settag(self, tag, breaklines: bool = ..., empty: bool = ...): ... - def setbreaklines(self, breaklines): ... - def gethtml(self, container): ... - def open(self, container): ... - def close(self, container): ... - def selfclosing(self, container): ... - def checktag(self): ... + def settag(self, tag, breaklines: bool = ..., empty: bool = ...) -> TaggedOutput: ... + def setbreaklines(self, breaklines: bool) -> TaggedOutput: ... + def gethtml(self, container: Container) -> List[AnyStr]: ... + def open(self, container: Container) -> str: ... + def close(self, container: Container) -> str: ... + def selfclosing(self, container: Container) -> str: ... + def checktag(self) -> bool: ... class FilteredOutput(ContentsOutput): - filters: Any = ... + filters: List[Tuple[str, str]] = ... def __init__(self) -> None: ... - def addfilter(self, original, replacement): ... - def gethtml(self, container): ... - def filter(self, line): ... + def addfilter(self, original: str, replacement: str) -> None: ... + def gethtml(self, container: Container) -> List[AnyStr]: ... + def filter(self, line: AnyStr) -> AnyStr: ... class StringOutput(ContainerOutput): - def gethtml(self, container): ... + def gethtml(self, container: Container) -> List[AnyStr]: ... class LineReader: - file: Any = ... + file: TextIO = ... linenumber: int = ... - lastline: Any = ... - current: Any = ... + lastline: Optional[int] = ... + current: Optional[str] = ... mustread: bool = ... depleted: bool = ... - def __init__(self, filename) -> None: ... - def setstart(self, firstline): ... - def setend(self, lastline): ... - def currentline(self): ... - def nextline(self): ... - def readline(self): ... - def finished(self): ... - def close(self): ... + def __init__(self, filename: Union[TextIO, str]) -> None: ... + def setstart(self, firstline: int) -> None: ... + def setend(self, lastline: Optional[int]) -> None: ... + def currentline(self) -> Optional[str]: ... + def nextline(self) -> None: ... + def readline(self) -> None: ... + def finished(self) -> bool: ... + def close(self) -> None: ... class LineWriter: file: bool = ... - filename: Any = ... - def __init__(self, filename) -> None: ... - def write(self, strings): ... - def writestring(self, string): ... - def writeline(self, line): ... - def close(self): ... + filename: Optional[str] = ... + def __init__(self, filename: Union[TextIO, str]) -> None: ... + def write(self, strings: Sequence[str]) -> None: ... + def writestring(self, string: str) -> None: ... + def writeline(self, line: str) -> None: ... + def close(self) -> None: ... class Globable: leavepending: bool = ... - endinglist: Any = ... + endinglist: EndingList = ... def __init__(self) -> None: ... - def checkbytemark(self): ... - def isout(self): ... - def current(self): ... - def checkfor(self, string): ... - def finished(self): ... - def skipcurrent(self): ... - def glob(self, currentcheck): ... - def globalpha(self): ... - def globnumber(self): ... - def isidentifier(self): ... - def globidentifier(self): ... - def isvalue(self): ... - def globvalue(self): ... - def skipspace(self): ... - def globincluding(self, magicchar): ... - def globexcluding(self, excluded): ... - def pushending(self, ending, optional: bool = ...): ... - def popending(self, expected: Optional[Any] = ...): ... - def nextending(self): ... + def checkbytemark(self) -> None: ... + def isout(self) -> bool: ... + def current(self) -> str: ... + def checkfor(self, string: str) -> bool: ... + def finished(self) -> bool: ... + def skipcurrent(self) -> str: ... + def glob(self, currentcheck: Callable[[], bool]) -> str: ... + def globalpha(self) -> str: ... + def globnumber(self) -> str: ... + def isidentifier(self) -> bool: ... + def globidentifier(self) -> str: ... + def isvalue(self) -> bool: ... + def globvalue(self) -> str: ... + def skipspace(self) -> str: ... + def globincluding(self, magicchar: str) -> str: ... + def globexcluding(self, excluded: str) -> str: ... + def pushending(self, ending: str, optional: bool = ...) -> None: ... + def popending(self, expected: Optional[str] = ...) -> Optional[str]: ... + def nextending(self) -> Optional[str]: ... class EndingList: - endings: Any = ... + endings: List[PositionEnding] = ... def __init__(self) -> None: ... - def add(self, ending, optional: bool = ...): ... - def pickpending(self, pos): ... - def checkin(self, pos): ... - def pop(self, pos): ... - def findending(self, pos): ... - def checkpending(self): ... - def __unicode__(self): ... + def add(self, ending: str, optional: bool = ...) -> None: ... + def pickpending(self, pos: Position) -> None: ... + def checkin(self, pos: Position) -> bool: ... + def pop(self, pos: Position) -> str: ... + def findending(self, pos: Position) -> Optional[str]: ... + def checkpending(self) -> None: ... + def __unicode__(self) -> str: ... class PositionEnding: - ending: Any = ... - optional: Any = ... - def __init__(self, ending, optional) -> None: ... - def checkin(self, pos): ... - def __unicode__(self): ... + ending: str = ... + optional: bool = ... + def __init__(self, ending: str, optional: bool) -> None: ... + def checkin(self, pos: Position) -> bool: ... + def __unicode__(self) -> str: ... class Position(Globable): def __init__(self) -> None: ... - def skip(self, string): ... - def identifier(self): ... - def extract(self, length): ... - def checkfor(self, string): ... - def checkforlower(self, string): ... - def skipcurrent(self): ... - def __next__(self): ... - def checkskip(self, string): ... - def error(self, message): ... + def skip(self, string: str) -> None: ... + def identifier(self) -> str: ... + def extract(self, length: int) -> Optional[str]: ... + def checkfor(self, string: str) -> bool: ... + def checkforlower(self, string: str) -> bool: ... + def skipcurrent(self) -> str: ... + def __next__(self) -> str: ... + def checkskip(self, string: str) -> bool: ... + def error(self, message: str) -> None: ... class TextPosition(Position): pos: int = ... - text: Any = ... - def __init__(self, text) -> None: ... - def skip(self, string): ... - def identifier(self): ... - def isout(self): ... - def current(self): ... - def extract(self, length): ... + text: str = ... + def __init__(self, text: str) -> None: ... + def skip(self, string: str) -> None: ... + def identifier(self) -> str: ... + def isout(self) -> bool: ... + def current(self) -> str: ... + def extract(self, length) -> Optional[str]: ... class FilePosition(Position): - reader: Any = ... + reader: LineReader = ... pos: int = ... - def __init__(self, filename) -> None: ... - def skip(self, string): ... - def currentline(self): ... - def nextline(self): ... - def linenumber(self): ... - def identifier(self): ... - def isout(self): ... - def current(self): ... - def extract(self, length): ... + def __init__(self, filename: Union[TextIO, str]) -> None: ... + def skip(self, string: str) -> None: ... + def currentline(self) -> Optional[str]: ... + def nextline(self) -> None: ... + def linenumber(self) -> int: ... + def identifier(self) -> str: ... + def isout(self) -> bool: ... + def current(self) -> str: ... + def extract(self, length: int) -> str: ... class Container: partkey: Any = ... parent: Any = ... begin: Any = ... - contents: Any = ... + contents: List[Any] = ... def __init__(self) -> None: ... - def process(self): ... - def gethtml(self): ... - def escapeall(self, lines): ... - def escape(self, line, replacements: Any = ...): ... - def escapeentities(self, line): ... - def searchall(self, type): ... - def searchremove(self, type): ... - def searchprocess(self, type, process): ... - def locateprocess(self, locate, process): ... - def recursivesearch(self, locate, recursive, process): ... - def extracttext(self): ... - def group(self, index, group, isingroup): ... - def remove(self, index): ... - def tree(self, level: int = ...): ... - def getparameter(self, name): ... - def getparameterlist(self, name): ... - def hasemptyoutput(self): ... - def __unicode__(self): ... + def process(self) -> None: ... + def gethtml(self) -> List[str]: ... + def escapeall(self, lines: Sequence[str]) -> List[str]: ... + def escape(self, line: str, replacements: Dict[str, str] = ...) -> str: ... + def escapeentities(self, line: str) -> str: ... + def searchall(self, type: Type) -> List[Container]: ... + def searchremove(self, type: Type) -> List[Container]: ... + def searchprocess(self, type: Type, process: Callable[[Container], List[Container]]) -> None: ... + def locateprocess(self, locate: Callable[[Container], bool], process: Callable[[Container], List[Container]]) -> None: ... + def recursivesearch(self, locate: Callable[[Container], bool], recursive: Callable[[Container], bool], process: Callable[[Container], None]) -> None: ... + def extracttext(self) -> str: ... + def group(self, index: int, group, isingroup: Callable[[Any], bool]) -> None: ... + def remove(self, index: int) -> None: ... + def tree(self, level: int = ...) -> None: ... + def getparameter(self, name: str) -> str: ... + def getparameterlist(self, name: str) -> List[str]: ... + def hasemptyoutput(self) -> bool: ... + def __unicode__(self) -> str: ... class BlackBox(Container): - parser: Any = ... - output: Any = ... - contents: Any = ... + parser: LoneCommand = ... + output: EmptyOutput = ... + contents: List[Any] = ... def __init__(self) -> None: ... class LyXFormat(BlackBox): - def process(self): ... + def process(self) -> None: ... class StringContainer(Container): parsed: Any = ... - parser: Any = ... - output: Any = ... + parser: StringParser = ... + output: StringOutput = ... string: str = ... def __init__(self) -> None: ... - def process(self): ... - def replacespecial(self, line): ... - def changeline(self, line): ... - def extracttext(self): ... - def __unicode__(self): ... + def process(self) -> None: ... + def replacespecial(self, line: str) -> str: ... + def changeline(self, line: str) -> str: ... + def extracttext(self) -> str: ... + def __unicode__(self) -> str: ... class Constant(StringContainer): - contents: Any = ... - string: Any = ... - output: Any = ... - def __init__(self, text) -> None: ... - def __unicode__(self): ... + contents: List[Any] = ... + string: str = ... + output: StringOutput = ... + def __init__(self, text: str) -> None: ... + def __unicode__(self) -> str: ... class TaggedText(Container): - output: Any = ... - parser: Any = ... + output: TaggedOutput = ... + parser: TextParser = ... def __init__(self) -> None: ... - contents: Any = ... - def complete(self, contents, tag, breaklines: bool = ...): ... - def constant(self, text, tag, breaklines: bool = ...): ... - def __unicode__(self): ... + contents: List[Constant] = ... + def complete(self, contents: List[Constant], tag: str, breaklines: bool = ...): ... + def constant(self, text: str, tag: str, breaklines: bool = ...): ... + def __unicode__(self) -> str: ... class DocumentParameters: pdftitle: Any = ... @@ -469,31 +471,31 @@ class DocumentParameters: displaymode: bool = ... class FormulaParser(Parser): - begin: Any = ... + begin: int = ... def parseheader(self, reader): ... - def parsetype(self, reader): ... - def parse(self, reader): ... - def parseformula(self, reader): ... - def parsesingleliner(self, reader, start, ending): ... - def parsemultiliner(self, reader, start, ending): ... + def parsetype(self, reader: LineReader) -> Optional[str]: ... + def parse(self, reader: LineReader) -> str: ... + def parseformula(self, reader: LineReader) -> str: ... + def parsesingleliner(self, reader: LineReader, start: str, ending: str) -> str: ... + def parsemultiliner(self, reader: LineReader, start: str, ending: str) -> str: ... class MacroParser(FormulaParser): - begin: Any = ... - def parseheader(self, reader): ... - def parse(self, reader): ... + begin: int = ... + def parseheader(self, reader: LineReader) -> List[str]: ... + def parse(self, reader: LineReader) -> str: ... class FormulaBit(Container): type: Any = ... size: int = ... original: str = ... - contents: Any = ... - output: Any = ... + contents: List[FormulaBit] = ... + output: ContentsOutput = ... def __init__(self) -> None: ... - factory: Any = ... - def setfactory(self, factory): ... - def add(self, bit): ... - def skiporiginal(self, string, pos): ... - def computesize(self): ... + factory: FormulaFactory = ... + def setfactory(self, factory: FormulaFactory) -> FormulaBit: ... + def add(self, bit: FormulaBit): ... + def skiporiginal(self, string: str, pos: Position) -> None: ... + def computesize(self) -> int: ... def clone(self): ... def __unicode__(self): ... @@ -684,8 +686,8 @@ class ContainerSize: maxwidth: Any = ... maxheight: Any = ... scale: Any = ... - def set(self, width: Optional[Any] = ..., height: Optional[Any] = ...): ... - def setmax(self, maxwidth: Optional[Any] = ..., maxheight: Optional[Any] = ...): ... + def set(self, width: Any = ..., height: Any = ...): ... + def setmax(self, maxwidth: Any = ..., maxheight: Any = ...): ... def readparameters(self, container): ... def setparameter(self, container, name): ... def setvalue(self, name, value): ... @@ -811,7 +813,7 @@ class Link(Container): parser: Any = ... output: Any = ... def __init__(self) -> None: ... - def complete(self, text, anchor: Optional[Any] = ..., url: Optional[Any] = ..., type: Optional[Any] = ..., title: Optional[Any] = ...): ... + def complete(self, text, anchor: Any = ..., url: Any = ..., type: Any = ..., title: Any = ...): ... def computedestination(self): ... def setmutualdestination(self, destination): ... def __unicode__(self): ... From 6689fa4cdfd0d74552b3a71d3a0294404f5124bc Mon Sep 17 00:00:00 2001 From: cocoatomo Date: Wed, 18 Jul 2018 00:55:14 +0900 Subject: [PATCH 3/7] Fix flake8 error: Y001 Name of private TypeVar must start with _ --- third_party/3/docutils/utils/math/math2html.pyi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/third_party/3/docutils/utils/math/math2html.pyi b/third_party/3/docutils/utils/math/math2html.pyi index 88588267c624..8bf71d4bea84 100644 --- a/third_party/3/docutils/utils/math/math2html.pyi +++ b/third_party/3/docutils/utils/math/math2html.pyi @@ -203,11 +203,11 @@ class BranchOptions: def isselected(self) -> bool: ... def __unicode__(self) -> str: ... -C = TypeVar('C') +_C = TypeVar('_C') class Cloner: - def clone(cls: Any, original: C) -> C: ... - def create(cls: Any, type: Type[C]) -> C: ... + def clone(cls: Any, original: _C) -> _C: ... + def create(cls: Any, type: Type[_C]) -> _C: ... clone: classmethod = ... # type: ignore create: classmethod = ... # type: ignore From 9e4df0e280b5fb93f3494312597d8ddcab3d0c8d Mon Sep 17 00:00:00 2001 From: cocoatomo Date: Sun, 26 Aug 2018 22:58:30 +0900 Subject: [PATCH 4/7] Type roughly --- .../3/docutils/utils/math/math2html.pyi | 899 +++++++++--------- 1 file changed, 452 insertions(+), 447 deletions(-) diff --git a/third_party/3/docutils/utils/math/math2html.pyi b/third_party/3/docutils/utils/math/math2html.pyi index 8bf71d4bea84..fcd07388a3e3 100644 --- a/third_party/3/docutils/utils/math/math2html.pyi +++ b/third_party/3/docutils/utils/math/math2html.pyi @@ -2,7 +2,8 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Any, AnyStr, Callable, ClassVar, Dict, List, MutableSequence, Optional, Sequence, TextIO, Tuple, Type, TypeVar, Union +from gettext import NullTranslations +from typing import Any, AnyStr, Callable, ClassVar, Dict, Iterator, List, MutableSequence, Optional, overload, Sequence, TextIO, Tuple, Type, TypeVar, Union class Trace: debugmode: bool = ... @@ -129,12 +130,12 @@ class CommandLineParser: def __init__(self, options: Type[Options]) -> None: ... def parseoptions(self, args: Sequence[str]) -> Optional[str]: ... def readoption(self, args: Sequence[str]) -> Tuple[str, Union[str, bool, None]]: ... - def readquoted(self, args: Sequence[str], initial: str): ... + def readquoted(self, args: Sequence[str], initial: str) -> Optional[str]: ... def readequalskey(self, arg: str, args: MutableSequence[str]) -> str: ... class Options: instance: Any = ... - location: Any = ... + location: str = ... nocopy: bool = ... copyright: bool = ... debug: bool = ... @@ -184,7 +185,7 @@ class Options: copyimages: bool = ... googlecharts: bool = ... embedcss: List[Any] = ... - branches: Dict[Any, Any] = ... + branches: Dict[__builtins__.str, BranchOptions] = ... def parseoptions(self, args: MutableSequence[__builtins__.str]) -> None: ... def processoptions(self) -> None: ... def usage(self) -> None: ... @@ -199,26 +200,28 @@ class BranchOptions: name: str = ... options: Dict[str, str] = ... def __init__(self, name: str) -> None: ... - def set(self, key: str, value: str): ... + def set(self, key: str, value: str) -> None: ... def isselected(self) -> bool: ... def __unicode__(self) -> str: ... -_C = TypeVar('_C') +_Class = TypeVar('_Class') class Cloner: - def clone(cls: Any, original: _C) -> _C: ... - def create(cls: Any, type: Type[_C]) -> _C: ... + def clone(cls: Any, original: _Class) -> _Class: ... + def create(cls: Any, type: Type[_Class]) -> _Class: ... clone: classmethod = ... # type: ignore create: classmethod = ... # type: ignore +_Container = TypeVar('_Container', bound=Container) + class ContainerExtractor: allowed: List[str] = ... cloned: List[str] = ... extracted: List[str] = ... def __init__(self, config: Dict[str, List[str]]) -> None: ... def extract(self, container: Container) -> List[Container]: ... - def process(self, container: Container, list: List[Container]) -> None: ... - def safeclone(self, container: Container) -> Container: ... + def process(self, container: Container, list: MutableSequence[Container]) -> None: ... + def safeclone(self, container: _Container) -> _Container: ... class Parser: begin: int = ... @@ -274,10 +277,10 @@ class ContentsOutput(ContainerOutput): def gethtml(self, container: Container) -> List[AnyStr]: ... class TaggedOutput(ContentsOutput): - tag: Any = ... + tag: Optional[str] = ... breaklines: bool = ... empty: bool = ... - def settag(self, tag, breaklines: bool = ..., empty: bool = ...) -> TaggedOutput: ... + def settag(self, tag: str, breaklines: bool = ..., empty: bool = ...) -> TaggedOutput: ... def setbreaklines(self, breaklines: bool) -> TaggedOutput: ... def gethtml(self, container: Container) -> List[AnyStr]: ... def open(self, container: Container) -> str: ... @@ -451,7 +454,7 @@ class Constant(StringContainer): def __unicode__(self) -> str: ... class TaggedText(Container): - output: TaggedOutput = ... + output: ContentsOutput = ... parser: TextParser = ... def __init__(self) -> None: ... contents: List[Constant] = ... @@ -488,7 +491,7 @@ class FormulaBit(Container): type: Any = ... size: int = ... original: str = ... - contents: List[FormulaBit] = ... + contents: List[Any] = ... output: ContentsOutput = ... def __init__(self) -> None: ... factory: FormulaFactory = ... @@ -496,310 +499,312 @@ class FormulaBit(Container): def add(self, bit: FormulaBit): ... def skiporiginal(self, string: str, pos: Position) -> None: ... def computesize(self) -> int: ... - def clone(self): ... - def __unicode__(self): ... + def clone(self) -> FormulaBit: ... + def __unicode__(self) -> str: ... class TaggedBit(FormulaBit): - output: Any = ... - def constant(self, constant, tag): ... - contents: Any = ... - def complete(self, contents, tag, breaklines: bool = ...): ... - def selfcomplete(self, tag): ... + output: TaggedOutput = ... + def constant(self, constant: str, tag: str) -> TaggedBit: ... + contents: List[FormulaBit] = ... + def complete(self, contents: List[FormulaBit], tag: str, breaklines: bool = ...) -> TaggedBit: ... + def selfcomplete(self, tag: str) -> TaggedBit: ... class FormulaConstant(Constant): - original: Any = ... + original: str = ... size: int = ... type: Any = ... - def __init__(self, string) -> None: ... - def computesize(self): ... - def clone(self): ... - def __unicode__(self): ... + def __init__(self, string: str) -> None: ... + def computesize(self) -> int: ... + def clone(self) -> FormulaConstant: ... + def __unicode__(self) -> str: ... class RawText(FormulaBit): - def detect(self, pos): ... + def detect(self, pos: Position) -> bool: ... type: str = ... - def parsebit(self, pos): ... + def parsebit(self, pos: Position) -> None: ... class FormulaSymbol(FormulaBit): - modified: Any = ... - unmodified: Any = ... - def detect(self, pos): ... - def parsebit(self, pos): ... - def addsymbol(self, symbol, pos): ... + modified: Dict[str, str] = ... + unmodified: List[str] = ... + def detect(self, pos: Position) -> bool: ... + def parsebit(self, pos: Position) -> None: ... + def addsymbol(self, symbol, pos: Position) -> None: ... class FormulaNumber(FormulaBit): - def detect(self, pos): ... + def detect(self, pos: Position) -> bool: ... type: str = ... - def parsebit(self, pos): ... + def parsebit(self, pos: Position) -> None: ... class Comment(FormulaBit): - start: Any = ... - def detect(self, pos): ... - def parsebit(self, pos): ... + start: str = ... + def detect(self, pos: Position) -> bool: ... + def parsebit(self, pos: Position) -> None: ... class WhiteSpace(FormulaBit): - def detect(self, pos): ... - def parsebit(self, pos): ... - def __unicode__(self): ... + def detect(self, pos: Position) -> bool: ... + def parsebit(self, pos: Position) -> None: ... + def __unicode__(self) -> str: ... class Bracket(FormulaBit): - start: Any = ... - ending: Any = ... + start: str = ... + ending: str = ... inner: Any = ... def __init__(self) -> None: ... - def detect(self, pos): ... - def parsebit(self, pos): ... - def parsetext(self, pos): ... - def parseliteral(self, pos): ... - def parsecomplete(self, pos, innerparser): ... - def innerformula(self, pos): ... - def innertext(self, pos): ... + def detect(self, pos: Position) -> bool: ... + def parsebit(self, pos: Position) -> Bracket: ... + def parsetext(self, pos: Position) -> Bracket: ... + def parseliteral(self, pos: Position) -> Bracket: ... + def parsecomplete(self, pos: Position, innerparser: Callable[[Position], None]) -> None: ... + def innerformula(self, pos: Position) -> None: ... + def innertext(self, pos: Position) -> None: ... literal: str = ... - def innerliteral(self, pos): ... + def innerliteral(self, pos: Position) -> None: ... class SquareBracket(Bracket): - start: Any = ... - ending: Any = ... - def clone(self): ... + start: str = ... + ending: str = ... + def clone(self) -> SquareBracket: ... class MathsProcessor: - def process(self, contents, index): ... - def __unicode__(self): ... + def process(self, contents, index) -> None: ... + def __unicode__(self) -> str: ... class FormulaProcessor: - processors: Any = ... - def process(self, bit): ... - def processcontents(self, bit): ... - def processinsides(self, bit): ... - def traversewhole(self, formula): ... - def traverse(self, bit): ... - def italicize(self, bit, contents): ... + processors: List[MathsProcessor] = ... + def process(self, bit: FormulaBit) -> None: ... + def processcontents(self, bit: FormulaBit) -> None: ... + def processinsides(self, bit: FormulaBit) -> None: ... + def traversewhole(self, formula: FormulaBit) -> None: ... + def traverse(self, bit: FormulaBit) -> Iterator[Tuple[FormulaBit, List[FormulaBit]]]: ... + def italicize(self, bit: FormulaBit, contents) -> None: ... class Formula(Container): - parser: Any = ... - output: Any = ... + parser: FormulaParser = ... + output: TaggedOutput = ... def __init__(self) -> None: ... - def process(self): ... - contents: Any = ... - def jsmath(self): ... - def mathjax(self): ... - def googlecharts(self): ... - def classic(self): ... - def parse(self, pos): ... - header: Any = ... - def parsedollarinline(self, pos): ... - def parsedollarblock(self, pos): ... - parsed: Any = ... - def parsedollar(self, pos): ... - def parseinlineto(self, pos, limit): ... - def parseblockto(self, pos, limit): ... - def parseupto(self, pos, limit): ... - def __unicode__(self): ... + def process(self) -> None: ... + contents: List[Any] = ... + def jsmath(self) -> None: ... + def mathjax(self) -> None: ... + def googlecharts(self) -> None: ... + def classic(self) -> None: ... + def parse(self, pos: Position) -> Formula: ... + header: List[str] = ... + def parsedollarinline(self, pos: Position) -> None: ... + def parsedollarblock(self, pos: Position) -> None: ... + parsed: str = ... + def parsedollar(self, pos: Position) -> None: ... + def parseinlineto(self, pos: Position, limit: str) -> None: ... + def parseblockto(self, pos: Position, limit: str) -> None: ... + def parseupto(self, pos: Position, limit: str) -> None: ... + def __unicode__(self) -> str: ... class WholeFormula(FormulaBit): - def detect(self, pos): ... - def parsebit(self, pos): ... + def detect(self, pos: Position) -> bool: ... + def parsebit(self, pos: Position) -> None: ... + +_FB = TypeVar('_FB', bound=FormulaBit) class FormulaFactory: - types: Any = ... - skippedtypes: Any = ... + types: List[Type[FormulaBit]] = ... + skippedtypes: List[Type[FormulaBit]] = ... defining: bool = ... - instances: Any = ... + instances: Dict[Type[FormulaBit], FormulaBit] = ... def __init__(self) -> None: ... - def detecttype(self, type, pos): ... - def instance(self, type): ... - def create(self, type): ... - def clearskipped(self, pos): ... - def skipany(self, pos): ... - def parseany(self, pos): ... - def parsetype(self, type, pos): ... - def parseformula(self, formula): ... + def detecttype(self, type: Type[_FB], pos: Position) -> _FB: ... + def instance(self, type: Type[_FB]) -> _FB: ... + def create(self, type: Type[_FB]) -> _FB: ... + def clearskipped(self, pos: Position) -> None: ... + def skipany(self, pos: Position) -> Optional[FormulaBit]: ... + def parseany(self, pos: Position) -> FormulaConstant: ... + def parsetype(self, type: Type[_FB], pos: Position) -> _FB: ... + def parseformula(self, formula: str) -> WholeFormula: ... class Translator: - instance: Any = ... - def translate(cls, key): ... - translate: Any = ... - translation: Any = ... + instance: Translator = ... + def translate(cls: Any, key: str): ... + translate: classmethod = ... # type: ignore + translation: NullTranslations = ... first: bool = ... def __init__(self) -> None: ... - langcodes: Any = ... - def findtranslation(self): ... - def getmessage(self, key): ... - def getuntranslated(self, key): ... + langcodes: List[str] = ... + def findtranslation(self) -> None: ... + def getmessage(self, key: str) -> str: ... + def getuntranslated(self, key: str) -> str: ... class NumberCounter: - name: Any = ... - value: Any = ... - mode: Any = ... - master: Any = ... + name: str = ... + value: int = ... + mode: str = ... + master: NumberCounter = ... letters: str = ... - symbols: Any = ... - romannumerals: Any = ... - def __init__(self, name) -> None: ... - def setmode(self, mode): ... - def init(self, value): ... - def gettext(self): ... - def getletter(self): ... - def getsymbol(self): ... - def getsequence(self, sequence): ... - def getroman(self): ... - def getvalue(self): ... - def getnext(self): ... - def reset(self): ... - def __unicode__(self): ... + symbols: List[str] = ... + romannumerals: List[Tuple[str, int]] = ... + def __init__(self, name: str) -> None: ... + def setmode(self, mode: str) -> NumberCounter: ... + def init(self, value: int) -> None: ... + def gettext(self) -> str: ... + def getletter(self) -> str: ... + def getsymbol(self) -> str: ... + def getsequence(self, sequence: Union[str, List[str]]) -> str: ... + def getroman(self) -> str: ... + def getvalue(self) -> str: ... + def getnext(self) -> int: ... + def reset(self) -> None: ... + def __unicode__(self) -> str: ... class DependentCounter(NumberCounter): - master: Any = ... - last: Any = ... - def setmaster(self, master): ... - def getnext(self): ... - def getvalue(self): ... + master: NumberCounter = ... + last: str = ... + def setmaster(self, master: NumberCounter) -> DependentCounter: ... + def getnext(self) -> int: ... + def getvalue(self) -> str: ... class NumberGenerator: - chaptered: Any = ... - generator: Any = ... - romanlayouts: Any = ... - orderedlayouts: Any = ... - counters: Any = ... - appendix: Any = ... - def deasterisk(self, type): ... - def isunique(self, type): ... - def isroman(self, type): ... - def isinordered(self, type): ... - def isnumbered(self, type): ... - def isunordered(self, type): ... - def getlevel(self, type): ... - def getparttype(self, type): ... - def generate(self, type): ... - def getcounter(self, type): ... - def create(self, type): ... - def getdependentcounter(self, type, master): ... - def createdependent(self, type, master): ... - def startappendix(self): ... + chaptered: ChapteredGenerator = ... + generator: NumberGenerator = ... + romanlayouts: List[str] = ... + orderedlayouts: List[str] = ... + counters: Dict[str, NumberCounter] = ... + appendix: Optional[bool] = ... + def deasterisk(self, type: str) -> str: ... + def isunique(self, type: str) -> bool: ... + def isroman(self, type: str) -> bool: ... + def isinordered(self, type: str) -> bool: ... + def isnumbered(self, type: str) -> bool: ... + def isunordered(self, type: str) -> bool: ... + def getlevel(self, type: str) -> int: ... + def getparttype(self, type: str) -> str: ... + def generate(self, type: str) -> int: ... + def getcounter(self, type: str) -> NumberCounter: ... + def create(self, type: str) -> NumberCounter: ... + def getdependentcounter(self, type: str, master: NumberCounter) -> NumberCounter: ... + def createdependent(self, type: str, master: NumberCounter) -> DependentCounter: ... + def startappendix(self) -> None: ... class ChapteredGenerator(NumberGenerator): - def generate(self, type): ... + def generate(self, type: str) -> int: ... class ContainerSize: - width: Any = ... - height: Any = ... - maxwidth: Any = ... - maxheight: Any = ... + width: Optional[str] = ... + height: Optional[str] = ... + maxwidth: Optional[str] = ... + maxheight: Optional[str] = ... scale: Any = ... - def set(self, width: Any = ..., height: Any = ...): ... - def setmax(self, maxwidth: Any = ..., maxheight: Any = ...): ... - def readparameters(self, container): ... - def setparameter(self, container, name): ... - def setvalue(self, name, value): ... - def checkvalidheight(self, container): ... - def processparameter(self, value): ... - def extractnumber(self, text): ... - def checkimage(self, width, height): ... - def scalevalue(self, value): ... - def removepercentwidth(self): ... - def addstyle(self, container): ... - def styleparameter(self, name): ... + def set(self, width: Optional[str] = ..., height: Optional[str] = ...) -> ContainerSize: ... + def setmax(self, maxwidth: Optional[str] = ..., maxheight: Optional[str] = ...) -> ContainerSize: ... + def readparameters(self, container: Container) -> ContainerSize: ... + def setparameter(self, container: Container, name: str) -> None: ... + def setvalue(self, name: str, value: str) -> None: ... + def checkvalidheight(self, container: Container) -> None: ... + def processparameter(self, value: str) -> Optional[str]: ... + def extractnumber(self, text: str) -> str: ... + def checkimage(self, width: int, height: int) -> None: ... + def scalevalue(self, value: int) -> str: ... + def removepercentwidth(self) -> Optional[str]: ... + def addstyle(self, container: Container) -> None: ... + def styleparameter(self, name: str) -> str: ... class QuoteContainer(Container): - parser: Any = ... - output: Any = ... + parser: BoundedParser = ... + output: FixedOutput = ... def __init__(self) -> None: ... - type: Any = ... - html: Any = ... - def process(self): ... + type: str = ... + html: List[str] = ... + def process(self) -> None: ... class LyXLine(Container): - parser: Any = ... - output: Any = ... + parser: LoneCommand = ... + output: FixedOutput = ... def __init__(self) -> None: ... - html: Any = ... - def process(self): ... + html: List[str] = ... + def process(self) -> None: ... class EmphaticText(TaggedText): - def process(self): ... + def process(self) -> None: ... class ShapedText(TaggedText): - type: Any = ... - def process(self): ... + type: str = ... + def process(self) -> None: ... class VersalitasText(TaggedText): - def process(self): ... + def process(self) -> None: ... class ColorText(TaggedText): - color: Any = ... - def process(self): ... + color: str = ... + def process(self) -> None: ... class SizeText(TaggedText): - size: Any = ... - def process(self): ... + size: str = ... + def process(self) -> None: ... class BoldText(TaggedText): - def process(self): ... + def process(self) -> None: ... class TextFamily(TaggedText): - type: Any = ... - def process(self): ... + type: str = ... + def process(self) -> None: ... class Hfill(TaggedText): - def process(self): ... + def process(self) -> None: ... class BarredText(TaggedText): - type: Any = ... - def process(self): ... + type: str = ... + def process(self) -> None: ... class LangLine(TaggedText): - output: Any = ... - def process(self): ... + output: ContentsOutput = ... + def process(self) -> None: ... class InsetLength(BlackBox): - length: Any = ... - def process(self): ... + length: str = ... + def process(self) -> None: ... class Space(Container): - parser: Any = ... - output: Any = ... + parser: InsetParser = ... + output: FixedOutput = ... def __init__(self) -> None: ... - type: Any = ... - html: Any = ... - def process(self): ... - def getlength(self): ... + type: str = ... + html: List[str] = ... + def process(self) -> None: ... + def getlength(self) -> Optional[str]: ... class VerticalSpace(Container): - parser: Any = ... - output: Any = ... + parser: InsetParser = ... + output: FixedOutput = ... def __init__(self) -> None: ... - type: Any = ... - html: Any = ... - def process(self): ... + type: str = ... + html: List[str] = ... + def process(self) -> None: ... class Align(Container): - parser: Any = ... + parser: ExcludingParser = ... output: Any = ... def __init__(self) -> None: ... - def process(self): ... + def process(self) -> None: ... class Newline(Container): - parser: Any = ... - output: Any = ... + parser: LoneCommand = ... + output: FixedOutput = ... def __init__(self) -> None: ... - html: Any = ... - def process(self): ... + html: List[str] = ... + def process(self) -> None: ... class NewPage(Newline): - html: Any = ... - def process(self): ... + html: List[str] = ... + def process(self) -> None: ... class Separator(Container): - output: Any = ... - contents: Any = ... - html: Any = ... - def __init__(self, constant) -> None: ... + output: FixedOutput = ... + contents: List[Any] = ... + html: List[str] = ... + def __init__(self, constant: str) -> None: ... class StrikeOut(TaggedText): - def process(self): ... + def process(self) -> None: ... class StartAppendix(BlackBox): - def process(self): ... + def process(self) -> None: ... class Link(Container): anchor: Any = ... @@ -809,376 +814,376 @@ class Link(Container): target: Any = ... destination: Any = ... title: Any = ... - contents: Any = ... - parser: Any = ... - output: Any = ... + contents: List[Constant] = ... + parser: InsetParser = ... + output: LinkOutput = ... def __init__(self) -> None: ... - def complete(self, text, anchor: Any = ..., url: Any = ..., type: Any = ..., title: Any = ...): ... - def computedestination(self): ... - def setmutualdestination(self, destination): ... - def __unicode__(self): ... + def complete(self, text, anchor: Any = ..., url: Any = ..., type: Any = ..., title: Any = ...) -> Link: ... + def computedestination(self) -> None: ... + def setmutualdestination(self, destination: Link) -> None: ... + def __unicode__(self) -> str: ... class URL(Link): - url: Any = ... - contents: Any = ... - def process(self): ... + url: str = ... + contents: List[Constant] = ... + def process(self) -> None: ... class FlexURL(URL): - url: Any = ... - def process(self): ... + url: str = ... + def process(self) -> None: ... class LinkOutput(ContainerOutput): - def gethtml(self, link): ... + def gethtml(self, link: Link) -> TaggedOutput: ... # type: ignore class Postprocessor: - stages: Any = ... + stages: List[Any] = ... current: Any = ... last: Any = ... def __init__(self) -> None: ... def postprocess(self, next): ... - def postrecursive(self, container): ... + def postrecursive(self, container: Container) -> None: ... def postcurrent(self, next): ... class StageDict: - stagedict: Any = ... - def __init__(self, classes, postprocessor) -> None: ... - def instantiate(self, classes, postprocessor): ... - def getstage(self, element): ... + stagedict: Dict[Any, Any] = ... + def __init__(self, classes: Sequence[type], postprocessor: Postprocessor) -> None: ... + def instantiate(self, classes: Sequence[type], postprocessor: Postprocessor) -> List[Any]: ... + def getstage(self, element: Any) -> Optional[Any]: ... class Label(Link): - names: Any = ... + names: Dict = ... lastlayout: Any = ... lastnumbered: Any = ... def __init__(self) -> None: ... - def process(self): ... - key: Any = ... - def create(self, text, key, type: str = ...): ... - def findpartkey(self): ... - def numbered(self, container): ... - def __unicode__(self): ... + def process(self) -> None: ... + key: str = ... + def create(self, text: str, key: str, type: str = ...) -> Label: ... + def findpartkey(self) -> str: ... + def numbered(self, container: Container): ... + def __unicode__(self) -> str: ... class Reference(Link): - references: Any = ... + references: Dict = ... key: str = ... direction: str = ... destination: Any = ... - def process(self): ... + def process(self) -> None: ... formatted: str = ... - contents: Any = ... - def formatcontents(self): ... - def replace(self, key, value): ... - def __unicode__(self): ... + contents: List[Constant] = ... + def formatcontents(self) -> None: ... + def replace(self, key: str, value: str) -> None: ... + def __unicode__(self) -> str: ... class FormulaCommand(FormulaBit): - types: Any = ... - start: Any = ... + types: List[Type] = ... + start: str = ... commandmap: Any = ... - def detect(self, pos): ... + def detect(self, pos: Position) -> bool: ... output: Any = ... - def parsebit(self, pos): ... - def parsewithcommand(self, command, pos): ... - def parsecommandtype(self, command, type, pos): ... - def extractcommand(self, pos): ... - def emptycommand(self, pos): ... - def parseupgreek(self, command, pos): ... + def parsebit(self, pos: Position) -> Optional[Any]: ... + def parsewithcommand(self, command, pos: Position): ... + def parsecommandtype(self, command, type: Type, pos: Position): ... + def extractcommand(self, pos: Position): ... + def emptycommand(self, pos: Position): ... + def parseupgreek(self, command, pos: Position): ... class CommandBit(FormulaCommand): command: Any = ... translated: Any = ... - def setcommand(self, command): ... - def parseparameter(self, pos): ... - def parsesquare(self, pos): ... - def parseliteral(self, pos): ... - def parsesquareliteral(self, pos): ... - def parsetext(self, pos): ... + def setcommand(self, command) -> None: ... + def parseparameter(self, pos: Position) -> FormulaConstant: ... + def parsesquare(self, pos: Position) -> Optional[_FB]: ... + def parseliteral(self, pos: Position) -> str: ... + def parsesquareliteral(self, pos: Position) -> str: ... + def parsetext(self, pos: Position) -> Bracket: ... class EmptyCommand(CommandBit): - commandmap: Any = ... - contents: Any = ... - def parsebit(self, pos): ... + commandmap: Dict[str, str] = ... + contents: List[FormulaConstant] = ... + def parsebit(self, pos: Position): ... class SpacedCommand(CommandBit): - commandmap: Any = ... - contents: Any = ... - def parsebit(self, pos): ... + commandmap: Dict[str, str] = ... + contents: List[FormulaConstant] = ... + def parsebit(self, pos: Position): ... class AlphaCommand(EmptyCommand): - commandmap: Any = ... + commandmap: Dict[str, str] = ... type: str = ... - def parsebit(self, pos): ... + def parsebit(self, pos: Position): ... class OneParamFunction(CommandBit): - commandmap: Any = ... + commandmap: Dict[str, str] = ... simplified: bool = ... - output: Any = ... - def parsebit(self, pos): ... - html: Any = ... - def simplifyifpossible(self): ... + output: TaggedOutput = ... + def parsebit(self, pos: Position) -> None: ... + html: List[str] = ... + def simplifyifpossible(self) -> None: ... class SymbolFunction(CommandBit): - commandmap: Any = ... - def detect(self, pos): ... - output: Any = ... - def parsebit(self, pos): ... + commandmap: Dict[str, str] = ... + def detect(self, pos: Position) -> bool: ... + output: TaggedOutput = ... + def parsebit(self, pos: Position) -> None: ... class TextFunction(CommandBit): - commandmap: Any = ... - output: Any = ... - def parsebit(self, pos): ... + commandmap: Dict[str, str] = ... + output: TaggedOutput = ... + def parsebit(self, pos: Position) -> None: ... type: str = ... - def process(self): ... + def process(self) -> None: ... class LabelFunction(CommandBit): - commandmap: Any = ... + commandmap: Dict[str, str] = ... key: Any = ... - def parsebit(self, pos): ... + def parsebit(self, pos) -> str: ... type: str = ... - label: Any = ... - contents: Any = ... - def process(self): ... + label: Label = ... + contents: List[Label] = ... + def process(self) -> None: ... class FontFunction(OneParamFunction): - commandmap: Any = ... + commandmap: Dict[str, str] = ... type: str = ... - def process(self): ... + def process(self) -> None: ... class BigSymbol: - symbols: Any = ... - symbol: Any = ... - def __init__(self, symbol) -> None: ... - def getpieces(self): ... - def smalllimit(self): ... + symbols: Dict[str, List[str]] = ... + symbol: str = ... + def __init__(self, symbol: str) -> None: ... + def getpieces(self) -> List[str]: ... + def smalllimit(self) -> bool: ... class BigBracket(BigSymbol): - size: Any = ... - original: Any = ... - alignment: Any = ... - pieces: Any = ... - def __init__(self, size, bracket, alignment: str = ...) -> None: ... + size: int = ... + original: str = ... + alignment: str = ... + pieces: Optional[List[str]] = ... + def __init__(self, size: int, bracket: str, alignment: str = ...) -> None: ... def getpiece(self, index): ... - def getpiece1(self, index): ... - def getpiece3(self, index): ... - def getpiece4(self, index): ... - def getcell(self, index): ... - def getcontents(self): ... - def getsinglebracket(self): ... + def getpiece1(self, index: int) -> str: ... + def getpiece3(self, index: int) -> str: ... + def getpiece4(self, index: int) -> str: ... + def getcell(self, index: int) -> TaggedBit: ... + def getcontents(self) -> List[TaggedBit]: ... + def getsinglebracket(self) -> List[TaggedBit]: ... class FormulaEquation(CommandBit): piece: str = ... - output: Any = ... - def parsebit(self, pos): ... + output: ContentsOutput = ... + def parsebit(self, pos: Position) -> None: ... class FormulaCell(FormulaCommand): - alignment: Any = ... - output: Any = ... - def setalignment(self, alignment): ... - def parsebit(self, pos): ... + alignment: str = ... + output: TaggedOutput = ... + def setalignment(self, alignment: str) -> FormulaCell: ... + def parsebit(self, pos: Position) -> None: ... class FormulaRow(FormulaCommand): - cellseparator: Any = ... - alignments: Any = ... - output: Any = ... - def setalignments(self, alignments): ... - def parsebit(self, pos): ... - def createcell(self, index): ... + cellseparator: str = ... + alignments: str = ... + output: TaggedOutput = ... + def setalignments(self, alignments: str) -> FormulaRow: ... + def parsebit(self, pos: Position) -> None: ... + def createcell(self, index) -> FormulaCell: ... class MultiRowFormula(CommandBit): - rows: Any = ... - size: Any = ... - def parserows(self, pos): ... - def iteraterows(self, pos): ... - def addempty(self): ... - def addrow(self, row): ... + rows: List = ... + size: int = ... + def parserows(self, pos: Position) -> None: ... + def iteraterows(self, pos: Position) -> Iterator[FormulaRow]: ... + def addempty(self) -> None: ... + def addrow(self, row: FormulaRow) -> None: ... class FormulaArray(MultiRowFormula): piece: str = ... - output: Any = ... - def parsebit(self, pos): ... + output: TaggedOutput = ... + def parsebit(self, pos: Position) -> None: ... valign: str = ... - alignments: Any = ... - def parsealignments(self, pos): ... + alignments: List[str] = ... + def parsealignments(self, pos: Position) -> None: ... class FormulaMatrix(MultiRowFormula): piece: str = ... - output: Any = ... + output: TaggedOutput = ... valign: str = ... - alignments: Any = ... - def parsebit(self, pos): ... + alignments: List[str] = ... + def parsebit(self, pos: Position) -> None: ... class FormulaCases(MultiRowFormula): piece: str = ... - output: Any = ... - alignments: Any = ... - contents: Any = ... - def parsebit(self, pos): ... + output: ContentsOutput = ... + alignments: List[str] = ... + contents: List[TaggedBit] = ... + def parsebit(self, pos: Position) -> None: ... class EquationEnvironment(MultiRowFormula): - output: Any = ... - alignments: Any = ... - def parsebit(self, pos): ... + output: TaggedOutput = ... + alignments: List[str] = ... + def parsebit(self, pos: Position) -> None: ... class BeginCommand(CommandBit): - commandmap: Any = ... - types: Any = ... - size: Any = ... - def parsebit(self, pos): ... - def findbit(self, piece): ... + commandmap: Dict[str, str] = ... + types: List[Type] = ... + size: int = ... + def parsebit(self, pos: Position) -> None: ... + def findbit(self, piece: str) -> EquationEnvironment: ... class CombiningFunction(OneParamFunction): - commandmap: Any = ... + commandmap: Dict[str, str] = ... type: str = ... - def parsebit(self, pos): ... - def parsesingleparameter(self, pos): ... + def parsebit(self, pos: Position) -> None: ... + def parsesingleparameter(self, pos: Position) -> FormulaConstant: ... class DecoratingFunction(OneParamFunction): - commandmap: Any = ... + commandmap: Dict[str, str] = ... type: str = ... - symbol: Any = ... - parameter: Any = ... - output: Any = ... - def parsebit(self, pos): ... + symbol: TaggedBit = ... + parameter: FormulaConstant = ... + output: TaggedOutput = ... + def parsebit(self, pos: Position) -> None: ... class LimitCommand(EmptyCommand): - commandmap: Any = ... - output: Any = ... - def parsebit(self, pos): ... + commandmap: Dict[str, str] = ... + output: TaggedOutput = ... + def parsebit(self, pos: Position) -> None: ... class LimitPreviousCommand(LimitCommand): commandmap: Any = ... - output: Any = ... - def parsebit(self, pos): ... - def __unicode__(self): ... + output: TaggedOutput = ... + def parsebit(self, pos: Position) -> None: ... + def __unicode__(self) -> str: ... class LimitsProcessor(MathsProcessor): - def process(self, contents, index): ... - def checklimits(self, contents, index): ... - def limitsahead(self, contents, index): ... - def modifylimits(self, contents, index): ... - def getlimit(self, contents, index): ... - def modifyscripts(self, contents, index): ... - def checkscript(self, contents, index): ... - def checkcommand(self, contents, index, type): ... - def getscript(self, contents, index): ... + def process(self, contents: List[Any], index: int) -> None: ... + def checklimits(self, contents: List[Any], index: int) -> bool: ... + def limitsahead(self, contents: List[Any], index: int) -> None: ... + def modifylimits(self, contents: List[Any], index: int) -> None: ... + def getlimit(self, contents: List[Any], index: int) -> Any: ... + def modifyscripts(self, contents: List[Any], index: int) -> None: ... + def checkscript(self, contents: List[Any], index: int) -> bool: ... + def checkcommand(self, contents: List[Any], index: int, type: Type) -> bool: ... + def getscript(self, contents: List[Any], index: int) -> Any: ... class BracketCommand(OneParamFunction): - commandmap: Any = ... - def parsebit(self, pos): ... - original: Any = ... - command: Any = ... - contents: Any = ... - def create(self, direction, character): ... + commandmap: Dict[str, str] = ... + def parsebit(self, pos: Position) -> None: ... + original: str = ... + command: str = ... + contents: List[FormulaConstant] = ... + def create(self, direction: str, character: str) -> BracketCommand: ... class BracketProcessor(MathsProcessor): - def process(self, contents, index): ... - def processleft(self, contents, index): ... - def checkleft(self, contents, index): ... - def checkright(self, contents, index): ... - def checkdirection(self, bit, command): ... - def findright(self, contents, index): ... - def findmax(self, contents, leftindex, rightindex): ... - def resize(self, command, size): ... + def process(self, contents: List[Any], index: int) -> None: ... + def processleft(self, contents: List[Any], index: int) -> None: ... + def checkleft(self, contents: List[Any], index: int) -> bool: ... + def checkright(self, contents: List[Any], index: int) -> bool: ... + def checkdirection(self, bit: BracketCommand, command: str) -> bool: ... + def findright(self, contents: List[Any], index: int) -> Optional[int]: ... + def findmax(self, contents: List[Any], leftindex: int, rightindex: int): ... + def resize(self, command: BracketCommand, size: int) -> None: ... class TodayCommand(EmptyCommand): commandmap: Any = ... - output: Any = ... - html: Any = ... - def parsebit(self, pos): ... + output: FixedOutput = ... + html: List[str] = ... + def parsebit(self, pos: Position) -> None: ... class ParameterDefinition: - parambrackets: Any = ... - name: Any = ... + parambrackets: List[Tuple[str, str]] = ... + name: Optional[str] = ... literal: bool = ... optional: bool = ... value: Any = ... literalvalue: Any = ... def __init__(self) -> None: ... - def parse(self, pos): ... - def read(self, pos, function): ... - def __unicode__(self): ... + def parse(self, pos: Position) -> Optional[ParameterDefinition]: ... + def read(self, pos: Position, function: CommandBit) -> None: ... + def __unicode__(self) -> str: ... class ParameterFunction(CommandBit): - params: Any = ... - def readparams(self, readtemplate, pos): ... - def paramdefs(self, readtemplate): ... - def getparam(self, name): ... - def getvalue(self, name): ... - def getliteralvalue(self, name): ... + params: Dict[str, ParameterFunction] = ... + def readparams(self, readtemplate: str, pos: Position) -> None: ... + def paramdefs(self, readtemplate: str) -> Iterator[ParameterDefinition]: ... + def getparam(self, name: str) -> ParameterDefinition: ... + def getvalue(self, name: str) -> ParameterDefinition: ... + def getliteralvalue(self, name: str) -> Any: ... class HybridFunction(ParameterFunction): - commandmap: Any = ... + commandmap: Dict[str, List[str]] = ... contents: Any = ... - def parsebit(self, pos): ... + def parsebit(self, pos: Position) -> None: ... def writeparams(self, writetemplate): ... - def writepos(self, pos): ... - def writeparam(self, pos): ... - def writefunction(self, pos): ... - def readtag(self, pos): ... - def writebracket(self, direction, character): ... - size: Any = ... - def computehybridsize(self): ... + def writepos(self, pos: Position) -> List[Any]: ... + def writeparam(self, pos: Position) -> Any: ... + def writefunction(self, pos: Position) -> Optional[TaggedBit]: ... + def readtag(self, pos: Position) -> Optional[str]: ... + def writebracket(self, direction: str, character: str) -> BracketCommand: ... + size: int = ... + def computehybridsize(self) -> None: ... class HybridSize: - configsizes: Any = ... - def getsize(self, function): ... + configsizes: Dict[str, str] = ... + def getsize(self, function: ParameterFunction) -> int: ... class HeaderParser(Parser): - def parse(self, reader): ... - def parseline(self, reader, contents): ... - def parsebranch(self, reader): ... + def parse(self, reader: LineReader) -> List[Any]: ... + def parseline(self, reader: LineReader, contents: List[Any]) -> None: ... + def parsebranch(self, reader: LineReader) -> None: ... ending: Any = ... - def complete(self, ending): ... + def complete(self, ending: Any) -> HeaderParser: ... class PreambleParser(Parser): - preamble: Any = ... - ending: Any = ... - def parse(self, reader): ... - def parsepreambleline(self, reader): ... + preamble: List[Any] = ... + ending: str = ... + def parse(self, reader: LineReader) -> List: ... + def parsepreambleline(self, reader: LineReader) -> None: ... class LstParser: - globalparams: Any = ... - def parselstset(self, reader): ... - def extractlstset(self, reader): ... - def parsecontainer(self, container): ... - def parselstparams(self, paramlist): ... + globalparams: Dict[str, str] = ... + def parselstset(self, reader: LineReader) -> None: ... + def extractlstset(self, reader: LineReader) -> Optional[str]: ... + def parsecontainer(self, container: Container) -> None: ... + def parselstparams(self, paramlist: Sequence[str]) -> Dict[str, str]: ... class MacroDefinition(CommandBit): - macros: Any = ... - output: Any = ... + macros: Dict = ... + output: EmptyOutput = ... parameternumber: int = ... - defaults: Any = ... - def parsebit(self, pos): ... + defaults: List[Any] = ... + def parsebit(self, pos: Position) -> None: ... newcommand: Any = ... - definition: Any = ... - def parseparameters(self, pos): ... - def parsenewcommand(self, pos): ... - def instantiate(self): ... + definition: FormulaConstant = ... + def parseparameters(self, pos: Position) -> None: ... + def parsenewcommand(self, pos: Position) -> Union[str]: ... + def instantiate(self) -> FormulaConstant: ... class MacroParameter(FormulaBit): - def detect(self, pos): ... - number: Any = ... - original: Any = ... - contents: Any = ... - def parsebit(self, pos): ... + def detect(self, pos: Position) -> bool: ... + number: int = ... + original: str = ... + contents: List[TaggedBit] = ... + def parsebit(self, pos: Position) -> None: ... class MacroFunction(CommandBit): commandmap: Any = ... - output: Any = ... - values: Any = ... - def parsebit(self, pos): ... - def parseparameters(self, pos, macro): ... - def parseoptional(self, pos, defaults): ... - def parsemandatory(self, pos, number): ... - def parsemacroparameter(self, pos, remaining): ... - def parsenumbers(self, pos, remaining): ... - contents: Any = ... - def completemacro(self, macro): ... - def addfilter(self, index, value): ... + output: FilteredOutput = ... + values: List[Any] = ... + def parsebit(self, pos: Position) -> None: ... + def parseparameters(self, pos: Position, macro) -> None: ... + def parseoptional(self, pos: Position, defaults: List) -> None: ... + def parsemandatory(self, pos: Position, number: int) -> None: ... + def parsemacroparameter(self, pos: Position, remaining: int) -> Optional[Union[FormulaNumber, FormulaConstant]]: ... + def parsenumbers(self, pos: Position, remaining: int) -> Optional[FormulaNumber]: ... + contents: List[FormulaConstant] = ... + def completemacro(self, macro: MacroDefinition): ... + def addfilter(self, index: int, value: str): ... class FormulaMacro(Formula): - parser: Any = ... - output: Any = ... + parser: MacroParser = ... + output: EmptyOutput = ... # type: ignore def __init__(self) -> None: ... - def __unicode__(self): ... + def __unicode__(self) -> str: ... -def math2html(formula): ... -def main(): ... +def math2html(formula: str) -> str: ... +def main() -> None: ... From 51037bafa1e134560d3c7b47dd74c445be485621 Mon Sep 17 00:00:00 2001 From: cocoatomo Date: Mon, 27 Aug 2018 23:58:46 +0900 Subject: [PATCH 5/7] [WIP] Use more abstract type hint for arguments --- .../3/docutils/utils/math/math2html.pyi | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/third_party/3/docutils/utils/math/math2html.pyi b/third_party/3/docutils/utils/math/math2html.pyi index fcd07388a3e3..bbbdfdba69a9 100644 --- a/third_party/3/docutils/utils/math/math2html.pyi +++ b/third_party/3/docutils/utils/math/math2html.pyi @@ -3,7 +3,7 @@ # NOTE: This dynamically typed stub was automatically generated by stubgen. from gettext import NullTranslations -from typing import Any, AnyStr, Callable, ClassVar, Dict, Iterator, List, MutableSequence, Optional, overload, Sequence, TextIO, Tuple, Type, TypeVar, Union +from typing import Any, AnyStr, Callable, ClassVar, Dict, Iterator, List, Mapping, MutableSequence, Optional, overload, Sequence, TextIO, Tuple, Type, TypeVar, Union class Trace: debugmode: bool = ... @@ -218,7 +218,7 @@ class ContainerExtractor: allowed: List[str] = ... cloned: List[str] = ... extracted: List[str] = ... - def __init__(self, config: Dict[str, List[str]]) -> None: ... + def __init__(self, config: Mapping[str, MutableSequence[str]]) -> None: ... def extract(self, container: Container) -> List[Container]: ... def process(self, container: Container, list: MutableSequence[Container]) -> None: ... def safeclone(self, container: _Container) -> _Container: ... @@ -229,21 +229,21 @@ class Parser: def __init__(self) -> None: ... def parseheader(self, reader: LineReader) -> List[str]: ... def parseparameter(self, reader: LineReader) -> None: ... - def parsexml(self, reader: LineReader) -> Tuple[str, Dict[str, str]]: ... + def parsexml(self, reader: LineReader) -> Tuple[Optional[str], Optional[Dict[str, str]]]: ... def parseending(self, reader: LineReader, process: Callable[..., None]) -> None: ... - def parsecontainer(self, reader: LineReader, contents: List[Container]) -> None: ... + def parsecontainer(self, reader: LineReader, contents: MutableSequence[Container]) -> None: ... def __unicode__(self) -> str: ... class LoneCommand(Parser): - def parse(self, reader) -> List[Any]: ... + def parse(self, reader: LineReader) -> List[Any]: ... class TextParser(Parser): stack: List[str] = ... ending: str = ... endings: List[str] = ... def __init__(self, container: Container) -> None: ... - def parse(self, reader) -> List[Container]: ... - def isending(self, reader) -> bool: ... + def parse(self, reader: LineReader) -> List[Container]: ... + def isending(self, reader: LineReader) -> bool: ... class ExcludingParser(Parser): def parse(self, reader: LineReader) -> List[Container]: ... @@ -271,10 +271,10 @@ class EmptyOutput(ContainerOutput): def isempty(self) -> bool: ... class FixedOutput(ContainerOutput): - def gethtml(self, container: Container) -> List[AnyStr]: ... + def gethtml(self, container: Container) -> List[str]: ... class ContentsOutput(ContainerOutput): - def gethtml(self, container: Container) -> List[AnyStr]: ... + def gethtml(self, container: Container) -> List[str]: ... class TaggedOutput(ContentsOutput): tag: Optional[str] = ... @@ -282,7 +282,7 @@ class TaggedOutput(ContentsOutput): empty: bool = ... def settag(self, tag: str, breaklines: bool = ..., empty: bool = ...) -> TaggedOutput: ... def setbreaklines(self, breaklines: bool) -> TaggedOutput: ... - def gethtml(self, container: Container) -> List[AnyStr]: ... + def gethtml(self, container: Container) -> List[str]: ... def open(self, container: Container) -> str: ... def close(self, container: Container) -> str: ... def selfclosing(self, container: Container) -> str: ... @@ -292,11 +292,11 @@ class FilteredOutput(ContentsOutput): filters: List[Tuple[str, str]] = ... def __init__(self) -> None: ... def addfilter(self, original: str, replacement: str) -> None: ... - def gethtml(self, container: Container) -> List[AnyStr]: ... - def filter(self, line: AnyStr) -> AnyStr: ... + def gethtml(self, container: Container) -> List[str]: ... + def filter(self, line: str) -> str: ... class StringOutput(ContainerOutput): - def gethtml(self, container: Container) -> List[AnyStr]: ... + def gethtml(self, container: Container) -> List[str]: ... class LineReader: file: TextIO = ... @@ -385,7 +385,7 @@ class TextPosition(Position): def identifier(self) -> str: ... def isout(self) -> bool: ... def current(self) -> str: ... - def extract(self, length) -> Optional[str]: ... + def extract(self, length: int) -> Optional[str]: ... class FilePosition(Position): reader: LineReader = ... @@ -468,14 +468,14 @@ class DocumentParameters: tocdepth: int = ... startinglevel: int = ... maxdepth: int = ... - language: Any = ... + language: str = ... bibliography: Any = ... outputchanges: bool = ... displaymode: bool = ... class FormulaParser(Parser): begin: int = ... - def parseheader(self, reader): ... + def parseheader(self, reader: LineReader): ... def parsetype(self, reader: LineReader) -> Optional[str]: ... def parse(self, reader: LineReader) -> str: ... def parseformula(self, reader: LineReader) -> str: ... @@ -488,7 +488,7 @@ class MacroParser(FormulaParser): def parse(self, reader: LineReader) -> str: ... class FormulaBit(Container): - type: Any = ... + type: str = ... size: int = ... original: str = ... contents: List[Any] = ... @@ -512,7 +512,7 @@ class TaggedBit(FormulaBit): class FormulaConstant(Constant): original: str = ... size: int = ... - type: Any = ... + type: str = ... def __init__(self, string: str) -> None: ... def computesize(self) -> int: ... def clone(self) -> FormulaConstant: ... From 22e9edd31fd9588c752de0fdb6c9b10f8c448bfd Mon Sep 17 00:00:00 2001 From: cocoatomo Date: Tue, 28 Aug 2018 10:44:28 +0900 Subject: [PATCH 6/7] [WIP] Type utils/math2html.py --- .../3/docutils/utils/math/math2html.pyi | 104 +++++++++--------- 1 file changed, 53 insertions(+), 51 deletions(-) diff --git a/third_party/3/docutils/utils/math/math2html.pyi b/third_party/3/docutils/utils/math/math2html.pyi index bbbdfdba69a9..c6e40807f884 100644 --- a/third_party/3/docutils/utils/math/math2html.pyi +++ b/third_party/3/docutils/utils/math/math2html.pyi @@ -402,14 +402,14 @@ class FilePosition(Position): class Container: partkey: Any = ... - parent: Any = ... + parent: Container = ... begin: Any = ... contents: List[Any] = ... def __init__(self) -> None: ... def process(self) -> None: ... def gethtml(self) -> List[str]: ... def escapeall(self, lines: Sequence[str]) -> List[str]: ... - def escape(self, line: str, replacements: Dict[str, str] = ...) -> str: ... + def escape(self, line: str, replacements: Dict[str, str] = EscapeConfig.entities) -> str: ... def escapeentities(self, line: str) -> str: ... def searchall(self, type: Type) -> List[Container]: ... def searchremove(self, type: Type) -> List[Container]: ... @@ -496,7 +496,7 @@ class FormulaBit(Container): def __init__(self) -> None: ... factory: FormulaFactory = ... def setfactory(self, factory: FormulaFactory) -> FormulaBit: ... - def add(self, bit: FormulaBit): ... + def add(self, bit: FormulaBit) -> None: ... def skiporiginal(self, string: str, pos: Position) -> None: ... def computesize(self) -> int: ... def clone(self) -> FormulaBit: ... @@ -646,7 +646,7 @@ class NumberCounter: def gettext(self) -> str: ... def getletter(self) -> str: ... def getsymbol(self) -> str: ... - def getsequence(self, sequence: Union[str, List[str]]) -> str: ... + def getsequence(self, sequence: Union[str, MutableSequence[str]]) -> str: ... def getroman(self) -> str: ... def getvalue(self) -> str: ... def getnext(self) -> int: ... @@ -779,7 +779,7 @@ class VerticalSpace(Container): class Align(Container): parser: ExcludingParser = ... - output: Any = ... + output: TaggedOutput = ... def __init__(self) -> None: ... def process(self) -> None: ... @@ -807,18 +807,18 @@ class StartAppendix(BlackBox): def process(self) -> None: ... class Link(Container): - anchor: Any = ... - url: Any = ... - type: Any = ... - page: Any = ... - target: Any = ... - destination: Any = ... - title: Any = ... + anchor: str = ... + url: str = ... + type: str = ... + page: str = ... + target: str = ... + destination: Link = ... + title: str = ... contents: List[Constant] = ... parser: InsetParser = ... output: LinkOutput = ... def __init__(self) -> None: ... - def complete(self, text, anchor: Any = ..., url: Any = ..., type: Any = ..., title: Any = ...) -> Link: ... + def complete(self, text: str, anchor: Optional[str] = ..., url: Optional[str] = ..., type: Optional[str] = ..., title: Optional[str] = ...) -> Link: ... def computedestination(self) -> None: ... def setmutualdestination(self, destination: Link) -> None: ... def __unicode__(self) -> str: ... @@ -833,25 +833,25 @@ class FlexURL(URL): def process(self) -> None: ... class LinkOutput(ContainerOutput): - def gethtml(self, link: Link) -> TaggedOutput: ... # type: ignore + def gethtml(self, link: Link) -> List[str]: ... # type: ignore class Postprocessor: - stages: List[Any] = ... - current: Any = ... - last: Any = ... + stages: StageDict = ... + current: Container = ... + last: Container = ... def __init__(self) -> None: ... - def postprocess(self, next): ... + def postprocess(self, next: Optional[List[Any]]) -> Any: ... def postrecursive(self, container: Container) -> None: ... - def postcurrent(self, next): ... + def postcurrent(self, next: Optional[List[Any]]) -> Any: ... class StageDict: stagedict: Dict[Any, Any] = ... - def __init__(self, classes: Sequence[type], postprocessor: Postprocessor) -> None: ... - def instantiate(self, classes: Sequence[type], postprocessor: Postprocessor) -> List[Any]: ... + def __init__(self, classes: Sequence[Type], postprocessor: Postprocessor) -> None: ... + def instantiate(self, classes: Sequence[Type], postprocessor: Postprocessor) -> List[Any]: ... def getstage(self, element: Any) -> Optional[Any]: ... class Label(Link): - names: Dict = ... + names: ClassVar[Dict[str, Label]] = ... lastlayout: Any = ... lastnumbered: Any = ... def __init__(self) -> None: ... @@ -859,14 +859,14 @@ class Label(Link): key: str = ... def create(self, text: str, key: str, type: str = ...) -> Label: ... def findpartkey(self) -> str: ... - def numbered(self, container: Container): ... + def numbered(self, container: Container) -> Optional[Container]: ... def __unicode__(self) -> str: ... class Reference(Link): - references: Dict = ... + references: ClassVar[Dict[str, MutableSequence[Reference]]] = ... key: str = ... direction: str = ... - destination: Any = ... + destination: Label = ... def process(self) -> None: ... formatted: str = ... contents: List[Constant] = ... @@ -874,18 +874,20 @@ class Reference(Link): def replace(self, key: str, value: str) -> None: ... def __unicode__(self) -> str: ... +_CB = TypeVar('_CB', bound=CommandBit) + class FormulaCommand(FormulaBit): types: List[Type] = ... start: str = ... - commandmap: Any = ... + commandmap: Optional[Mapping] = ... def detect(self, pos: Position) -> bool: ... - output: Any = ... - def parsebit(self, pos: Position) -> Optional[Any]: ... - def parsewithcommand(self, command, pos: Position): ... - def parsecommandtype(self, command, type: Type, pos: Position): ... - def extractcommand(self, pos: Position): ... - def emptycommand(self, pos: Position): ... - def parseupgreek(self, command, pos: Position): ... + output: TaggedOutput = ... + def parsebit(self, pos: Position) -> Optional[_CB]: ... + def parsewithcommand(self, command: str, pos: Position) -> Optional[_CB]: ... + def parsecommandtype(self, command: str, type: _CB, pos: Position) -> _CB: ... + def extractcommand(self, pos: Position) -> Optional[str]: ... + def emptycommand(self, pos: Position) -> str: ... + def parseupgreek(self, command: str, pos: Position) -> Optional[_CB]: ... class CommandBit(FormulaCommand): command: Any = ... @@ -900,17 +902,17 @@ class CommandBit(FormulaCommand): class EmptyCommand(CommandBit): commandmap: Dict[str, str] = ... contents: List[FormulaConstant] = ... - def parsebit(self, pos: Position): ... + def parsebit(self, pos: Position) -> None: ... class SpacedCommand(CommandBit): commandmap: Dict[str, str] = ... contents: List[FormulaConstant] = ... - def parsebit(self, pos: Position): ... + def parsebit(self, pos: Position) -> None: ... class AlphaCommand(EmptyCommand): commandmap: Dict[str, str] = ... type: str = ... - def parsebit(self, pos: Position): ... + def parsebit(self, pos: Position) -> None: ... class OneParamFunction(CommandBit): commandmap: Dict[str, str] = ... @@ -936,7 +938,7 @@ class TextFunction(CommandBit): class LabelFunction(CommandBit): commandmap: Dict[str, str] = ... key: Any = ... - def parsebit(self, pos) -> str: ... + def parsebit(self, pos: Position) -> None: ... type: str = ... label: Label = ... contents: List[Label] = ... @@ -970,7 +972,7 @@ class BigBracket(BigSymbol): class FormulaEquation(CommandBit): piece: str = ... - output: ContentsOutput = ... + output: ContentsOutput = ... # type: ignore def parsebit(self, pos: Position) -> None: ... class FormulaCell(FormulaCommand): @@ -1012,7 +1014,7 @@ class FormulaMatrix(MultiRowFormula): class FormulaCases(MultiRowFormula): piece: str = ... - output: ContentsOutput = ... + output: ContentsOutput = ... # type: ignore alignments: List[str] = ... contents: List[TaggedBit] = ... def parsebit(self, pos: Position) -> None: ... @@ -1080,12 +1082,12 @@ class BracketProcessor(MathsProcessor): def checkright(self, contents: List[Any], index: int) -> bool: ... def checkdirection(self, bit: BracketCommand, command: str) -> bool: ... def findright(self, contents: List[Any], index: int) -> Optional[int]: ... - def findmax(self, contents: List[Any], leftindex: int, rightindex: int): ... + def findmax(self, contents: List[Any], leftindex: int, rightindex: int) -> int: ... def resize(self, command: BracketCommand, size: int) -> None: ... class TodayCommand(EmptyCommand): commandmap: Any = ... - output: FixedOutput = ... + output: FixedOutput = ... # type: ignore html: List[str] = ... def parsebit(self, pos: Position) -> None: ... @@ -1113,7 +1115,7 @@ class HybridFunction(ParameterFunction): commandmap: Dict[str, List[str]] = ... contents: Any = ... def parsebit(self, pos: Position) -> None: ... - def writeparams(self, writetemplate): ... + def writeparams(self, writetemplate) -> List[Any]: ... def writepos(self, pos: Position) -> List[Any]: ... def writeparam(self, pos: Position) -> Any: ... def writefunction(self, pos: Position) -> Optional[TaggedBit]: ... @@ -1130,11 +1132,11 @@ class HeaderParser(Parser): def parse(self, reader: LineReader) -> List[Any]: ... def parseline(self, reader: LineReader, contents: List[Any]) -> None: ... def parsebranch(self, reader: LineReader) -> None: ... - ending: Any = ... - def complete(self, ending: Any) -> HeaderParser: ... + ending: str = ... + def complete(self, ending: str) -> HeaderParser: ... class PreambleParser(Parser): - preamble: List[Any] = ... + preamble: ClassVar[List[str]] = ... ending: str = ... def parse(self, reader: LineReader) -> List: ... def parsepreambleline(self, reader: LineReader) -> None: ... @@ -1147,12 +1149,12 @@ class LstParser: def parselstparams(self, paramlist: Sequence[str]) -> Dict[str, str]: ... class MacroDefinition(CommandBit): - macros: Dict = ... - output: EmptyOutput = ... + macros: Dict[str, MacroDefinition] = ... + output: EmptyOutput = ... # type: ignore parameternumber: int = ... defaults: List[Any] = ... def parsebit(self, pos: Position) -> None: ... - newcommand: Any = ... + newcommand: str = ... definition: FormulaConstant = ... def parseparameters(self, pos: Position) -> None: ... def parsenewcommand(self, pos: Position) -> Union[str]: ... @@ -1167,11 +1169,11 @@ class MacroParameter(FormulaBit): class MacroFunction(CommandBit): commandmap: Any = ... - output: FilteredOutput = ... + output: FilteredOutput = ... # type: ignore values: List[Any] = ... def parsebit(self, pos: Position) -> None: ... - def parseparameters(self, pos: Position, macro) -> None: ... - def parseoptional(self, pos: Position, defaults: List) -> None: ... + def parseparameters(self, pos: Position, macro: MacroDefinition) -> None: ... + def parseoptional(self, pos: Position, defaults: List[Any]) -> None: ... def parsemandatory(self, pos: Position, number: int) -> None: ... def parsemacroparameter(self, pos: Position, remaining: int) -> Optional[Union[FormulaNumber, FormulaConstant]]: ... def parsenumbers(self, pos: Position, remaining: int) -> Optional[FormulaNumber]: ... From 00e8d2e441d69b95b8f6c8c7fde3c2c0388aab79 Mon Sep 17 00:00:00 2001 From: cocoatomo Date: Tue, 28 Aug 2018 11:11:37 +0900 Subject: [PATCH 7/7] Type utils --- .../docutils/utils/math/tex2mathml_extern.pyi | 9 +++--- .../3/docutils/utils/math/tex2unichar.pyi | 28 +++++++++---------- .../3/docutils/utils/math/unichar2tex.pyi | 4 +-- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/third_party/3/docutils/utils/math/tex2mathml_extern.pyi b/third_party/3/docutils/utils/math/tex2mathml_extern.pyi index 00d410065e70..ca52170abddb 100644 --- a/third_party/3/docutils/utils/math/tex2mathml_extern.pyi +++ b/third_party/3/docutils/utils/math/tex2mathml_extern.pyi @@ -2,10 +2,11 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Any, Optional +from docutils.utils import Reporter +from typing import Optional document_template: str -def latexml(math_code, reporter: Optional[Any] = ...): ... -def ttm(math_code, reporter: Optional[Any] = ...): ... -def blahtexml(math_code, inline: bool = ..., reporter: Optional[Any] = ...): ... +def latexml(math_code: str, reporter: Optional[Reporter] = ...): ... +def ttm(math_code: str, reporter: Optional[Reporter] = ...): ... +def blahtexml(math_code: str, inline: bool = ..., reporter: Optional[Reporter] = ...): ... diff --git a/third_party/3/docutils/utils/math/tex2unichar.pyi b/third_party/3/docutils/utils/math/tex2unichar.pyi index 63d2ac5a80d8..8f7c68e3f200 100644 --- a/third_party/3/docutils/utils/math/tex2unichar.pyi +++ b/third_party/3/docutils/utils/math/tex2unichar.pyi @@ -2,18 +2,18 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Any +from typing import Dict -mathaccent: Any -mathalpha: Any -mathbin: Any -mathclose: Any -mathfence: Any -mathop: Any -mathopen: Any -mathord: Any -mathover: Any -mathradical: Any -mathrel: Any -mathunder: Any -space: Any +mathaccent: Dict[str, str] +mathalpha: Dict[str, str] +mathbin: Dict[str, str] +mathclose: Dict[str, str] +mathfence: Dict[str, str] +mathop: Dict[str, str] +mathopen: Dict[str, str] +mathord: Dict[str, str] +mathover: Dict[str, str] +mathradical: Dict[str, str] +mathrel: Dict[str, str] +mathunder: Dict[str, str] +space: Dict[str, str] diff --git a/third_party/3/docutils/utils/math/unichar2tex.pyi b/third_party/3/docutils/utils/math/unichar2tex.pyi index 5af08aa08419..f9e77b5901c3 100644 --- a/third_party/3/docutils/utils/math/unichar2tex.pyi +++ b/third_party/3/docutils/utils/math/unichar2tex.pyi @@ -2,6 +2,6 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Any +from typing import Dict -uni2tex_table: Any +uni2tex_table: Dict[int, str]