-
Notifications
You must be signed in to change notification settings - Fork 48
Feature/clean typing linter #285
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
|
Thanks for the PR and effort, wil check out/review this weekend |
|
OK. Fixed those ones and others. 👍 |
|
Great, wasn't able to finish the review this weekend. |
sfstar
left a comment
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.
Thank you for the PR @julesxxl.
I've added feedback and questions as they arose.
Once they have been processed I will run this version locally and do a final lookover.
Keep up the good work :)
| """ | ||
| config = dict(self.config_entry.options) | ||
| user_input.pop(CONF_RESCAN, None) | ||
| if user_input: |
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.
TODO's run this locally and go through config flow
|
|
||
| class EntityType: | ||
| """Base entityType.""" | ||
| """Base entity_type.""" |
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.
EntityType is an class here and should therefore not be renamed in the comment from class style to var style
| super().__init__(entity_type_name=entity_type_name) | ||
|
|
||
|
|
||
| class GenericAlarmLedger(Enum): |
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.
Is this removed elsewhere?
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.
removed from line 180 probably due to the use of class on 166 and needing to be declared before used
| 2608, UINT16, UnitOfEnergy.KILO_WATT_HOUR, 100 | ||
| ), | ||
| "grid_serial": RegisterInfo(2609, STRING(7)), | ||
| "grid_serial": RegisterInfo(2609, str(STRING(7))), |
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.
Why cast the string as an str here?
| ), | ||
| "battery_error": RegisterInfo( | ||
| register=1283, dataType=UINT16, entityType=TextReadEntityType(battery_error) | ||
| "BatteryError": RegisterInfo( |
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.
use batteryError here since generic Alarm ledger doesn't do the same as the battery error enum class
| first_register = next(iter(registerInfoDict)) | ||
| return registerInfoDict[first_register].register | ||
| first_register = next(iter(register_infoDict)) | ||
| return register_infoDict[first_register].register |
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.
should the name be register_info_dict to conform to convention?
| if self.description.key: | ||
| full_key = str(self.description.slave) + "." + self.description.key | ||
| else: | ||
| full_key = str(self.description.slave) + "." |
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 believe this returns an invalid entity_id.
| from typing import Any | ||
|
|
||
|
|
||
| class PopBuffer: |
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.
Ignored in review as it is still being written
| ) # Perhaps change this to water if only water is measured in volume units | ||
| if unit in [member.value for member in UnitOfSpeed]: | ||
| if "meteo" in name: | ||
| if name and "meteo" in name: |
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.
add seperate check for name to exist and not check 2 times in different if statements.
| self._attr_native_value = self.entity_type.decodeEnum( | ||
| if data in { | ||
| item.value # type: ignore[union-attr] | ||
| for item in self.entity_type.entity_type_name |
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.
has the decode enum been replaced?
|
This pull request is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days |
That was not easy... So no more errors with ruff check, ruff format, mypy. But there are the TODOs with pylint and two other problems.
Unfortunately, I didn't get it work in HA. Pfff... Anyway, the code is there and since it's not urgent, we'll have to understand what's wrong... So many changes...
(I rebased onto #281.)
Errors in the logs: