-
Couldn't load subscription status.
- Fork 4
Allow targeting categories with subtypes #168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM in general, although not completely convinced about the current approach with CategoryAndType, looks a bit too low-level for the "high-level interface".
| class EvChargerType(IntEnum): | ||
| """Enum representing the type of EV charger.""" | ||
|
|
||
| EV_CHARGER_TYPE_UNSPECIFIED = PBEvChargerType.EV_CHARGER_TYPE_UNSPECIFIED | ||
| """Unspecified type of EV charger.""" | ||
|
|
||
| EV_CHARGER_TYPE_AC = PBEvChargerType.EV_CHARGER_TYPE_AC | ||
| """AC EV charger.""" | ||
|
|
||
| EV_CHARGER_TYPE_DC = PBEvChargerType.EV_CHARGER_TYPE_DC | ||
| """DC EV charger.""" | ||
|
|
||
| EV_CHARGER_TYPE_HYBRID = PBEvChargerType.EV_CHARGER_TYPE_HYBRID | ||
| """Hybrid EV charger.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have these in the microgrid API too, next step is to move them to client-common so we can share it. I will do a PR with this soon after I finish the microgrid API 0.17 PR, probably this week. But just FYI, I think we should move forward adding it where needed locally as it might take some time to agree on something we are all happy about to put in common + release. In any case, I would remove the EV_CHARGER_TYPE_ prefix here.
| This is a frozen set, so it is immutable. | ||
| The target components are used to specify the components that a dispatch | ||
| should target. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe include a match example here?
|
|
||
| import json | ||
| from datetime import datetime, timedelta, timezone | ||
| from sre_constants import IN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I bet this was Tab-oriented-programming + auto-import 😆
| from sre_constants import IN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was more desperation, but this is a draft after all :P
b5f513a to
722b878
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty cool!
| This is a frozen set, so it is immutable. | ||
| """ | ||
|
|
||
| def __new__(cls, *ids: SupportsInt) -> "TargetIds": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😱 you can't define __init__ becuase it is frozen? 🥶
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess? THe init ctor doesn't take parameters :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even weirder.
53a74f2 to
4ccb8e7
Compare
Renames a few fields, but stays compatible otherwise. Signed-off-by: Mathias L. Baumann <[email protected]>
..and support the latest CategoryAndType target type. This implements extra classes for each target component case: * List of Ids `TargetIds` * List of categories: `TargetCategories` * List of categories + subtypes: `TargetCategoriesAndTypes` This was easier to do together as the addition of the new type increased the places where it was difficult to find out what the actual target type/ids is/are. Signed-off-by: Mathias L. Baumann <[email protected]>
|
Merging as it only had decorative / rebase changes |
Fixes #139