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

Handle sensor list in topic #154

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ninahakansson
Copy link

In case of list of sensor, use MULTIPLE_SENSORS in topic. We do not want a tuple or lsit in the publishing topic.

Copy link

codecov bot commented Apr 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.26%. Comparing base (80956c4) to head (81ff0e6).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #154      +/-   ##
==========================================
+ Coverage   91.23%   91.26%   +0.02%     
==========================================
  Files          32       32              
  Lines        4417     4429      +12     
==========================================
+ Hits         4030     4042      +12     
  Misses        387      387              
Flag Coverage Δ
unittests 91.26% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 8799660697

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 0.0%

Totals Coverage Status
Change from base Build 7932120988: 0.0%
Covered Lines: 0
Relevant Lines: 0

💛 - Coveralls

@adybbroe adybbroe self-requested a review May 3, 2024 08:17
@adybbroe adybbroe self-assigned this May 3, 2024
"""Update sensor tuples and lists to MULTIPLE_SENSORS."""
to_send_dict = to_send.copy()
if "sensor" in to_send:
if type(to_send["sensor"]) is list or type(to_send["sensor"]) is tuple:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is perhaps more pythonic to do isinstance(to_send["sensor"], collections.abc.Sequence)
?

Copy link
Contributor

Choose a reason for hiding this comment

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

isinstance(to_send["sensor"], (list, tuple)) should also work

to_send_dict = to_send.copy()
if "sensor" in to_send:
if type(to_send["sensor"]) is list or type(to_send["sensor"]) is tuple:
to_send_dict["sensor"] = "MULTIPLE_SENSORS"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should it be "multiple sensors" rather?

Copy link
Member

Choose a reason for hiding this comment

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

I also prefer lower case

Copy link
Contributor

@adybbroe adybbroe left a comment

Choose a reason for hiding this comment

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

Apart from a small comment it looks good, thanks!

@adybbroe adybbroe requested a review from mraspaud May 3, 2024 08:29
@ninahakansson
Copy link
Author

ninahakansson commented May 3, 2024

Unfortunately isinstance("atms", collections.abc.Sequence) is also True ...

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

5 participants