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.
|
pass # event loop may already be closed.
|
||||||
|
|
||||||
def kill(self, force=False): # pragma: no cover
|
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)
|
self.obj.error = flow.Error(Error.KILLED_MESSAGE)
|
||||||
|
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ class Connection(serializable.Serializable, metaclass=ABCMeta):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def alpn_proto_negotiated(self) -> Optional[bytes]: # pragma: no cover
|
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
|
return self.alpn
|
||||||
|
|
||||||
|
|
||||||
@ -174,22 +174,22 @@ class Client(Connection):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def address(self): # pragma: no cover
|
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
|
return self.peername
|
||||||
|
|
||||||
@address.setter
|
@address.setter
|
||||||
def address(self, x): # pragma: no cover
|
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
|
self.peername = x
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def cipher_name(self) -> Optional[str]: # pragma: no cover
|
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
|
return self.cipher
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def clientcert(self) -> Optional[certs.Cert]: # pragma: no cover
|
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:
|
if self.certificate_list:
|
||||||
return self.certificate_list[0]
|
return self.certificate_list[0]
|
||||||
else:
|
else:
|
||||||
@ -197,7 +197,7 @@ class Client(Connection):
|
|||||||
|
|
||||||
@clientcert.setter
|
@clientcert.setter
|
||||||
def clientcert(self, val): # pragma: no cover
|
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:
|
if val:
|
||||||
self.certificate_list = [val]
|
self.certificate_list = [val]
|
||||||
else:
|
else:
|
||||||
@ -278,12 +278,12 @@ class Server(Connection):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def ip_address(self) -> Optional[Address]: # pragma: no cover
|
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
|
return self.peername
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def cert(self) -> Optional[certs.Cert]: # pragma: no cover
|
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:
|
if self.certificate_list:
|
||||||
return self.certificate_list[0]
|
return self.certificate_list[0]
|
||||||
else:
|
else:
|
||||||
@ -291,7 +291,7 @@ class Server(Connection):
|
|||||||
|
|
||||||
@cert.setter
|
@cert.setter
|
||||||
def cert(self, val): # pragma: no cover
|
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:
|
if val:
|
||||||
self.certificate_list = [val]
|
self.certificate_list = [val]
|
||||||
else:
|
else:
|
||||||
|
@ -48,7 +48,7 @@ class WebSocketMessage(serializable.Serializable):
|
|||||||
else:
|
else:
|
||||||
return "binary message: {}".format(strutils.bytes_to_escaped_str(self.content))
|
return "binary message: {}".format(strutils.bytes_to_escaped_str(self.content))
|
||||||
|
|
||||||
def kill(self):
|
def kill(self): # pragma: no cover
|
||||||
"""
|
"""
|
||||||
Kill this message.
|
Kill this message.
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ class WebSocketMessage(serializable.Serializable):
|
|||||||
"""
|
"""
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"WebSocketMessage.kill is deprecated, set an empty content instead.",
|
"WebSocketMessage.kill is deprecated, set an empty content instead.",
|
||||||
PendingDeprecationWarning,
|
DeprecationWarning,
|
||||||
stacklevel=2,
|
stacklevel=2,
|
||||||
)
|
)
|
||||||
# empty str or empty bytes.
|
# empty str or empty bytes.
|
||||||
|
Loading…
Reference in New Issue
Block a user