Skip to content

Commit

Permalink
Broaden allowed return type of write callable
Browse files Browse the repository at this point in the history
If you don't care what the callable returns, it's better to use `object` so users can pass a callable that returns something else. For example, some `.write()` methods return the number of bytes written.

Noticed this in python/mypy#12663.
  • Loading branch information
JelleZijlstra authored Apr 23, 2022
1 parent c7ae2fe commit 20425a6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/werkzeug/middleware/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def close(self) -> None:


class GuardedWrite:
def __init__(self, write: t.Callable[[bytes], None], chunks: t.List[int]) -> None:
def __init__(self, write: t.Callable[[bytes], object], chunks: t.List[int]) -> None:
self._write = write
self._chunks = chunks

Expand Down

0 comments on commit 20425a6

Please sign in to comment.