Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
senpy
senpy
Commits
a82e4ed4
Commit
a82e4ed4
authored
Oct 30, 2018
by
J. Fernando Sánchez
Browse files
Fix bug in py3.5
parent
c939b095
Changes
3
Hide whitespace changes
Inline
Side-by-side
example-plugins/async_plugin.py
View file @
a82e4ed4
...
@@ -11,7 +11,7 @@ class Async(AnalysisPlugin):
...
@@ -11,7 +11,7 @@ class Async(AnalysisPlugin):
'''An example of an asynchronous module'''
'''An example of an asynchronous module'''
author
=
'@balkian'
author
=
'@balkian'
version
=
'0.2'
version
=
'0.2'
a
sync
=
Tru
e
sync
=
Fals
e
def
_do_async
(
self
,
num_processes
):
def
_do_async
(
self
,
num_processes
):
pool
=
multiprocessing
.
Pool
(
processes
=
num_processes
)
pool
=
multiprocessing
.
Pool
(
processes
=
num_processes
)
...
...
senpy/extensions.py
View file @
a82e4ed4
...
@@ -351,7 +351,7 @@ class Senpy(object):
...
@@ -351,7 +351,7 @@ class Senpy(object):
logger
.
info
(
"Activating plugin: {}"
.
format
(
plugin
.
name
))
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
)
return
self
.
_activate
(
plugin
)
else
:
else
:
th
=
Thread
(
target
=
partial
(
self
.
_activate
,
plugin
))
th
=
Thread
(
target
=
partial
(
self
.
_activate
,
plugin
))
...
@@ -374,7 +374,7 @@ class Senpy(object):
...
@@ -374,7 +374,7 @@ class Senpy(object):
self
.
_set_active
(
plugin
,
False
)
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
)
self
.
_deactivate
(
plugin
)
else
:
else
:
th
=
Thread
(
target
=
partial
(
self
.
_deactivate
,
plugin
))
th
=
Thread
(
target
=
partial
(
self
.
_deactivate
,
plugin
))
...
...
senpy/gsitk_compat.py
View file @
a82e4ed4
import
logging
import
logging
from
pkg_resources
import
parse_version
,
get_distribution
,
DistributionNotFound
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
MSG
=
'GSITK is not (properly) installed.'
MSG
=
'GSITK is not (properly) installed.'
...
@@ -12,15 +14,18 @@ def raise_exception(*args, **kwargs):
...
@@ -12,15 +14,18 @@ def raise_exception(*args, **kwargs):
try
:
try
:
gsitk_distro
=
get_distribution
(
"gsitk"
)
GSITK_VERSION
=
parse_version
(
gsitk_distro
.
version
)
GSITK_AVAILABLE
=
GSITK_VERSION
>
parse_version
(
"0.1.9.1"
)
# Earlier versions have a bug
except
DistributionNotFound
:
GSITK_AVAILABLE
=
False
GSITK_VERSION
=
()
if
GSITK_AVAILABLE
:
from
gsitk.datasets.datasets
import
DatasetManager
from
gsitk.datasets.datasets
import
DatasetManager
from
gsitk.evaluation.evaluation
import
Evaluation
as
Eval
from
gsitk.evaluation.evaluation
import
Evaluation
as
Eval
from
sklearn.pipeline
import
Pipeline
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
modules
=
locals
()
modules
=
locals
()
e
xcept
ImportError
:
e
lse
:
logger
.
warning
(
IMPORTMSG
)
logger
.
warning
(
IMPORTMSG
)
GSITK_AVAILABLE
=
False
GSITK_VERSION
=
()
DatasetManager
=
Eval
=
Pipeline
=
raise_exception
DatasetManager
=
Eval
=
Pipeline
=
raise_exception
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment