Skip to content

Commit

Permalink
Fix bug in py3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
balkian committed Oct 30, 2018
1 parent c939b09 commit 723b4a7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion example-plugins/async_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Async(AnalysisPlugin):
'''An example of an asynchronous module'''
author = '@balkian'
version = '0.2'
async = True
sync = False

def _do_async(self, num_processes):
pool = multiprocessing.Pool(processes=num_processes)
Expand Down
4 changes: 2 additions & 2 deletions senpy/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def activate_plugin(self, plugin_name, sync=True):

logger.info("Activating plugin: {}".format(plugin.name))

if sync or not getattr(plugin, 'async', True):
if sync or not getattr(plugin, 'async', True) or getattr(plugin, 'sync', False):
return self._activate(plugin)
else:
th = Thread(target=partial(self._activate, plugin))
Expand All @@ -374,7 +374,7 @@ def deactivate_plugin(self, plugin_name, sync=True):

self._set_active(plugin, False)

if sync or not getattr(plugin, 'async', True):
if sync or not getattr(plugin, 'async', True) or not getattr(plugin, 'sync', False):
self._deactivate(plugin)
else:
th = Thread(target=partial(self._deactivate, plugin))
Expand Down
5 changes: 3 additions & 2 deletions senpy/gsitk_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ def raise_exception(*args, **kwargs):
from gsitk.evaluation.evaluation import Evaluation as Eval
from sklearn.pipeline import Pipeline
import pkg_resources
GSITK_VERSION = pkg_resources.get_distribution("gsitk").version.split()
GSITK_AVAILABLE = GSITK_VERSION > (0, 1, 9, 1) # Earlier versions have a bug
from packaging import version
GSITK_VERSION = version.parse(pkg_resources.get_distribution("gsitk").version)
GSITK_AVAILABLE = GSITK_VERSION > version.parse("0.1.9.1") # Earlier versions have a bug
modules = locals()
except ImportError:
logger.warning(IMPORTMSG)
Expand Down

0 comments on commit 723b4a7

Please sign in to comment.