From 82ceb482794e60563e745a18dc04633ead0c65fd Mon Sep 17 00:00:00 2001 From: Eleftherios Zisis Date: Wed, 27 Apr 2022 21:30:07 +0200 Subject: [PATCH] Remove deprecations (#1026) Remove deprecated modules and deprecation warning. viewer module was not included to be treated separately --- neurom/__init__.py | 1 - neurom/check/neuron_checks.py | 8 -------- neurom/check/runner.py | 11 +++++------ neurom/core/__init__.py | 2 +- neurom/core/morphology.py | 18 +----------------- neurom/core/neuron.py | 8 -------- neurom/features/sectionfunc.py | 8 -------- neurom/io/utils.py | 15 --------------- 8 files changed, 7 insertions(+), 64 deletions(-) delete mode 100644 neurom/check/neuron_checks.py delete mode 100644 neurom/core/neuron.py delete mode 100644 neurom/features/sectionfunc.py diff --git a/neurom/__init__.py b/neurom/__init__.py index 2b2f24aa..076a54ed 100644 --- a/neurom/__init__.py +++ b/neurom/__init__.py @@ -61,7 +61,6 @@ from neurom.features import get from neurom.io.utils import MorphLoader, load_morphology, load_morphologies -from neurom.io.utils import load_neuron, load_neurons from neurom.exceptions import NeuroMDeprecationWarning APICAL_DENDRITE = NeuriteType.apical_dendrite diff --git a/neurom/check/neuron_checks.py b/neurom/check/neuron_checks.py deleted file mode 100644 index 6146637a..00000000 --- a/neurom/check/neuron_checks.py +++ /dev/null @@ -1,8 +0,0 @@ -"""For backward compatibility only.""" -# pylint: skip-file - -from neurom.check.morphology_checks import * # pragma: no cover -from neurom.utils import deprecated_module # pragma: no cover - -deprecated_module('Module `neurom.check.neuron_checks` is deprecated. Use' - '`neurom.check.morphology_checks` instead.') # pragma: no cover diff --git a/neurom/check/runner.py b/neurom/check/runner.py index 47dfbe5d..50cf7046 100644 --- a/neurom/check/runner.py +++ b/neurom/check/runner.py @@ -35,9 +35,8 @@ from neurom import load_morphology from neurom.check import check_wrapper -from neurom.exceptions import ConfigError +from neurom.exceptions import ConfigError, NeuroMError from neurom.io import utils -from neurom.utils import warn_deprecated L = logging.getLogger(__name__) @@ -147,10 +146,10 @@ def _sanitize_config(config): checks = config['checks'] if 'morphology_checks' not in checks: checks['morphology_checks'] = [] - if 'neuron_checks' in checks: - warn_deprecated('"neuron_checks" is deprecated, use "morphology_checks" instead ' - 'for the config of `neurom.check`') # pragma: no cover - checks['morphology_checks'] = config['neuron_checks'] # pragma: no cover + if 'neuron_checks' in checks: # pragma: no cover + raise NeuroMError( + "'neuron_checks' is not supported. Please rename it into 'morphology_checks'" + ) else: raise ConfigError('Need to have "checks" in the config') diff --git a/neurom/core/__init__.py b/neurom/core/__init__.py index 2fddabf9..570a67c9 100644 --- a/neurom/core/__init__.py +++ b/neurom/core/__init__.py @@ -30,5 +30,5 @@ # those imports here for backward compatibility from neurom.core.soma import Soma -from neurom.core.morphology import Section, Neurite, Morphology, Neuron +from neurom.core.morphology import Section, Neurite, Morphology from neurom.core.population import Population diff --git a/neurom/core/morphology.py b/neurom/core/morphology.py index f5b2146b..854cd347 100644 --- a/neurom/core/morphology.py +++ b/neurom/core/morphology.py @@ -38,7 +38,7 @@ from neurom.core.dataformat import COLS from neurom.core.types import NeuriteIter, NeuriteType from neurom.core.population import Population -from neurom.utils import flatten, warn_deprecated +from neurom.utils import flatten class Section: @@ -420,13 +420,6 @@ def graft_morphology(section): return Morphology(m) -def graft_neuron(section): - """Deprecated in favor of ``graft_morphology``.""" - warn_deprecated('`neurom.core.neuron.graft_neuron` is deprecated in favor of ' - '`neurom.core.morphology.graft_morphology`') # pragma: no cover - return graft_morphology(section) # pragma: no cover - - class Neurite: """Class representing a neurite tree.""" @@ -588,12 +581,3 @@ def __repr__(self): """Return a string representation.""" return 'Morphology ' % \ (self.soma, len(self.neurites)) - - -class Neuron(Morphology): - """Deprecated ``Neuron`` class. Use ``Morphology`` instead.""" - def __init__(self, filename, name=None): - """Dont use me.""" - super().__init__(filename, name) # pragma: no cover - warn_deprecated('`neurom.core.neuron.Neuron` is deprecated in favor of ' - '`neurom.core.morphology.Morphology`') # pragma: no cover diff --git a/neurom/core/neuron.py b/neurom/core/neuron.py deleted file mode 100644 index 514e0eaf..00000000 --- a/neurom/core/neuron.py +++ /dev/null @@ -1,8 +0,0 @@ -"""For backward compatibility only.""" -# pylint: skip-file - -from neurom.core.morphology import * # pragma: no cover -from neurom.utils import deprecated_module # pragma: no cover - -deprecated_module('Module `neurom.core.neuron` is deprecated. Use `neurom.core.morphology`' - ' instead.') # pragma: no cover diff --git a/neurom/features/sectionfunc.py b/neurom/features/sectionfunc.py deleted file mode 100644 index 82549fca..00000000 --- a/neurom/features/sectionfunc.py +++ /dev/null @@ -1,8 +0,0 @@ -"""For backward compatibility only.""" -# pylint: skip-file - -from neurom.features.section import * # pragma: no cover -from neurom.utils import deprecated_module # pragma: no cover - -deprecated_module('Module `neurom.features.sectionfunc` is deprecated. Use' - '`neurom.features.section` instead.') # pragma: no cover diff --git a/neurom/io/utils.py b/neurom/io/utils.py index 393d4f64..0b91c328 100644 --- a/neurom/io/utils.py +++ b/neurom/io/utils.py @@ -41,7 +41,6 @@ from neurom.core.morphology import Morphology from neurom.core.population import Population from neurom.exceptions import NeuroMError -from neurom.utils import warn_deprecated L = logging.getLogger(__name__) @@ -165,13 +164,6 @@ def load_morphology(morph, reader=None): return Morphology(morph, Path(morph).name) -def load_neuron(morph, reader=None): - """Deprecated in favor of ``load_morphology``.""" - warn_deprecated('`neurom.io.utils.load_neuron` is deprecated in favor of ' - '`neurom.io.utils.load_morphology`') # pragma: no cover - return load_morphology(morph, reader) # pragma: no cover - - def load_morphologies(morphs, name=None, ignored_exceptions=(), @@ -199,10 +191,3 @@ def load_morphologies(morphs, files = morphs name = name or 'Population' return Population(files, name, ignored_exceptions, cache) - - -def load_neurons(morphs, name=None, ignored_exceptions=(), cache=False): - """Deprecated in favor of ``load_morphologies``.""" - warn_deprecated('`neurom.io.utils.load_neurons` is deprecated in favor of ' - '`neurom.io.utils.load_morphologies`') # pragma: no cover - return load_morphologies(morphs, name, ignored_exceptions, cache) # pragma: no cover