Skip to content

Commit 4f9a5a1

Browse files
authored
Clean up the code (#11)
- **Remove the MicrogridApiClient ABC** - **Rename the class to `ApiClient`** - **Unify the importing of protobuf generated files** - **Don't disable the check `use-implicit-booleaness-not-comparison`** - **Avoid disabling the `unused-argument` check for the whole file** - **Import `grpc.aio` instead of `grpc`** - **Improve `TypeVar` for `ComponentData`** - **Fix import formatting** - **Return `Self` in `from_proto()` constructors** - **Remove nonexistent stub from the mock** - **Add overrides to sub-classes** - **Remove unnecessary import future**
2 parents 75e50e5 + 15ace20 commit 4f9a5a1

File tree

11 files changed

+286
-379
lines changed

11 files changed

+286
-379
lines changed

RELEASE_NOTES.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,8 @@ Code import from the [SDK v1.0.0-rc5](https://github.com/frequenz-floss/frequenz
66

77
## Upgrading
88

9-
<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->
9+
Changes compared to the code in the SDK v1.0.0-rc5 release:
1010

11-
## New Features
12-
13-
<!-- Here goes the main new features and examples or instructions on how to use them -->
14-
15-
## Bug Fixes
16-
17-
<!-- Here goes notable bug fixes that are worth a special mention or explanation -->
11+
* The `MicrogridGrpcClient` class was renamed to `ApiClient`.
12+
* The `MicrogridApiClient` abstract base class was removed, use `ApiClient` instead.
13+
* The `Connection` class is now a `dataclass` instead of a `NamedTuple`. If you use the tuple-like interface (`connection[0]`, etc.) you should use the named attributes instead or use [`dataclasses.astuple()`](https://docs.python.org/3/library/dataclasses.html#dataclasses.astuple) to convert it to a tuple.
Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,40 @@
11
# License: MIT
22
# Copyright © 2022 Frequenz Energy-as-a-Service GmbH
33

4-
"""Client to connect to the Microgrid API."""
4+
"""Client to connect to the Microgrid API.
5+
6+
This package provides a low-level interface for interacting with the microgrid API.
7+
"""
8+
9+
10+
from ._client import ApiClient
11+
from ._component import Component
12+
from ._component_data import (
13+
BatteryData,
14+
ComponentData,
15+
EVChargerData,
16+
InverterData,
17+
MeterData,
18+
)
19+
from ._component_states import EVChargerCableState, EVChargerComponentState
20+
from ._connection import Connection
21+
from ._metadata import Location, Metadata
22+
from ._retry import ExponentialBackoff, LinearBackoff, RetryStrategy
23+
24+
__all__ = [
25+
"ApiClient",
26+
"BatteryData",
27+
"Component",
28+
"ComponentData",
29+
"Connection",
30+
"EVChargerCableState",
31+
"EVChargerComponentState",
32+
"EVChargerData",
33+
"ExponentialBackoff",
34+
"InverterData",
35+
"LinearBackoff",
36+
"Location",
37+
"Metadata",
38+
"MeterData",
39+
"RetryStrategy",
40+
]

0 commit comments

Comments
 (0)