From 155610550142d4602bb37b2f9984932595c95fa0 Mon Sep 17 00:00:00 2001 From: Heberto Mayorquin Date: Tue, 17 Oct 2023 19:05:41 +0200 Subject: [PATCH] add typing import --- .../extractors/neoextractors/neuroscope.py | 10 +--------- src/spikeinterface/postprocessing/template_metrics.py | 2 ++ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/spikeinterface/extractors/neoextractors/neuroscope.py b/src/spikeinterface/extractors/neoextractors/neuroscope.py index 801b9c1928..c652ce4fb9 100644 --- a/src/spikeinterface/extractors/neoextractors/neuroscope.py +++ b/src/spikeinterface/extractors/neoextractors/neuroscope.py @@ -9,12 +9,6 @@ from .neobaseextractor import NeoBaseRecordingExtractor -try: - from lxml import etree as et - - HAVE_LXML = True -except ImportError: - HAVE_LXML = False PathType = Union[str, Path] OptionalPathType = Optional[PathType] @@ -108,8 +102,6 @@ class NeuroScopeSortingExtractor(BaseSorting): """ extractor_name = "NeuroscopeSortingExtractor" - installed = HAVE_LXML - installation_mesg = "Please install lxml to use this extractor!" name = "neuroscope" def __init__( @@ -121,7 +113,7 @@ def __init__( exclude_shanks: Optional[list] = None, xml_file_path: OptionalPathType = None, ): - assert self.installed, self.installation_mesg + from lxml import etree as et assert not ( folder_path is None and resfile_path is None and clufile_path is None diff --git a/src/spikeinterface/postprocessing/template_metrics.py b/src/spikeinterface/postprocessing/template_metrics.py index 3f47c505ad..bd6d1eff2a 100644 --- a/src/spikeinterface/postprocessing/template_metrics.py +++ b/src/spikeinterface/postprocessing/template_metrics.py @@ -3,6 +3,8 @@ https://github.com/AllenInstitute/ecephys_spike_sorting/blob/master/ecephys_spike_sorting/modules/mean_waveforms/waveform_metrics.py 22/04/2020 """ +from __future__ import annotations + import numpy as np import warnings from typing import Optional