From 1a220f5e1ec5096eba648c176a9ee1f646eb359a Mon Sep 17 00:00:00 2001 From: Python3pkg Date: Mon, 22 May 2017 11:27:48 -0700 Subject: [PATCH] Convert to Python3 --- pyromancer/objects.py | 3 ++- pyromancer/test/mock_objects.py | 2 +- pyromancer/utils.py | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pyromancer/objects.py b/pyromancer/objects.py index 56375ae..72e6051 100644 --- a/pyromancer/objects.py +++ b/pyromancer/objects.py @@ -8,6 +8,7 @@ import time from pyromancer import utils +import collections class Pyromancer(object): @@ -418,7 +419,7 @@ def __init__(self, scheduled, msg_or_command=None, *args, **kwargs): self.msg_tuple = None self.function = None - if callable(msg_or_command): + if isinstance(msg_or_command, collections.Callable): self.function = msg_or_command else: if target is not None and msg_or_command is not None: diff --git a/pyromancer/test/mock_objects.py b/pyromancer/test/mock_objects.py index 246b3c3..7b4a81e 100644 --- a/pyromancer/test/mock_objects.py +++ b/pyromancer/test/mock_objects.py @@ -4,7 +4,7 @@ class MockObject(object): def __init__(self, **kwargs): - for key, val in kwargs.items(): + for key, val in list(kwargs.items()): setattr(self, key, val) diff --git a/pyromancer/utils.py b/pyromancer/utils.py index 45d578d..a515662 100644 --- a/pyromancer/utils.py +++ b/pyromancer/utils.py @@ -2,6 +2,7 @@ import importlib import inspect from types import GeneratorType +import collections def find_functions(packages, into, submodule, ignored=None, @@ -61,7 +62,7 @@ def process_messages(result, with_target=False): msg = msg[1:] timer = True - if callable(msg[0]): + if isinstance(msg[0], collections.Callable): get_target = False target = None else: