From 33c74acdfa84ffa395cf5ee53e38df2339360797 Mon Sep 17 00:00:00 2001 From: ghiggi Date: Sat, 6 Apr 2024 12:14:26 +0200 Subject: [PATCH] Update requirements --- ci/environment.yml | 2 ++ ci/environment_latest.yml | 2 ++ docs/environment.yaml | 8 +++++++- pyproject.toml | 1 + tstore/archive/checks.py | 5 ++--- tstore/tsdf/extensions/array.py | 19 ++++++++----------- tstore/tsdf/extensions/ts_dtype.py | 3 +-- 7 files changed, 23 insertions(+), 17 deletions(-) diff --git a/ci/environment.yml b/ci/environment.yml index 4abdc0d..41de31c 100644 --- a/ci/environment.yml +++ b/ci/environment.yml @@ -4,6 +4,7 @@ channels: dependencies: - dask - distributed +- numpy - pandas - polars - pyarrow @@ -11,3 +12,4 @@ dependencies: - pytest-cov - pytest-mock - pytest-sugar +- pyyaml diff --git a/ci/environment_latest.yml b/ci/environment_latest.yml index 7a18db5..12f7f22 100644 --- a/ci/environment_latest.yml +++ b/ci/environment_latest.yml @@ -4,6 +4,7 @@ channels: dependencies: - dask - distributed +- numpy - pandas - polars - pyarrow @@ -11,3 +12,4 @@ dependencies: - pytest-cov - pytest-mock - pytest-sugar +- pyyaml diff --git a/docs/environment.yaml b/docs/environment.yaml index 1117380..40b5bd3 100644 --- a/docs/environment.yaml +++ b/docs/environment.yaml @@ -2,17 +2,23 @@ name: build-doc-tstore channels: - conda-forge dependencies: +- dask +- distributed - docutils - jupyter - nbsphinx==0.9.3 +- numpy +- pandas - pandoc - pip +- polars +- pyarrow - python>=3.9 +- pyyaml - sphinx-book-theme==1.1.0 - sphinx-gallery - sphinx-mdinclude==0.5.3 - sphinx==7.2.6 - sphinxcontrib-youtube -- ts-store - pip: - ts-store diff --git a/pyproject.toml b/pyproject.toml index 3ff604b..152ff17 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,6 +28,7 @@ dependencies = [ "distributed", "polars", "geopandas", + "pyyaml", ] dynamic = ["version"] diff --git a/tstore/archive/checks.py b/tstore/archive/checks.py index 03dc84d..8fca948 100644 --- a/tstore/archive/checks.py +++ b/tstore/archive/checks.py @@ -112,7 +112,6 @@ def check_start_end_time(start_time, end_time): if end_time is not None: end_time = check_time(end_time) # Check start_time and end_time are chronological - if start_time is not None and end_time is not None: - if start_time > end_time: - raise ValueError("Provide start_time occurring before of end_time") + if start_time is not None and end_time is not None and start_time > end_time: + raise ValueError("Provide start_time occurring before of end_time") return (start_time, end_time) diff --git a/tstore/tsdf/extensions/array.py b/tstore/tsdf/extensions/array.py index 5885e38..6d7d152 100644 --- a/tstore/tsdf/extensions/array.py +++ b/tstore/tsdf/extensions/array.py @@ -33,14 +33,13 @@ def get_tabular_object_type(obj): """Get inner class of the TS object.""" if isinstance(obj, dd.DataFrame): return "dask.DataFrame" - elif isinstance(obj, pd.DataFrame): + if isinstance(obj, pd.DataFrame): return "dask.Series" - elif isinstance(obj, pd.DataFrame): + if isinstance(obj, pd.DataFrame): return "pandas.DataFrame" - elif isinstance(obj, pd.Series): + if isinstance(obj, pd.Series): return "pandas.Series" - else: - return type(obj).__name__ + return type(obj).__name__ class TSArray(ExtensionArray): @@ -82,10 +81,9 @@ def __getitem__(self, index: int) -> "TSArray" | Any: """Select a subset of self.""" if isinstance(index, int): return self._data[index] - else: - # Check index for TestGetitemTests - index = pd.core.indexers.check_array_indexer(self, index) - return type(self)(self._data[index]) + # Check index for TestGetitemTests + index = pd.core.indexers.check_array_indexer(self, index) + return type(self)(self._data[index]) # TestSetitemTests def __setitem__(self, index: int, value: TS) -> None: @@ -124,8 +122,7 @@ def _from_sequence(cls, data, dtype=None, copy: bool = False): if not isinstance(dtype, TSDtype): msg = f"'{cls.__name__}' only supports 'TSDtype' dtype" raise ValueError(msg) - else: - return cls(data, copy=copy) + return cls(data, copy=copy) # Required for all ExtensionArray subclasses @classmethod diff --git a/tstore/tsdf/extensions/ts_dtype.py b/tstore/tsdf/extensions/ts_dtype.py index 5ec3ce9..13cc545 100644 --- a/tstore/tsdf/extensions/ts_dtype.py +++ b/tstore/tsdf/extensions/ts_dtype.py @@ -66,8 +66,7 @@ def __eq__(self, other: Any) -> bool: """Test TS equality.""" if isinstance(other, str): return self.name == other - else: - return isinstance(other, type(self)) and self.ts_class == other.ts_class + return isinstance(other, type(self)) and self.ts_class == other.ts_class # Required for pickle compat (see GH26067) def __setstate__(self, state) -> None: