Skip to content

Commit

Permalink
Update type hints based on jinja2 (encode#2604)
Browse files Browse the repository at this point in the history
* Update type hints based on jinja2

* Pin anyio
  • Loading branch information
Kludex authored and Rocky Allen committed Jul 20, 2024
1 parent 90b0cbd commit fd7aa0a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Optionals
-e .[full]

# TODO: We need to delete the following line when fixing the test suite for anyio 4.4.0.
anyio==4.3.0

# Testing
coverage==7.4.3
importlib-metadata==7.0.1
Expand Down
12 changes: 4 additions & 8 deletions starlette/templating.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ class Jinja2Templates:
@typing.overload
def __init__(
self,
directory: str
| PathLike[typing.AnyStr]
| typing.Sequence[str | PathLike[typing.AnyStr]],
directory: str | PathLike[str] | typing.Sequence[str | PathLike[str]],
*,
context_processors: list[typing.Callable[[Request], dict[str, typing.Any]]]
| None = None,
Expand All @@ -89,8 +87,8 @@ def __init__(
def __init__(
self,
directory: str
| PathLike[typing.AnyStr]
| typing.Sequence[str | PathLike[typing.AnyStr]]
| PathLike[str]
| typing.Sequence[str | PathLike[str]]
| None = None,
*,
context_processors: list[typing.Callable[[Request], dict[str, typing.Any]]]
Expand All @@ -117,9 +115,7 @@ def __init__(

def _create_env(
self,
directory: str
| PathLike[typing.AnyStr]
| typing.Sequence[str | PathLike[typing.AnyStr]],
directory: str | PathLike[str] | typing.Sequence[str | PathLike[str]],
**env_options: typing.Any,
) -> jinja2.Environment:
loader = jinja2.FileSystemLoader(directory)
Expand Down

0 comments on commit fd7aa0a

Please sign in to comment.