Skip to content

Commit

Permalink
add overloads
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell committed May 31, 2023
1 parent e3ad69b commit 5accffb
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion markdown_it/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from collections.abc import Callable, Generator, Iterable, Mapping, MutableMapping
from contextlib import contextmanager
from typing import Any
from typing import Any, Literal, overload

from . import helpers, presets # noqa F401
from .common import normalize_url, utils # noqa F401
Expand Down Expand Up @@ -67,6 +67,26 @@ def __init__(
def __repr__(self) -> str:
return f"{self.__class__.__module__}.{self.__class__.__name__}()"

@overload
def __getitem__(self, name: Literal["inline"]) -> ParserInline:
...

@overload
def __getitem__(self, name: Literal["block"]) -> ParserBlock:
...

@overload
def __getitem__(self, name: Literal["core"]) -> ParserCore:
...

@overload
def __getitem__(self, name: Literal["renderer"]) -> RendererProtocol:
...

@overload
def __getitem__(self, name: str) -> Any:
...

def __getitem__(self, name: str) -> Any:
return {
"inline": self.inline,
Expand Down

0 comments on commit 5accffb

Please sign in to comment.