You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support float.inf and float.nan in quantities (#514)
This might be controversial, but my use case is the following:
```
boundaries: list[tuple[Percentage, SoC]] = [
(config.battery_bounds.lower, SoC.DISCHARGED),
(reserve_bounds.lower, SoC.RESERVE),
(config.target_soc_bounds_pct.lower, SoC.NORMAL),
(config.target_soc_bounds_pct.upper, SoC.TARGET),
(reserve_bounds.upper, SoC.NORMAL),
(config.battery_bounds.upper, SoC.RESERVE),
(Percentage.from_percent(float("inf")), SoC.CHARGED),
]
for boundary, state in boundaries:
if bat_soc_pct < boundary:
return state
```
I am using inf here as a stop-marker that will always be larger than the
last boundary. This way I can avoid having to add a special case for the
last boundary.
Copy file name to clipboardExpand all lines: RELEASE_NOTES.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,16 +6,17 @@
6
6
7
7
## Upgrading
8
8
9
-
<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->
9
+
<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->
10
10
11
11
-`Channels` has been upgraded to version 0.16.0, for information on how to upgrade visit https://github.com/frequenz-floss/frequenz-channels-python/releases/tag/v0.16.0
12
12
13
13
## New Features
14
14
15
-
* Add quantity class `Frequency` for frequency values.
15
+
- Add quantity class `Frequency` for frequency values.
16
16
17
17
## Bug Fixes
18
18
19
19
- Fix formatting issue for `Quantity` objects with zero values.
20
+
- Fix formatting isuse for `Quantity` when the base value is float.inf or float.nan.
20
21
21
22
<!-- Here goes notable bug fixes that are worth a special mention or explanation -->
0 commit comments