1
0
mirror of https://github.com/gsi-upm/senpy synced 2025-06-30 18:12:22 +00:00
senpy/senpy/gsitk_compat.py
2018-10-30 15:15:37 +01:00

27 lines
818 B
Python

import logging
logger = logging.getLogger(__name__)
MSG = 'GSITK is not (properly) installed.'
IMPORTMSG = '{} Some functions will be unavailable.'.format(MSG)
RUNMSG = '{} Install it to use this function.'.format(MSG)
def raise_exception(*args, **kwargs):
raise Exception(RUNMSG)
try:
from gsitk.datasets.datasets import DatasetManager
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
modules = locals()
except ImportError:
logger.warning(IMPORTMSG)
GSITK_AVAILABLE = False
GSITK_VERSION = ()
DatasetManager = Eval = Pipeline = raise_exception