From 964e73cb497b4d0b2313efa5960af7cd01a1193c Mon Sep 17 00:00:00 2001 From: Scott Huberty Date: Mon, 1 Apr 2024 20:11:36 -0700 Subject: [PATCH] MAINT: drop io namespace io is builtin to the package name, as io is clearly the scope of this package. thus I dont think we need the io sub module namespace. The directory structure was kind of like a box in a box with the io namespace. --- docs/API.rst | 4 ++-- eyelinkio/__init__.py | 4 ++-- eyelinkio/{io => }/edf/README.txt | 0 eyelinkio/{io => }/edf/__init__.py | 0 eyelinkio/{io => }/edf/_defines.py | 0 eyelinkio/{io => }/edf/_edf2py.py | 0 eyelinkio/{io => }/edf/read_edf.py | 3 ++- eyelinkio/io/__init__.py | 1 - eyelinkio/{io => }/tests/__init__.py | 0 eyelinkio/{io => }/tests/data/test_2_raw.edf | Bin eyelinkio/{io => }/tests/data/test_raw.edf | Bin eyelinkio/{io => }/tests/test_edf.py | 5 ++--- eyelinkio/utils/__init__.py | 3 ++- eyelinkio/utils/check.py | 2 +- eyelinkio/utils/utils.py | 4 ++-- 15 files changed, 13 insertions(+), 13 deletions(-) rename eyelinkio/{io => }/edf/README.txt (100%) rename eyelinkio/{io => }/edf/__init__.py (100%) rename eyelinkio/{io => }/edf/_defines.py (100%) rename eyelinkio/{io => }/edf/_edf2py.py (100%) rename eyelinkio/{io => }/edf/read_edf.py (99%) delete mode 100644 eyelinkio/io/__init__.py rename eyelinkio/{io => }/tests/__init__.py (100%) rename eyelinkio/{io => }/tests/data/test_2_raw.edf (100%) rename eyelinkio/{io => }/tests/data/test_raw.edf (100%) rename eyelinkio/{io => }/tests/test_edf.py (95%) diff --git a/docs/API.rst b/docs/API.rst index e8d98be..aa6a36f 100644 --- a/docs/API.rst +++ b/docs/API.rst @@ -8,7 +8,7 @@ for class names. Reading EDF files ----------------- -.. automodule:: eyelinkio.io.edf.read_edf +.. automodule:: eyelinkio.edf.read_edf :members: :exclude-members: EDF @@ -16,5 +16,5 @@ Reading EDF files ``EDF`` class ------------- -.. autoclass:: eyelinkio.io.EDF +.. autoclass:: eyelinkio.EDF :members: diff --git a/eyelinkio/__init__.py b/eyelinkio/__init__.py index 1b9c280..e96a631 100644 --- a/eyelinkio/__init__.py +++ b/eyelinkio/__init__.py @@ -3,6 +3,6 @@ # # License: BSD (3-clause) -from . import io, utils +from . import utils -from .io import read_edf, EDF \ No newline at end of file +from .edf import read_edf, EDF \ No newline at end of file diff --git a/eyelinkio/io/edf/README.txt b/eyelinkio/edf/README.txt similarity index 100% rename from eyelinkio/io/edf/README.txt rename to eyelinkio/edf/README.txt diff --git a/eyelinkio/io/edf/__init__.py b/eyelinkio/edf/__init__.py similarity index 100% rename from eyelinkio/io/edf/__init__.py rename to eyelinkio/edf/__init__.py diff --git a/eyelinkio/io/edf/_defines.py b/eyelinkio/edf/_defines.py similarity index 100% rename from eyelinkio/io/edf/_defines.py rename to eyelinkio/edf/_defines.py diff --git a/eyelinkio/io/edf/_edf2py.py b/eyelinkio/edf/_edf2py.py similarity index 100% rename from eyelinkio/io/edf/_edf2py.py rename to eyelinkio/edf/_edf2py.py diff --git a/eyelinkio/io/edf/read_edf.py b/eyelinkio/edf/read_edf.py similarity index 99% rename from eyelinkio/io/edf/read_edf.py rename to eyelinkio/edf/read_edf.py index 99ecc17..3c80d52 100644 --- a/eyelinkio/io/edf/read_edf.py +++ b/eyelinkio/edf/read_edf.py @@ -35,7 +35,6 @@ has_edfapi = False why_not = str(exp) -from ...utils import to_mne, to_pandas from . import _defines as defines from ._defines import event_constants @@ -104,6 +103,7 @@ def to_pandas(self): A dictionary of :class:`~pandas.DataFrame`'s, containing the samples, blinks, saccades, fixations, messages, and calibrations. """ + from ..utils import to_pandas return to_pandas(self) def to_mne(self): @@ -116,6 +116,7 @@ def to_mne(self): calibrations : list of Calibration A list of Calibration objects. """ + from ..utils import to_mne return to_mne(self) class _edf_open: diff --git a/eyelinkio/io/__init__.py b/eyelinkio/io/__init__.py deleted file mode 100644 index efb1821..0000000 --- a/eyelinkio/io/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .edf import read_edf, EDF \ No newline at end of file diff --git a/eyelinkio/io/tests/__init__.py b/eyelinkio/tests/__init__.py similarity index 100% rename from eyelinkio/io/tests/__init__.py rename to eyelinkio/tests/__init__.py diff --git a/eyelinkio/io/tests/data/test_2_raw.edf b/eyelinkio/tests/data/test_2_raw.edf similarity index 100% rename from eyelinkio/io/tests/data/test_2_raw.edf rename to eyelinkio/tests/data/test_2_raw.edf diff --git a/eyelinkio/io/tests/data/test_raw.edf b/eyelinkio/tests/data/test_raw.edf similarity index 100% rename from eyelinkio/io/tests/data/test_raw.edf rename to eyelinkio/tests/data/test_raw.edf diff --git a/eyelinkio/io/tests/test_edf.py b/eyelinkio/tests/test_edf.py similarity index 95% rename from eyelinkio/io/tests/test_edf.py rename to eyelinkio/tests/test_edf.py index 189e52b..4d2042a 100644 --- a/eyelinkio/io/tests/test_edf.py +++ b/eyelinkio/tests/test_edf.py @@ -1,9 +1,8 @@ import numpy as np import pytest -from eyelinkio.io import read_edf -from eyelinkio.utils import _get_test_fnames -from eyelinkio.utils.check import requires_edfapi +from eyelinkio import read_edf +from eyelinkio.utils import _get_test_fnames, requires_edfapi fnames = _get_test_fnames() diff --git a/eyelinkio/utils/__init__.py b/eyelinkio/utils/__init__.py index b2005fc..6520b4d 100644 --- a/eyelinkio/utils/__init__.py +++ b/eyelinkio/utils/__init__.py @@ -1 +1,2 @@ -from .utils import to_pandas, to_mne, _get_test_fnames \ No newline at end of file +from .check import requires_edfapi +from .utils import to_pandas, to_mne, _get_test_fnames diff --git a/eyelinkio/utils/check.py b/eyelinkio/utils/check.py index 686a3cd..a6f7273 100644 --- a/eyelinkio/utils/check.py +++ b/eyelinkio/utils/check.py @@ -3,7 +3,7 @@ def _has_edfapi(): """Determine if a user has edfapi installed.""" - from ..io.edf.read_edf import has_edfapi + from ..edf.read_edf import has_edfapi return has_edfapi diff --git a/eyelinkio/utils/utils.py b/eyelinkio/utils/utils.py index c87088f..43dc8d9 100644 --- a/eyelinkio/utils/utils.py +++ b/eyelinkio/utils/utils.py @@ -4,13 +4,13 @@ import numpy as np -from ..io.edf import _defines +from ..edf import _defines from .check import _check_mne_installed, _check_pandas_installed def _get_test_fnames(): """Get usable test files (omit EDF if no edf2asc).""" - path = Path(__file__).parent.parent / "io" / "tests" / "data" + path = Path(__file__).parent.parent / "tests" / "data" fnames = sorted(list(path.glob("*.edf"))) # test_2.edf will be first assert fnames[0].exists() return fnames