Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions benchmarks/timeseries/benchmark_datasourcing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

PYTHONPATH=. python benchmark_datasourcing.py <num ev chargers> <num messages per battery>
"""

import argparse
import asyncio
import sys
Expand Down
1 change: 0 additions & 1 deletion benchmarks/timeseries/periodic_feature_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
implementation.
"""


import asyncio
import collections.abc
import contextlib
Expand Down
1 change: 0 additions & 1 deletion benchmarks/timeseries/ringbuffer_memusage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""Memory allocation benchmark for the ringbuffer."""


import argparse
import tracemalloc
from datetime import datetime, timedelta, timezone
Expand Down
1 change: 0 additions & 1 deletion benchmarks/timeseries/ringbuffer_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""Benchmarks the serialization of the `OrderedRingBuffer` class."""


import fnmatch
import os
import time
Expand Down
1 change: 0 additions & 1 deletion examples/battery_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""Script with an example how to use BatteryPool."""


import asyncio
import logging
from datetime import timedelta
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ dev-flake8 = [
"pydoclint == 0.8.3",
"pydocstyle == 6.3.0",
]
dev-formatting = ["black == 25.11.0", "isort == 8.0.1"]
dev-formatting = ["black == 26.3.1", "isort == 8.0.1"]
dev-mkdocs = [
"black == 25.11.0",
"black == 26.3.1",
"Markdown==3.10.2",
"mike == 2.1.3",
"mkdocs-gen-files == 0.6.1",
Expand Down
1 change: 0 additions & 1 deletion src/frequenz/sdk/_internal/_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""General purpose async tools."""


import asyncio
import logging
import sys
Expand Down
1 change: 0 additions & 1 deletion src/frequenz/sdk/actor/_run_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""Utility functions to run and synchronize the execution of actors."""


import asyncio
import logging

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""Power distribution state tracking for ev chargers."""


from dataclasses import dataclass
from datetime import datetime
from typing import Iterable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""Class that tracks the status of pool of components."""


import asyncio
import contextlib
from collections import abc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""Classes to track the status of components in the microgrid."""


import enum
from abc import ABC, abstractmethod
from collections import abc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""Background service that tracks the status of an EV charger."""


import asyncio
import logging
from datetime import datetime, timedelta, timezone
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
distributing the power between the components and sends the results back to it.
"""


import asyncio
import logging
from datetime import datetime, timedelta
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Copyright © 2022 Frequenz Energy-as-a-Service GmbH
"""Definition of the user request."""


import dataclasses
from collections import abc

Expand Down
1 change: 0 additions & 1 deletion src/frequenz/sdk/microgrid/_power_distributing/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""Results from PowerDistributingActor."""


import dataclasses
from collections import abc

Expand Down
1 change: 0 additions & 1 deletion src/frequenz/sdk/microgrid/_resampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""An actor to resample microgrid component metrics."""


import asyncio
import dataclasses
import logging
Expand Down
1 change: 1 addition & 0 deletions src/frequenz/sdk/timeseries/_fuse.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright © 2023 Frequenz Energy-as-a-Service GmbH

"""Fuse data class."""

from __future__ import annotations

from dataclasses import dataclass
Expand Down
1 change: 0 additions & 1 deletion src/frequenz/sdk/timeseries/_moving_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""A data window that moves with the latest datapoints of a data stream."""


import asyncio
import logging
import math
Expand Down
5 changes: 2 additions & 3 deletions src/frequenz/sdk/timeseries/_periodic_feature_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
modulo a fixed period.
"""


import logging
from dataclasses import dataclass
from datetime import datetime, timedelta
Expand Down Expand Up @@ -376,7 +375,7 @@ def _get_reshaped_np_array(
Returns:
A tuple containing the reshaped numpy array and the window size.
"""
(start_pos, end_pos, window_size) = self._get_buffer_bounds(start, end)
start_pos, end_pos, window_size = self._get_buffer_bounds(start, end)

if start_pos >= end_pos:
window_start = self._buffer[start_pos : self._moving_window.count_valid()]
Expand Down Expand Up @@ -408,5 +407,5 @@ def avg(
Returns:
The averaged timeseries window.
"""
(reshaped, window_size) = self._get_reshaped_np_array(start, end)
reshaped, window_size = self._get_reshaped_np_array(start, end)
return np.average(reshaped[:, :window_size], axis=0, weights=weights)
1 change: 0 additions & 1 deletion src/frequenz/sdk/timeseries/_ringbuffer/buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""Ringbuffer implementation with focus on time & memory efficiency."""


from copy import deepcopy
from dataclasses import dataclass
from datetime import datetime, timedelta, timezone
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""User interface for requesting aggregated battery-inverter data."""


import asyncio
import uuid
from collections.abc import Awaitable, Set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""Class that stores values of the component metrics."""


from collections.abc import Mapping
from dataclasses import dataclass
from datetime import datetime
Expand Down
1 change: 0 additions & 1 deletion src/frequenz/sdk/timeseries/battery_pool/_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""Methods for processing battery-inverter data."""


import asyncio
import logging
from abc import ABC, abstractmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""Module that defines how to aggregate metrics from battery-inverter components."""


import logging
import math
from abc import ABC, abstractmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""Interactions with pools of EV Chargers."""


import asyncio
import uuid
from collections import abc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""System bounds tracker for the EV chargers."""


import asyncio
from collections import abc

Expand Down
1 change: 0 additions & 1 deletion src/frequenz/sdk/timeseries/formula_engine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""Deprecated Formula Engine."""


from typing_extensions import TypeAlias

from .._base_types import QuantityT
Expand Down
1 change: 0 additions & 1 deletion src/frequenz/sdk/timeseries/formulas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@
```
"""


from ._formula import Formula
from ._formula_3_phase import Formula3Phase

Expand Down
1 change: 0 additions & 1 deletion src/frequenz/sdk/timeseries/formulas/_formula_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""A formula pool for helping with tracking running formulas."""


import logging
import sys

Expand Down
1 change: 0 additions & 1 deletion src/frequenz/sdk/timeseries/formulas/_lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""A lexer for formula strings."""


from __future__ import annotations

from collections.abc import Iterator
Expand Down
1 change: 1 addition & 0 deletions src/frequenz/sdk/timeseries/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
This module provides the `Grid` type, which represents a grid connection point
in a microgrid.
"""

from __future__ import annotations

import logging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""A logical meter for calculating high level metrics for a microgrid."""


import uuid

from frequenz.channels import Sender
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""Manages shared state/tasks for a set of PV inverters."""


import asyncio
import uuid
from collections import abc
Expand Down
1 change: 1 addition & 0 deletions tests/actor/test_background_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright © 2022 Frequenz Energy-as-a-Service GmbH

"""Simple test for the BaseActor."""

import asyncio
from typing import Literal, assert_never

Expand Down
1 change: 1 addition & 0 deletions tests/actor/test_resampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright © 2022 Frequenz Energy-as-a-Service GmbH

"""Frequenz Python SDK resampling example."""

import asyncio
import dataclasses
from datetime import datetime, timedelta, timezone
Expand Down
31 changes: 11 additions & 20 deletions tests/config/test_actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright © 2022 Frequenz Energy-as-a-Service GmbH

"""Test for ConfigManager."""

import os
import pathlib
from collections import defaultdict
Expand Down Expand Up @@ -134,8 +135,7 @@ async def test_update_multiple_files(self, config_file: pathlib.Path) -> None:
config_receiver = config_channel.new_receiver()

config_file2 = config_file.parent / "config2.toml"
config_file2.write_text(
"""
config_file2.write_text("""
logging_lvl = 'ERROR'
var1 = "0"
var2 = "15"
Expand All @@ -149,8 +149,7 @@ async def test_update_multiple_files(self, config_file: pathlib.Path) -> None:
b = 2
c = 4
d = 3
"""
)
""")

async with ConfigManagingActor(
[config_file, config_file2],
Expand Down Expand Up @@ -178,12 +177,10 @@ async def test_update_multiple_files(self, config_file: pathlib.Path) -> None:
}

# We overwrite config_file with just two variables
config_file.write_text(
"""
config_file.write_text("""
logging_lvl = 'INFO'
list_non_strict_bool = ["false", "0", "true"]
"""
)
""")

config = await config_receiver.receive()
assert config is not None
Expand All @@ -205,8 +202,7 @@ async def test_update_multiple_files(self, config_file: pathlib.Path) -> None:
}

# Now we only update logging_lvl in config_file2, it still takes precedence
config_file2.write_text(
"""
config_file2.write_text("""
logging_lvl = 'DEBUG'
var1 = "0"
var2 = "15"
Expand All @@ -220,8 +216,7 @@ async def test_update_multiple_files(self, config_file: pathlib.Path) -> None:
b = 2
c = 4
d = 3
"""
)
""")

config = await config_receiver.receive()
assert config is not None
Expand All @@ -240,23 +235,19 @@ async def test_update_multiple_files(self, config_file: pathlib.Path) -> None:

# Now add one variable to config_file not present in config_file2 and remove
# a bunch of variables from config_file2 too, and update a few
config_file.write_text(
"""
config_file.write_text("""
logging_lvl = 'INFO'
var10 = "10"
"""
)
config_file2.write_text(
"""
""")
config_file2.write_text("""
logging_lvl = 'DEBUG'
var1 = "3"
var_off = "on"
[dict_str_int]
a = 1
b = 2
c = 4
"""
)
""")

config = await config_receiver.receive()
assert config is not None
Expand Down
Loading
Loading