Skip to content
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

Typecheck DPT and RemoteValue #585

Merged
merged 12 commits into from Feb 15, 2021
Merged

Conversation

farmio
Copy link
Member

@farmio farmio commented Jan 31, 2021

Description

So I have tried to type annotate DPT and fell into a mypy rabbit hole. Sorry for this PR from Hell.

For type checking to work these changes were made:

  • RemoteValue is Generic now accepting DPTArray or DPTBinary
  • split RemoteValueClimateMode into RemoteValueControllerMode and RemoteValueOperationMode
  • return the payload (or None) in RemoteValue.payload_valid(payload) instead of True/False
  • Light colors are represented as Tuple[Tuple[int,int,int], int] instead of Tuple[List[int], int] now
  • DPT 3 payloads/values are not invertable anymore. This was done in the DPT classes, but should be done in RemoteValue.

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • I have performed a self-review of my own code
  • The documentation has been adjusted accordingly
  • The changes generate no new warnings
  • Tests have been added that prove the fix is effective or that the feature works
  • The changes are documented in the changelog
  • The Homeassistant plugin has been adjusted in case of new config options

@coveralls
Copy link

coveralls commented Jan 31, 2021

Coverage Status

Coverage increased (+0.04%) to 94.904% when pulling 5293288 on farmio:typecheck-dpt-nobyte into a712dc9 on XKNX:master.

@farmio farmio merged commit 4560a0c into XKNX:master Feb 15, 2021
@farmio farmio deleted the typecheck-dpt-nobyte branch February 15, 2021 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants