From 5472129e8e0acb6a6eae8d3827b93bfae3ae5b6c Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Wed, 30 Sep 2020 13:14:25 -0700 Subject: [PATCH 1/2] markdown: improve preprocessors type https://github.com/Python-Markdown/markdown/blob/b701c34ebd7b2d0eb319517b9a275ddf0c89608d/markdown/preprocessors.py#L46 --- third_party/2and3/markdown/preprocessors.pyi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/third_party/2and3/markdown/preprocessors.pyi b/third_party/2and3/markdown/preprocessors.pyi index c29b6ab59623..acf97fa4b15e 100644 --- a/third_party/2and3/markdown/preprocessors.pyi +++ b/third_party/2and3/markdown/preprocessors.pyi @@ -1,14 +1,14 @@ -from typing import Any, Pattern +from typing import Any, List, Pattern from . import util def build_preprocessors(md, **kwargs): ... class Preprocessor(util.Processor): - def run(self, lines) -> None: ... + def run(self, lines: List[str]) -> List[str]: ... class NormalizeWhitespace(Preprocessor): - def run(self, lines): ... + def run(self, lines: List[str]) -> List[str]: ... class HtmlBlockPreprocessor(Preprocessor): right_tag_patterns: Any @@ -17,10 +17,10 @@ class HtmlBlockPreprocessor(Preprocessor): attrs_re: Any left_tag_re: Any markdown_in_raw: bool = ... - def run(self, lines): ... + def run(self, lines: List[str]) -> List[str]: ... class ReferencePreprocessor(Preprocessor): TITLE: str = ... RE: Pattern TITLE_RE: Pattern - def run(self, lines): ... + def run(self, lines: List[str]) -> List[str]: ... From a34d51e9138a038eecae73ef18e0b7366adfe28f Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Wed, 30 Sep 2020 13:43:11 -0700 Subject: [PATCH 2/2] Apply suggestions from code review --- third_party/2and3/markdown/preprocessors.pyi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/third_party/2and3/markdown/preprocessors.pyi b/third_party/2and3/markdown/preprocessors.pyi index acf97fa4b15e..e3083cdf5875 100644 --- a/third_party/2and3/markdown/preprocessors.pyi +++ b/third_party/2and3/markdown/preprocessors.pyi @@ -1,4 +1,4 @@ -from typing import Any, List, Pattern +from typing import Any, Iterable, List, Pattern from . import util @@ -8,7 +8,7 @@ class Preprocessor(util.Processor): def run(self, lines: List[str]) -> List[str]: ... class NormalizeWhitespace(Preprocessor): - def run(self, lines: List[str]) -> List[str]: ... + def run(self, lines: Iterable[str]) -> List[str]: ... class HtmlBlockPreprocessor(Preprocessor): right_tag_patterns: Any @@ -17,7 +17,7 @@ class HtmlBlockPreprocessor(Preprocessor): attrs_re: Any left_tag_re: Any markdown_in_raw: bool = ... - def run(self, lines: List[str]) -> List[str]: ... + def run(self, lines: Iterable[str]) -> List[str]: ... class ReferencePreprocessor(Preprocessor): TITLE: str = ...