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

Added support to expose camera and doorbell data #182

Merged
merged 10 commits into from
Oct 8, 2020

Conversation

nzapponi
Copy link

Describe what the PR does:
Adds support to expose camera and doorbell data

Does this fix a specific issue?

References #85

Checklist:

  • Confirm that one or more new tests are written for the new functionality.
  • Run tests and ensure everything passes (with 100% test coverage).
  • Update README.md and docs/ with any new documentation.
  • Add yourself to AUTHORS.md.

@codecov
Copy link

codecov bot commented Sep 30, 2020

Codecov Report

❗ No coverage uploaded for pull request base (dev@f8066d6). Click here to learn what that means.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             dev      #182   +/-   ##
=======================================
  Coverage       ?   100.00%           
=======================================
  Files          ?        12           
  Lines          ?       634           
  Branches       ?         0           
=======================================
  Hits           ?       634           
  Misses         ?         0           
  Partials       ?         0           
Impacted Files Coverage Δ
simplipy/api.py 100.00% <ø> (ø)
simplipy/camera.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f8066d6...a0c2392. Read the comment docs.

@nzapponi
Copy link
Author

@bachya would you mind taking a look? This is some of the spinoff work from home-assistant/core#40129

Copy link
Owner

@bachya bachya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also look at the Sourcery refactoring and incorporate its requests (if you feel they're spurious or unnecessary, let's talk).

Also, this PR needs to be linked to #85 (assuming it either (a) fixes it or (b) makes progress against it).

simplipy/api.py Outdated Show resolved Hide resolved
simplipy/camera.py Outdated Show resolved Hide resolved
simplipy/camera.py Show resolved Hide resolved
simplipy/camera.py Outdated Show resolved Hide resolved
simplipy/camera.py Outdated Show resolved Hide resolved
simplipy/system/__init__.py Outdated Show resolved Hide resolved
simplipy/system/__init__.py Outdated Show resolved Hide resolved
tests/test_camera.py Outdated Show resolved Hide resolved
@bachya bachya added the enhancement Enhancement of the code, not introducing new features. label Sep 30, 2020
@nzapponi
Copy link
Author

@bachya thanks for the feedback, I addressed all your points. Let me know if there's anything else you need here.

simplipy/camera.py Show resolved Hide resolved
simplipy/camera.py Outdated Show resolved Hide resolved
simplipy/camera.py Outdated Show resolved Hide resolved
simplipy/camera.py Outdated Show resolved Hide resolved
simplipy/camera.py Outdated Show resolved Hide resolved
simplipy/camera.py Outdated Show resolved Hide resolved
simplipy/system/__init__.py Show resolved Hide resolved
simplipy/system/__init__.py Outdated Show resolved Hide resolved
Copy link
Owner

@bachya bachya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there, I think!

simplipy/system/__init__.py Outdated Show resolved Hide resolved
simplipy/camera.py Outdated Show resolved Hide resolved
simplipy/camera.py Outdated Show resolved Hide resolved
simplipy/camera.py Show resolved Hide resolved
simplipy/system/__init__.py Outdated Show resolved Hide resolved
@sourcery-ai
Copy link

sourcery-ai bot commented Oct 7, 2020

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 0.39%.

Quality metrics Before After Change
Complexity 0.81 ⭐ 0.78 ⭐ -0.03 👍
Method Length 67.11 🙂 67.64 🙂 0.53 👎
Working memory 6.59 🙂 6.71 🙂 0.12 👎
Quality 81.74% 81.35% -0.39% 👎
Other metrics Before After Change
Lines 1915 2022 107
Changed files Quality Before Quality After Quality Change
simplipy/api.py 83.57% ⭐ 83.57% ⭐ 0.00%
simplipy/system/init.py 89.99% ⭐ 89.67% ⭐ -0.32% 👎
tests/common.py 94.02% ⭐ 93.66% ⭐ -0.36% 👎
tests/system/test_v2.py 69.54% 🙂 69.42% 🙂 -0.12% 👎
tests/system/test_v3.py 70.62% 🙂 70.40% 🙂 -0.22% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
simplipy/api.py API.request 23 😞 262 ⛔ 13 😞 29.56% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
tests/system/test_v3.py test_properties 0 338 ⛔ 17 ⛔ 42.17% 😞 Try splitting into smaller methods. Extract out complex expressions
simplipy/system/init.py create_pin_payload 10 🙂 187 😞 13 😞 44.52% 😞 Try splitting into smaller methods. Extract out complex expressions
simplipy/api.py API.authenticate 1 ⭐ 138 😞 13 😞 58.04% 🙂 Try splitting into smaller methods. Extract out complex expressions
tests/system/test_v3.py test_get_systems 0 161 😞 11 😞 59.90% 🙂 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Let us know what you think of it by mentioning @sourcery-ai in a comment.

@codeclimate
Copy link

codeclimate bot commented Oct 7, 2020

Code Climate has analyzed commit a0c2392 and detected 0 issues on this pull request.

View more on Code Climate.

Copy link
Owner

@bachya bachya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@bachya bachya merged commit cf11b61 into bachya:dev Oct 8, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Nov 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Enhancement of the code, not introducing new features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants