# python-musicpd: Python MPD client library
# Copyright (C) 2012-2021 kaliko <kaliko@azylum.org>
+# Copyright (C) 2021 Wonko der Verständige <wonko@hanstool.org>
# Copyright (C) 2019 Naglis Jonaitis <naglis@mailbox.org>
# Copyright (C) 2019 Bart Van Loon <bbb@bbbart.be>
# Copyright (C) 2008-2010 J. Alexander Treuman <jat@spatialrift.net>
self._sock.close()
self._reset()
+ def __enter__(self):
+ self.connect()
+ return self
+
+ def __exit__(self, exception_type, exception_value, exception_traceback):
+ self.disconnect()
+
def fileno(self):
"""Return the socket’s file descriptor (a small integer).
This is useful with :py:obj:`select.select`.