mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-12-06 06:45:00 +01:00
[cleanup] Misc (#8182)
Closes #7796, Closes #8028 Authored by: barsnick, sqrtNOT, gamer191, coletdjnz, Grub4K, bashonly
This commit is contained in:
parent
c2da0b5ea2
commit
5ca095cbcd
20 changed files with 22 additions and 34 deletions
|
|
@ -1,4 +1,4 @@
|
|||
# flake8: noqa: 401
|
||||
# flake8: noqa: F401
|
||||
from .common import (
|
||||
HEADRequest,
|
||||
PUTRequest,
|
||||
|
|
|
|||
|
|
@ -337,7 +337,7 @@ def handle_sslerror(e: ssl.SSLError):
|
|||
|
||||
def handle_response_read_exceptions(e):
|
||||
if isinstance(e, http.client.IncompleteRead):
|
||||
raise IncompleteRead(partial=e.partial, cause=e, expected=e.expected) from e
|
||||
raise IncompleteRead(partial=len(e.partial), cause=e, expected=e.expected) from e
|
||||
elif isinstance(e, ssl.SSLError):
|
||||
handle_sslerror(e)
|
||||
elif isinstance(e, (OSError, EOFError, http.client.HTTPException, *CONTENT_DECODE_ERRORS)):
|
||||
|
|
|
|||
|
|
@ -75,10 +75,10 @@ class HTTPError(RequestError):
|
|||
|
||||
|
||||
class IncompleteRead(TransportError):
|
||||
def __init__(self, partial, expected=None, **kwargs):
|
||||
def __init__(self, partial: int, expected: int = None, **kwargs):
|
||||
self.partial = partial
|
||||
self.expected = expected
|
||||
msg = f'{len(partial)} bytes read'
|
||||
msg = f'{partial} bytes read'
|
||||
if expected is not None:
|
||||
msg += f', {expected} more expected'
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue