Skip to content

Commit 24fa8c8

Browse files
rkdlasvetlov
andauthored
proper type annotation for filters in aiohttp_jinja2.setup (#331)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
1 parent 81acf7f commit 24fa8c8

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

aiohttp_jinja2/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from aiohttp import web
88
from aiohttp.abc import AbstractView
99
from .helpers import GLOBAL_HELPERS
10+
from .typedefs import Filters
1011

1112

1213
__version__ = '1.2.0'
@@ -24,7 +25,7 @@ def setup(
2425
*args: Any,
2526
app_key: str = APP_KEY,
2627
context_processors: Iterable[Callable[[web.Request], Dict[str, Any]]] = (),
27-
filters: Optional[Iterable[Callable[..., str]]] = None,
28+
filters: Optional[Filters] = None,
2829
default_helpers: bool = True,
2930
**kwargs: Any
3031
) -> jinja2.Environment:

aiohttp_jinja2/typedefs.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from typing import Callable, Union, Iterable, Tuple, Mapping
2+
3+
Filter = Callable[..., str]
4+
Filters = Union[Iterable[Tuple[str, Filter]], Mapping[str, Filter]]

0 commit comments

Comments
 (0)