Updating docstrings
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Tom Christie · committed by Tom Christie · parent 891548e · Browse files · 3 files·+52 added−14 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+52 added−14 removed
- other:+52 added−14 removed
Provenance
- Commit
5f8000f- Tree
b2b4c8a- Author
Tom Christie <tom@tomchristie.com>- Committer
Tom Christie <tom@tomchristie.com>- Parent
891548e
3 files changed+52 added−14 removed
modified:httpcore/decoders.py+6 added-3 removed
21 unmodified lines22 raise NotImplementedError() # pragma: nocover23 24 25 class IdentityDecoder(Decoder):26+ """27+ Handle unencoded data.28+ """29+30 def decode(self, data: bytes) -> bytes:31 return data32 33 def flush(self) -> bytes:49 unmodified lines83 class BrotliDecoder(Decoder):84 """85 Handle 'brotli' decoding.86 83- Requires `pip install brotlipy`.84- See: https://brotlipy.readthedocs.io/87+ Requires `pip install brotlipy`. See: https://brotlipy.readthedocs.io/88 """89 90 def __init__(self) -> None:91 assert (21 unmodified lines113 """114 115 def __init__(self, children: typing.Sequence[Decoder]) -> None:116 """114- children should be a sequence of decoders in the order in which117+ 'children' should be a sequence of decoders in the order in which118 each was applied.119 """120 # Note that we reverse the order for decoding.121 self.children = list(reversed(children))28 unmodified linesmodified:httpcore/exceptions.py+20 added-11 removed
38 unmodified lines39 Malformed HTTP.40 """41 42 43+class DecodingError(Exception):44+ """45+ Decoding of the response failed.46+ """47+48+49 # Redirect exceptions...50 51 52 class RedirectError(Exception):20 unmodified lines73 Infinite redirect loop.74 """75 76 71-# Response exceptions...77+# Stream exceptions...78 79 74-class StreamConsumed(Exception):80+class StreamException(Exception):81 """82+ The base class for stream exceptions.83+84+ The developer made an error in accessing the request stream in85+ an invalid way.86+ """87+88+89+class StreamConsumed(StreamException):90+ """91 Attempted to read or stream response content, but the content has already92 been streamed.93 """94 95 81-class ResponseNotRead(Exception):96+class ResponseNotRead(StreamException):97 """98 Attempted to access response content, without having called `read()`99 after a streaming response.100 """101 102 88-class ResponseClosed(Exception):103+class ResponseClosed(StreamException):104 """105 Attempted to read or stream response content, but the request has been91- closed without loading the body.106+ closed.107 """108 109 95-class DecodingError(Exception):96- """97- Decoding of the response failed.98- """99-100-110 # Other cases...111 112 113 class InvalidURL(Exception):3 unmodified linesmodified:httpcore/interfaces.py+26 added
6 unmodified lines7 OptionalTimeout = typing.Optional[TimeoutConfig]8 9 10 class Adapter:11+ """12+ The base class for all adapter or dispatcher classes.13+14+ Stubs out the interface, as well as providing a `.request()` convienence15+ implementation, to make it easy to use or test stand-alone adapters,16+ without requiring a complete `Client` instance.17+ """18+19 async def request(20 self,21 method: str,22 url: URLTypes,28 unmodified lines51 await self.close()52 53 54 class BaseReader:55+ """56+ A stream reader. Abstracts away any asyncio-specfic interfaces57+ into a more generic base class, that we can use with alternate58+ backend, or for stand-alone test cases.59+ """60+61 async def read(self, n: int, timeout: OptionalTimeout = None) -> bytes:62 raise NotImplementedError() # pragma: no cover63 64 65 class BaseWriter:66+ """67+ A stream writer. Abstracts away any asyncio-specfic interfaces68+ into a more generic base class, that we can use with alternate69+ backend, or for stand-alone test cases.70+ """71+72 def write_no_block(self, data: bytes) -> None:73 raise NotImplementedError() # pragma: no cover74 75 async def write(self, data: bytes, timeout: OptionalTimeout = None) -> None:3 unmodified lines79 raise NotImplementedError() # pragma: no cover80 81 82 class BasePoolSemaphore:83+ """84+ A semaphore for use with connection pooling.85+86+ Abstracts away any asyncio-specfic interfaces.87+ """88+89 async def acquire(self) -> None:90 raise NotImplementedError() # pragma: no cover91 92 def release(self) -> None:1 unmodified line