Skip to content

Commit ea63f14

Browse files
Version 0.8.1 (#68)
1 parent 6051919 commit ea63f14

File tree

6 files changed

+18
-10
lines changed

6 files changed

+18
-10
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

7+
## 0.8.1 (April 30th, 2020)
8+
9+
### Changed
10+
11+
- Allow inherintance of both `httpcore.AsyncByteStream`, `httpcore.SyncByteStream` without type conflicts.
12+
713
## 0.8.0 (April 30th, 2020)
814

915
### Fixed

httpcore/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@
3939
"WriteError",
4040
"CloseError",
4141
]
42-
__version__ = "0.8.0"
42+
__version__ = "0.8.1"

httpcore/_async/base.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,24 @@ class AsyncByteStream:
4545
"""
4646

4747
def __init__(
48-
self, iterator: AsyncIterator[bytes] = None, close_func: Callable = None,
48+
self, aiterator: AsyncIterator[bytes] = None, aclose_func: Callable = None,
4949
) -> None:
50-
self.iterator = empty() if iterator is None else iterator
51-
self.close_func = close_func
50+
self.aiterator = empty() if aiterator is None else aiterator
51+
self.aclose_func = aclose_func
5252

5353
async def __aiter__(self) -> AsyncIterator[bytes]:
5454
"""
5555
Yield bytes representing the request or response body.
5656
"""
57-
async for chunk in self.iterator:
57+
async for chunk in self.aiterator:
5858
yield chunk
5959

6060
async def aclose(self) -> None:
6161
"""
6262
Must be called by the client to indicate that the stream has been closed.
6363
"""
64-
if self.close_func is not None:
65-
await self.close_func()
64+
if self.aclose_func is not None:
65+
await self.aclose_func()
6666

6767

6868
class AsyncHTTPTransport:

httpcore/_async/http11.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ async def request(
5858
headers,
5959
) = await self._receive_response(timeout)
6060
stream = AsyncByteStream(
61-
iterator=self._receive_response_data(timeout),
62-
close_func=self._response_closed,
61+
aiterator=self._receive_response_data(timeout),
62+
aclose_func=self._response_closed,
6363
)
6464
return (http_version, status_code, reason_phrase, headers, stream)
6565

httpcore/_async/http2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ async def request(
263263
status_code, headers = await self.receive_response(timeout)
264264
reason_phrase = get_reason_phrase(status_code)
265265
stream = AsyncByteStream(
266-
iterator=self.body_iter(timeout), close_func=self._response_closed
266+
aiterator=self.body_iter(timeout), aclose_func=self._response_closed
267267
)
268268

269269
return (b"HTTP/2", status_code, reason_phrase, headers, stream)

unasync.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
('async for', 'for'),
1313
('await ', ''),
1414
('aclose', 'close'),
15+
('aclose_func', 'close_func'),
16+
('aiterator', 'iterator'),
1517
('__aenter__', '__enter__'),
1618
('__aexit__', '__exit__'),
1719
('__aiter__', '__iter__'),

0 commit comments

Comments
 (0)