from __future__ import annotations import typing from types import TracebackType def to_bytes( x: str | bytes, encoding: str | None = None, errors: str | None = None ) -> bytes: if isinstance(x, bytes): return x elif not isinstance(x, str): raise TypeError(f"not expecting type {type(x).__name__}") if encoding or errors: return x.encode(encoding or "utf-8", errors=errors or "strict") return x.encode() def to_str( x: str | bytes, encoding: str | None = None, errors: str | None = None ) -> str: if isinstance(x, str): return x elif not isinstance(x, bytes): raise TypeError(f"not expecting type {type(x).__name__}") if encoding or errors: return x.decode(encoding or "utf-8", errors=errors or "strict") return x.decode() def reraise( tp: type[BaseException] | None, value: BaseException, tb: TracebackType | None = None, ) -> typing.NoReturn: try: if value.__traceback__ is not tb: raise value.with_traceback(tb) raise value finally: value = None # type: ignore[assignment] tb = None
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
__pycache__ | Folder | 0755 |
|
|
__init__.py | File | 1.03 KB | 0644 |
|
connection.py | File | 4.36 KB | 0644 |
|
proxy.py | File | 1.12 KB | 0644 |
|
request.py | File | 7.89 KB | 0644 |
|
response.py | File | 3.29 KB | 0644 |
|
retry.py | File | 17.94 KB | 0644 |
|
ssl_.py | File | 18.79 KB | 0644 |
|
ssl_match_hostname.py | File | 5.68 KB | 0644 |
|
ssltransport.py | File | 8.83 KB | 0644 |
|
timeout.py | File | 10.28 KB | 0644 |
|
url.py | File | 14.86 KB | 0644 |
|
util.py | File | 1.12 KB | 0644 |
|
wait.py | File | 4.32 KB | 0644 |
|