Skip to content

Commit d30d25e

Browse files
committed
Replaces TypeVar "F" with type alias FilterFunction and applies the same fix for TESTS
1 parent c9d2d81 commit d30d25e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/jinja2/filters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __html__(self) -> str:
4141
pass
4242

4343

44-
F = t.TypeVar("F", bound=t.Callable[..., t.Any])
44+
FilterFunction = t.Callable[..., t.Any]
4545
K = t.TypeVar("K")
4646
V = t.TypeVar("V")
4747

@@ -1815,7 +1815,7 @@ async def async_select_or_reject(
18151815
yield item
18161816

18171817

1818-
FILTERS: t.Dict[str, F] = {
1818+
FILTERS: t.Dict[str, FilterFunction] = {
18191819
"abs": abs,
18201820
"attr": do_attr,
18211821
"batch": do_batch,

src/jinja2/tests.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
from .environment import Environment
1313

1414

15+
TestFunction = t.Callable[..., t.Any]
16+
17+
1518
def test_odd(value: int) -> bool:
1619
"""Return true if the variable is odd."""
1720
return value % 2 == 1
@@ -213,7 +216,7 @@ def test_in(value: t.Any, seq: t.Container[t.Any]) -> bool:
213216
return value in seq
214217

215218

216-
TESTS = {
219+
TESTS: t.Dict[str, TestFunction] = {
217220
"odd": test_odd,
218221
"even": test_even,
219222
"divisibleby": test_divisibleby,

0 commit comments

Comments
 (0)