From 967f32258092eec4bdb3e7e19b94a59f32106489 Mon Sep 17 00:00:00 2001 From: Jai Date: Mon, 4 Dec 2023 17:31:42 +0000 Subject: [PATCH] Refactored according to #293 --- aeon/dj_pipeline/acquisition.py | 2 +- aeon/{schema => io/binder}/__init__.py | 0 aeon/{schema => io/binder}/core.py | 0 aeon/{schema => io/binder}/foraging.py | 2 +- aeon/{schema => io/binder}/octagon.py | 0 aeon/{schema => io/binder}/schemas.py | 4 ++-- aeon/{schema => io/binder}/social.py | 0 aeon/io/device.py | 16 ++++++++-------- tests/io/test_api.py | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) rename aeon/{schema => io/binder}/__init__.py (100%) rename aeon/{schema => io/binder}/core.py (100%) rename aeon/{schema => io/binder}/foraging.py (98%) rename aeon/{schema => io/binder}/octagon.py (100%) rename aeon/{schema => io/binder}/schemas.py (97%) rename aeon/{schema => io/binder}/social.py (100%) diff --git a/aeon/dj_pipeline/acquisition.py b/aeon/dj_pipeline/acquisition.py index 916dda23..64842d65 100644 --- a/aeon/dj_pipeline/acquisition.py +++ b/aeon/dj_pipeline/acquisition.py @@ -5,7 +5,7 @@ import pandas as pd from aeon.io import api as io_api -from aeon.schema import schemas as aeon_schema +from aeon.io.binder import schemas as aeon_schema from aeon.io import reader as io_reader from aeon.analysis import utils as analysis_utils diff --git a/aeon/schema/__init__.py b/aeon/io/binder/__init__.py similarity index 100% rename from aeon/schema/__init__.py rename to aeon/io/binder/__init__.py diff --git a/aeon/schema/core.py b/aeon/io/binder/core.py similarity index 100% rename from aeon/schema/core.py rename to aeon/io/binder/core.py diff --git a/aeon/schema/foraging.py b/aeon/io/binder/foraging.py similarity index 98% rename from aeon/schema/foraging.py rename to aeon/io/binder/foraging.py index ffd8fdd9..9267dc77 100644 --- a/aeon/schema/foraging.py +++ b/aeon/io/binder/foraging.py @@ -4,7 +4,7 @@ import aeon.io.device as _device import aeon.io.reader as _reader -import aeon.schema.core as _stream +import aeon.io.binder.core as _stream class Area(_Enum): diff --git a/aeon/schema/octagon.py b/aeon/io/binder/octagon.py similarity index 100% rename from aeon/schema/octagon.py rename to aeon/io/binder/octagon.py diff --git a/aeon/schema/schemas.py b/aeon/io/binder/schemas.py similarity index 97% rename from aeon/schema/schemas.py rename to aeon/io/binder/schemas.py index 8a3dc333..782767e4 100644 --- a/aeon/schema/schemas.py +++ b/aeon/io/binder/schemas.py @@ -1,8 +1,8 @@ from dotmap import DotMap -import aeon.schema.core as stream +import aeon.io.binder.core as stream from aeon.io.device import Device -from aeon.schema import foraging, octagon +from aeon.io.binder import foraging, octagon exp02 = DotMap( [ diff --git a/aeon/schema/social.py b/aeon/io/binder/social.py similarity index 100% rename from aeon/schema/social.py rename to aeon/io/binder/social.py diff --git a/aeon/io/device.py b/aeon/io/device.py index 1a4916e6..23018aaf 100644 --- a/aeon/io/device.py +++ b/aeon/io/device.py @@ -3,16 +3,16 @@ def compositeStream(pattern, *args): """Merges multiple data streams into a single composite stream.""" - composite = {} + registry = {} if args: for stream in args: if inspect.isclass(stream): for method in vars(stream).values(): if isinstance(method, staticmethod): - composite.update(method.__func__(pattern)) + registry.update(method.__func__(pattern)) else: - composite.update(stream(pattern)) - return composite + registry.update(stream(pattern)) + return registry class Device: @@ -31,11 +31,11 @@ class Device: def __init__(self, name, *args, pattern=None): self.name = name - self.stream = compositeStream(name if pattern is None else pattern, *args) + self.registry = compositeStream(name if pattern is None else pattern, *args) def __iter__(self): - if len(self.stream) == 1: - singleton = self.stream.get(self.name, None) + if len(self.registry) == 1: + singleton = self.registry.get(self.name, None) if singleton: return iter((self.name, singleton)) - return iter((self.name, self.stream)) + return iter((self.name, self.registry)) diff --git a/tests/io/test_api.py b/tests/io/test_api.py index 8f9d8c0b..486f1d3f 100644 --- a/tests/io/test_api.py +++ b/tests/io/test_api.py @@ -5,7 +5,7 @@ from pytest import mark import aeon -from aeon.schema.schemas import exp02 +from aeon.io.binder.schemas import exp02 nonmonotonic_path = Path(__file__).parent.parent / "data" / "nonmonotonic" monotonic_path = Path(__file__).parent.parent / "data" / "monotonic"