Skip to content

Commit 5661b96

Browse files
authored
change type annotation for SharedDataMiddleware to handle common scenarios (#2959)
2 parents 6732b57 + e14f4e0 commit 5661b96

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

CHANGES.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Unreleased
88
- The Watchdog reloader ignores file closed no write events. :issue:`2945`
99
- Logging works with client addresses containing an IPv6 scope :issue:`2952`
1010
- Ignore invalid authorization parameters. :issue:`2955`
11+
- Improve type annotation fore ``SharedDataMiddleware``. :issue:`2958`
1112

1213

1314
Version 3.0.4

src/werkzeug/middleware/shared_data.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
from __future__ import annotations
1313

14+
import collections.abc as cabc
1415
import importlib.util
1516
import mimetypes
1617
import os
@@ -103,7 +104,7 @@ def __init__(
103104
self,
104105
app: WSGIApplication,
105106
exports: (
106-
dict[str, str | tuple[str, str]]
107+
cabc.Mapping[str, str | tuple[str, str]]
107108
| t.Iterable[tuple[str, str | tuple[str, str]]]
108109
),
109110
disallow: None = None,
@@ -116,7 +117,7 @@ def __init__(
116117
self.cache = cache
117118
self.cache_timeout = cache_timeout
118119

119-
if isinstance(exports, dict):
120+
if isinstance(exports, cabc.Mapping):
120121
exports = exports.items()
121122

122123
for key, value in exports:

0 commit comments

Comments
 (0)