Skip to content

Commit c3fba01

Browse files
committed
Remove UNIX_EPOCH and use the one in the core library
Also add the missing docs cross-reference for the core library. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent ec608ea commit c3fba01

File tree

9 files changed

+14
-13
lines changed

9 files changed

+14
-13
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
* The microgrid client dependency has been updated to version 0.9.0
1010
* The resampling function now takes plain `float`s as values instead of `Quantity` objects.
11+
* `frequenz.sdk.timeseries.UNIX_EPOCH` was removed, use [`frequenz.core.datetime.UNIX_EPOCH`](https://frequenz-floss.github.io/frequenz-core-python/latest/reference/frequenz/core/datetime/#frequenz.core.datetime.UNIX_EPOCH) instead.
1112

1213
## New Features
1314

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ plugins:
119119
- https://docs.python.org/3/objects.inv
120120
- https://frequenz-floss.github.io/frequenz-channels-python/v1.1/objects.inv
121121
- https://frequenz-floss.github.io/frequenz-client-microgrid-python/v0.7/objects.inv
122+
- https://frequenz-floss.github.io/frequenz-core-python/v1/objects.inv
122123
- https://frequenz-floss.github.io/frequenz-quantities-python/v1/objects.inv
123124
- https://lovasoa.github.io/marshmallow_dataclass/html/objects.inv
124125
- https://marshmallow.readthedocs.io/en/stable/objects.inv

src/frequenz/sdk/timeseries/__init__.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
1010
# Periodicity and alignment
1111
12-
All the data produced by this package is always periodic and aligned to the
13-
`UNIX_EPOCH` (by default).
12+
All the data produced by this package is always periodic, in UTC, and aligned to the
13+
[Epoch](https://en.wikipedia.org/wiki/Epoch_(computing)) (by default).
1414
1515
Classes normally take a (re)sampling period as and argument and, optionally, an
1616
`align_to` argument.
@@ -36,7 +36,7 @@
3636
"""
3737

3838
from .._internal._channels import ReceiverFetcher
39-
from ._base_types import UNIX_EPOCH, Bounds, Sample, Sample3Phase
39+
from ._base_types import Bounds, Sample, Sample3Phase
4040
from ._fuse import Fuse
4141
from ._moving_window import MovingWindow
4242
from ._periodic_feature_extractor import PeriodicFeatureExtractor
@@ -54,5 +54,4 @@
5454
"Sample",
5555
"Sample3Phase",
5656
"SourceProperties",
57-
"UNIX_EPOCH",
5857
]

src/frequenz/sdk/timeseries/_base_types.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,11 @@
77
import functools
88
from collections.abc import Callable, Iterator
99
from dataclasses import dataclass
10-
from datetime import datetime, timezone
10+
from datetime import datetime
1111
from typing import Any, Generic, Protocol, Self, TypeVar, cast, overload
1212

1313
from frequenz.quantities import Power, Quantity
1414

15-
UNIX_EPOCH = datetime.fromtimestamp(0.0, tz=timezone.utc)
16-
"""The UNIX epoch (in UTC)."""
17-
1815
QuantityT = TypeVar("QuantityT", bound=Quantity)
1916
"""Type variable for representing various quantity types."""
2017

src/frequenz/sdk/timeseries/_moving_window.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313

1414
import numpy as np
1515
from frequenz.channels import Broadcast, Receiver, Sender
16+
from frequenz.core.datetime import UNIX_EPOCH
1617
from frequenz.quantities import Quantity
1718
from numpy.typing import ArrayLike
1819

1920
from ..actor._background_service import BackgroundService
20-
from ._base_types import UNIX_EPOCH, Sample
21+
from ._base_types import Sample
2122
from ._resampling._config import ResamplerConfig
2223
from ._resampling._resampler import Resampler
2324
from ._ringbuffer import OrderedRingBuffer

src/frequenz/sdk/timeseries/_resampling/_config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
from datetime import datetime, timedelta
1313
from typing import Protocol
1414

15-
from .._base_types import UNIX_EPOCH
15+
from frequenz.core.datetime import UNIX_EPOCH
16+
1617
from ._base_types import SourceProperties
1718

1819
_logger = logging.getLogger(__name__)

src/frequenz/sdk/timeseries/_ringbuffer/buffer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111

1212
import numpy as np
1313
import numpy.typing as npt
14+
from frequenz.core.datetime import UNIX_EPOCH
1415

15-
from .._base_types import UNIX_EPOCH, QuantityT, Sample
16+
from .._base_types import QuantityT, Sample
1617

1718
FloatArray = TypeVar("FloatArray", list[float], npt.NDArray[np.float64])
1819
"""Type variable of the buffer container."""

tests/timeseries/test_moving_window.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
import pytest
1414
import time_machine
1515
from frequenz.channels import Broadcast, Sender
16+
from frequenz.core.datetime import UNIX_EPOCH
1617
from frequenz.quantities import Quantity
1718

1819
from frequenz.sdk.timeseries import (
19-
UNIX_EPOCH,
2020
MovingWindow,
2121
ResamplerConfig,
2222
Sample,

tests/timeseries/test_periodic_feature_extractor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
import numpy as np
1111
import pytest
1212
from frequenz.channels import Broadcast
13+
from frequenz.core.datetime import UNIX_EPOCH
1314
from frequenz.quantities import Quantity
1415

1516
from frequenz.sdk.timeseries import (
16-
UNIX_EPOCH,
1717
MovingWindow,
1818
PeriodicFeatureExtractor,
1919
Sample,

0 commit comments

Comments
 (0)