]> git.ipfire.org Git - thirdparty/starlette.git/commitdiff
Update type hints based on `jinja2` (#2604)
authorMarcelo Trylesinski <marcelotryle@gmail.com>
Sat, 1 Jun 2024 13:04:43 +0000 (15:04 +0200)
committerGitHub <noreply@github.com>
Sat, 1 Jun 2024 13:04:43 +0000 (07:04 -0600)
* Update type hints based on jinja2

* Pin anyio

requirements.txt
starlette/templating.py

index 5652a865e949ca216bb485f6cd89fd1bd05c5df5..e828ffeb9d6534605506de65a56ef51e0791b1ad 100644 (file)
@@ -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
index 01af5e9bb01f8ab579954064d87ea946114716f3..8e1737f61bb4e5a255aa4d7792d424a754df354d 100644 (file)
@@ -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,
@@ -89,8 +87,8 @@ class Jinja2Templates:
     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]]]
@@ -117,9 +115,7 @@ class Jinja2Templates:
 
     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)