Skip to content

Commit cda95c0

Browse files
committed
tweak
1 parent dad2379 commit cda95c0

File tree

2 files changed

+14
-25
lines changed

2 files changed

+14
-25
lines changed

ld_eventsource/async_http.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66
import aiohttp
77

8-
from ld_eventsource.errors import HTTPContentTypeError, HTTPStatusError, Headers
8+
from ld_eventsource.errors import (Headers, HTTPContentTypeError,
9+
HTTPStatusError)
910

1011
_CHUNK_SIZE = 10000
1112

ld_eventsource/errors.py

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,15 @@
1-
from typing import Any, Iterator, Optional, Protocol, Tuple, runtime_checkable
2-
3-
4-
class Headers(Protocol):
5-
"""
6-
A case-insensitive mapping of HTTP response headers.
7-
8-
Header name lookups are case-insensitive per RFC 7230, so
9-
``headers.get('content-type')`` and ``headers.get('Content-Type')``
10-
return the same value. The concrete type returned depends on the HTTP
11-
backend in use and should not be relied upon directly.
12-
"""
13-
14-
def get(self, key: str, default: Any = None) -> Any:
15-
"""Return the value for *key* (case-insensitive), or *default*."""
16-
...
17-
18-
def __getitem__(self, key: str) -> Any: ...
19-
20-
def __contains__(self, key: object) -> bool: ...
21-
22-
def __iter__(self) -> Iterator[str]: ...
23-
24-
def items(self) -> Any: ...
1+
from collections.abc import Mapping
2+
from typing import Any, Optional, Protocol, runtime_checkable
3+
4+
Headers = Mapping[str, Any]
5+
"""
6+
A case-insensitive mapping of HTTP response headers.
7+
8+
Header name lookups are case-insensitive per RFC 7230, so
9+
``headers.get('content-type')`` and ``headers.get('Content-Type')``
10+
return the same value. The concrete type returned depends on the HTTP
11+
backend in use and should not be relied upon directly.
12+
"""
2513

2614

2715
@runtime_checkable

0 commit comments

Comments
 (0)