Skip to content

Commit

Permalink
No longer depend on collections.Callable (#109)
Browse files Browse the repository at this point in the history
No longer depend on collections.Callable
  • Loading branch information
Mic92 committed Jan 22, 2020
2 parents 6588692 + 853015e commit 091217f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions mpd/base.py
Expand Up @@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with python-mpd2. If not, see <http://www.gnu.org/licenses/>.

from collections import Callable
import logging
import socket
import sys
Expand Down Expand Up @@ -368,7 +367,7 @@ def _parse_stickers(self, lines):
def _create_callback(self, function, wrap_result):
"""Create MPD command related response callback.
"""
if not isinstance(function, Callable):
if not callable(function):
return None

def command_callback():
Expand Down Expand Up @@ -460,7 +459,7 @@ def _fetch(self, command, args, retval):
raise PendingCommandError(
"'{}' is not the currently pending command".format(command))
del self._pending[0]
if isinstance(retval, Callable):
if callable(retval):
return retval()
return retval

Expand All @@ -472,14 +471,14 @@ def _execute(self, command, args, retval):
raise PendingCommandError(
"Cannot execute '{}' with pending commands".format(command))
if self._command_list is not None:
if not isinstance(retval, Callable):
if not callable(retval):
raise CommandListError(
"'{}' not allowed in command list".format(command))
self._write_command(command, args)
self._command_list.append(retval)
else:
self._write_command(command, args)
if isinstance(retval, Callable):
if callable(retval):
return retval()
return retval

Expand Down

0 comments on commit 091217f

Please sign in to comment.