[stem/master] Remove 'raw' argument from ControlSocket's send() method

commit 9211f989d15af55314dd50770ad92ae4d9a87016 Author: Damian Johnson <atagar@torproject.org> Date: Sun Dec 31 13:46:26 2017 -0800 Remove 'raw' argument from ControlSocket's send() method From what I can tell this is entirely unused. Probably only there because send_message() has it to help with testing? Deprecating this argument. It'll be removed in Stem 2.0.0. --- docs/change_log.rst | 1 + stem/socket.py | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/change_log.rst b/docs/change_log.rst index 68dd35fc..fcfc0115 100644 --- a/docs/change_log.rst +++ b/docs/change_log.rst @@ -49,6 +49,7 @@ The following are only available within Stem's `git repository * Added support for limiting the maximum number of streams to :func:`~stem.control.Controller.create_ephemeral_hidden_service` (:spec:`2fcb1c2`) * Stacktrace if :func:`stem.connection.connect` had a string port argument * Replaced socket's :func:`~stem.socket.ControlPort.get_address`, :func:`~stem.socket.ControlPort.get_port`, and :func:`~stem.socket.ControlSocketFile.get_socket_path` with attributes + * Removed 'raw' argument from :func:`~stem.socket.ControlSocket.send` * **Descriptors** diff --git a/stem/socket.py b/stem/socket.py index 68ca36bb..7020cdf6 100644 --- a/stem/socket.py +++ b/stem/socket.py @@ -283,13 +283,17 @@ class ControlSocket(BaseSocket): def __init__(self): super(ControlSocket, self).__init__() - def send(self, message, raw = False): + def send(self, message, raw = None): """ Formats and sends a message to the control socket. For more information see the :func:`~stem.socket.send_message` function. + .. deprecated:: 1.7.0 + The **raw** argument is unhelpful and will be removed. Use + :func:`stem.socket.send_message` if you need this level of control + instead. + :param str message: message to be formatted and sent to the socket - :param bool raw: leaves the message formatting untouched, passing it to the socket as-is :raises: * :class:`stem.SocketError` if a problem arises in using the socket @@ -301,7 +305,10 @@ class ControlSocket(BaseSocket): if not self.is_alive(): raise stem.SocketClosed() - send_message(self._socket_file, message, raw) + if raw is None: + send_message(self._socket_file, message) + else: + send_message(self._socket_file, message, raw) except stem.SocketClosed: # if send_message raises a SocketClosed then we should properly shut # everything down
participants (1)
-
atagar@torproject.org