Voice et bot modif
This commit is contained in:
parent
189d56026b
commit
7333a22bcd
10774 changed files with 634644 additions and 933308 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import asyncio
|
||||
import warnings
|
||||
from typing import TYPE_CHECKING, Optional, Tuple, Union
|
||||
from typing import TYPE_CHECKING, Union
|
||||
|
||||
from multidict import MultiMapping
|
||||
|
||||
|
|
@ -75,12 +75,12 @@ class ClientResponseError(ClientError):
|
|||
def __init__(
|
||||
self,
|
||||
request_info: RequestInfo,
|
||||
history: Tuple[ClientResponse, ...],
|
||||
history: tuple[ClientResponse, ...],
|
||||
*,
|
||||
code: Optional[int] = None,
|
||||
status: Optional[int] = None,
|
||||
code: int | None = None,
|
||||
status: int | None = None,
|
||||
message: str = "",
|
||||
headers: Optional[MultiMapping[str]] = None,
|
||||
headers: MultiMapping[str] | None = None,
|
||||
) -> None:
|
||||
self.request_info = request_info
|
||||
if code is not None:
|
||||
|
|
@ -106,11 +106,7 @@ class ClientResponseError(ClientError):
|
|||
self.args = (request_info, history)
|
||||
|
||||
def __str__(self) -> str:
|
||||
return "{}, message={!r}, url={!r}".format(
|
||||
self.status,
|
||||
self.message,
|
||||
str(self.request_info.real_url),
|
||||
)
|
||||
return f"{self.status}, message={self.message!r}, url={str(self.request_info.real_url)!r}"
|
||||
|
||||
def __repr__(self) -> str:
|
||||
args = f"{self.request_info!r}, {self.history!r}"
|
||||
|
|
@ -196,7 +192,7 @@ class ClientConnectorError(ClientOSError):
|
|||
return self._conn_key.host
|
||||
|
||||
@property
|
||||
def port(self) -> Optional[int]:
|
||||
def port(self) -> int | None:
|
||||
return self._conn_key.port
|
||||
|
||||
@property
|
||||
|
|
@ -258,7 +254,7 @@ class ServerConnectionError(ClientConnectionError):
|
|||
class ServerDisconnectedError(ServerConnectionError):
|
||||
"""Server disconnected."""
|
||||
|
||||
def __init__(self, message: Union[RawResponseMessage, str, None] = None) -> None:
|
||||
def __init__(self, message: RawResponseMessage | str | None = None) -> None:
|
||||
if message is None:
|
||||
message = "Server disconnected"
|
||||
|
||||
|
|
@ -289,9 +285,7 @@ class ServerFingerprintMismatch(ServerConnectionError):
|
|||
self.args = (expected, got, host, port)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return "<{} expected={!r} got={!r} host={!r} port={!r}>".format(
|
||||
self.__class__.__name__, self.expected, self.got, self.host, self.port
|
||||
)
|
||||
return f"<{self.__class__.__name__} expected={self.expected!r} got={self.got!r} host={self.host!r} port={self.port!r}>"
|
||||
|
||||
|
||||
class ClientPayloadError(ClientError):
|
||||
|
|
@ -307,7 +301,7 @@ class InvalidURL(ClientError, ValueError):
|
|||
|
||||
# Derive from ValueError for backward compatibility
|
||||
|
||||
def __init__(self, url: StrOrURL, description: Union[str, None] = None) -> None:
|
||||
def __init__(self, url: StrOrURL, description: str | None = None) -> None:
|
||||
# The type of url is not yarl.URL because the exception can be raised
|
||||
# on URL(url) call
|
||||
self._url = url
|
||||
|
|
@ -386,10 +380,21 @@ class ClientConnectorSSLError(*ssl_error_bases): # type: ignore[misc]
|
|||
class ClientConnectorCertificateError(*cert_errors_bases): # type: ignore[misc]
|
||||
"""Response certificate error."""
|
||||
|
||||
_conn_key: ConnectionKey
|
||||
|
||||
def __init__(
|
||||
self, connection_key: ConnectionKey, certificate_error: Exception
|
||||
# TODO: If we require ssl in future, this can become ssl.CertificateError
|
||||
self,
|
||||
connection_key: ConnectionKey,
|
||||
certificate_error: Exception,
|
||||
) -> None:
|
||||
self._conn_key = connection_key
|
||||
if isinstance(certificate_error, cert_errors + (OSError,)):
|
||||
# ssl.CertificateError has errno and strerror, so we should be fine
|
||||
os_error = certificate_error
|
||||
else:
|
||||
os_error = OSError()
|
||||
|
||||
super().__init__(connection_key, os_error)
|
||||
self._certificate_error = certificate_error
|
||||
self.args = (connection_key, certificate_error)
|
||||
|
||||
|
|
@ -402,7 +407,7 @@ class ClientConnectorCertificateError(*cert_errors_bases): # type: ignore[misc]
|
|||
return self._conn_key.host
|
||||
|
||||
@property
|
||||
def port(self) -> Optional[int]:
|
||||
def port(self) -> int | None:
|
||||
return self._conn_key.port
|
||||
|
||||
@property
|
||||
|
|
@ -411,9 +416,9 @@ class ClientConnectorCertificateError(*cert_errors_bases): # type: ignore[misc]
|
|||
|
||||
def __str__(self) -> str:
|
||||
return (
|
||||
"Cannot connect to host {0.host}:{0.port} ssl:{0.ssl} "
|
||||
"[{0.certificate_error.__class__.__name__}: "
|
||||
"{0.certificate_error.args}]".format(self)
|
||||
f"Cannot connect to host {self.host}:{self.port} ssl:{self.ssl} "
|
||||
f"[{self.certificate_error.__class__.__name__}: "
|
||||
f"{self.certificate_error.args}]"
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue