Skip to content

Commit

Permalink
change type annotation for SharedDataMiddleware to handle common scen…
Browse files Browse the repository at this point in the history
…arios (#2959)
  • Loading branch information
davidism authored Oct 24, 2024
2 parents 6732b57 + e14f4e0 commit 5661b96
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Unreleased
- The Watchdog reloader ignores file closed no write events. :issue:`2945`
- Logging works with client addresses containing an IPv6 scope :issue:`2952`
- Ignore invalid authorization parameters. :issue:`2955`
- Improve type annotation fore ``SharedDataMiddleware``. :issue:`2958`


Version 3.0.4
Expand Down
5 changes: 3 additions & 2 deletions src/werkzeug/middleware/shared_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from __future__ import annotations

import collections.abc as cabc
import importlib.util
import mimetypes
import os
Expand Down Expand Up @@ -103,7 +104,7 @@ def __init__(
self,
app: WSGIApplication,
exports: (
dict[str, str | tuple[str, str]]
cabc.Mapping[str, str | tuple[str, str]]
| t.Iterable[tuple[str, str | tuple[str, str]]]
),
disallow: None = None,
Expand All @@ -116,7 +117,7 @@ def __init__(
self.cache = cache
self.cache_timeout = cache_timeout

if isinstance(exports, dict):
if isinstance(exports, cabc.Mapping):
exports = exports.items()

for key, value in exports:
Expand Down

0 comments on commit 5661b96

Please sign in to comment.