mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
speed-up deprecation process
This commit is contained in:
parent
60342344e4
commit
0ddc24d068
@ -28,7 +28,7 @@ class AsyncReply(controller.Reply):
|
||||
pass # event loop may already be closed.
|
||||
|
||||
def kill(self, force=False): # pragma: no cover
|
||||
warnings.warn("reply.kill() is deprecated, set the error attribute instead.", PendingDeprecationWarning, stacklevel=2)
|
||||
warnings.warn("reply.kill() is deprecated, set the error attribute instead.", DeprecationWarning, stacklevel=2)
|
||||
self.obj.error = flow.Error(Error.KILLED_MESSAGE)
|
||||
|
||||
|
||||
|
@ -97,7 +97,7 @@ class Connection(serializable.Serializable, metaclass=ABCMeta):
|
||||
|
||||
@property
|
||||
def alpn_proto_negotiated(self) -> Optional[bytes]: # pragma: no cover
|
||||
warnings.warn("Server.alpn_proto_negotiated is deprecated, use Server.alpn instead.", PendingDeprecationWarning)
|
||||
warnings.warn("Server.alpn_proto_negotiated is deprecated, use Server.alpn instead.", DeprecationWarning)
|
||||
return self.alpn
|
||||
|
||||
|
||||
@ -174,22 +174,22 @@ class Client(Connection):
|
||||
|
||||
@property
|
||||
def address(self): # pragma: no cover
|
||||
warnings.warn("Client.address is deprecated, use Client.peername instead.", PendingDeprecationWarning, stacklevel=2)
|
||||
warnings.warn("Client.address is deprecated, use Client.peername instead.", DeprecationWarning, stacklevel=2)
|
||||
return self.peername
|
||||
|
||||
@address.setter
|
||||
def address(self, x): # pragma: no cover
|
||||
warnings.warn("Client.address is deprecated, use Client.peername instead.", PendingDeprecationWarning, stacklevel=2)
|
||||
warnings.warn("Client.address is deprecated, use Client.peername instead.", DeprecationWarning, stacklevel=2)
|
||||
self.peername = x
|
||||
|
||||
@property
|
||||
def cipher_name(self) -> Optional[str]: # pragma: no cover
|
||||
warnings.warn("Client.cipher_name is deprecated, use Client.cipher instead.", PendingDeprecationWarning, stacklevel=2)
|
||||
warnings.warn("Client.cipher_name is deprecated, use Client.cipher instead.", DeprecationWarning, stacklevel=2)
|
||||
return self.cipher
|
||||
|
||||
@property
|
||||
def clientcert(self) -> Optional[certs.Cert]: # pragma: no cover
|
||||
warnings.warn("Client.clientcert is deprecated, use Client.certificate_list instead.", PendingDeprecationWarning, stacklevel=2)
|
||||
warnings.warn("Client.clientcert is deprecated, use Client.certificate_list instead.", DeprecationWarning, stacklevel=2)
|
||||
if self.certificate_list:
|
||||
return self.certificate_list[0]
|
||||
else:
|
||||
@ -197,7 +197,7 @@ class Client(Connection):
|
||||
|
||||
@clientcert.setter
|
||||
def clientcert(self, val): # pragma: no cover
|
||||
warnings.warn("Client.clientcert is deprecated, use Client.certificate_list instead.", PendingDeprecationWarning)
|
||||
warnings.warn("Client.clientcert is deprecated, use Client.certificate_list instead.", DeprecationWarning)
|
||||
if val:
|
||||
self.certificate_list = [val]
|
||||
else:
|
||||
@ -278,12 +278,12 @@ class Server(Connection):
|
||||
|
||||
@property
|
||||
def ip_address(self) -> Optional[Address]: # pragma: no cover
|
||||
warnings.warn("Server.ip_address is deprecated, use Server.peername instead.", PendingDeprecationWarning, stacklevel=2)
|
||||
warnings.warn("Server.ip_address is deprecated, use Server.peername instead.", DeprecationWarning, stacklevel=2)
|
||||
return self.peername
|
||||
|
||||
@property
|
||||
def cert(self) -> Optional[certs.Cert]: # pragma: no cover
|
||||
warnings.warn("Server.cert is deprecated, use Server.certificate_list instead.", PendingDeprecationWarning, stacklevel=2)
|
||||
warnings.warn("Server.cert is deprecated, use Server.certificate_list instead.", DeprecationWarning, stacklevel=2)
|
||||
if self.certificate_list:
|
||||
return self.certificate_list[0]
|
||||
else:
|
||||
@ -291,7 +291,7 @@ class Server(Connection):
|
||||
|
||||
@cert.setter
|
||||
def cert(self, val): # pragma: no cover
|
||||
warnings.warn("Server.cert is deprecated, use Server.certificate_list instead.", PendingDeprecationWarning, stacklevel=2)
|
||||
warnings.warn("Server.cert is deprecated, use Server.certificate_list instead.", DeprecationWarning, stacklevel=2)
|
||||
if val:
|
||||
self.certificate_list = [val]
|
||||
else:
|
||||
|
@ -48,7 +48,7 @@ class WebSocketMessage(serializable.Serializable):
|
||||
else:
|
||||
return "binary message: {}".format(strutils.bytes_to_escaped_str(self.content))
|
||||
|
||||
def kill(self):
|
||||
def kill(self): # pragma: no cover
|
||||
"""
|
||||
Kill this message.
|
||||
|
||||
@ -56,7 +56,7 @@ class WebSocketMessage(serializable.Serializable):
|
||||
"""
|
||||
warnings.warn(
|
||||
"WebSocketMessage.kill is deprecated, set an empty content instead.",
|
||||
PendingDeprecationWarning,
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
# empty str or empty bytes.
|
||||
|
Loading…
Reference in New Issue
Block a user