Skip to content

Commit

Permalink
Simplify CodeBlockPreprocessor definition
Browse files Browse the repository at this point in the history
  • Loading branch information
intgr committed Dec 8, 2023
1 parent 76585c7 commit b86a5f9
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions rest_framework-stubs/compat.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,20 @@ try:
import pygments
except ImportError:
pygments: TypeAlias = None # type: ignore[no-redef]
try:
import markdown
def apply_markdown(text: str) -> str: ...

except ImportError:
apply_markdown: TypeAlias = None # type: ignore[no-redef]
markdown: TypeAlias = None # type: ignore[no-redef]

try:
import pygments
import markdown
from markdown.preprocessors import Preprocessor
def apply_markdown(text: str) -> str: ...

class CodeBlockPreprocessor(Preprocessor):
pattern: Any
formatter: Any
def run(self, lines: list[str]) -> list[str]: ...

except ImportError:
pass
apply_markdown: TypeAlias = None # type: ignore[no-redef]
markdown: TypeAlias = None # type: ignore[no-redef]

def pygments_css(style: Any) -> str | None: ...
def pygments_highlight(text: str, lang: str, style: Any) -> Any: ...
Expand Down

0 comments on commit b86a5f9

Please sign in to comment.