Skip to content

feat: add decoded_properties method to ServiceInfo#1332

Merged
bdraco merged 8 commits into
masterfrom
decoded_properties
Dec 13, 2023
Merged

feat: add decoded_properties method to ServiceInfo#1332
bdraco merged 8 commits into
masterfrom
decoded_properties

Conversation

@bdraco
Copy link
Copy Markdown
Member

@bdraco bdraco commented Dec 13, 2023

ServiceInfo.decoded_properties is now available which returns a str representation of the properties instead of bytes

Clean up the typing on ServiceInfo.properties to always return bytes.

The typing on properties was very confusing because it could have a mix
of bytes and str types, but only bytes would ever come back from the
backend and cache. The only way str could happen is if someone manually
passed it in. We now ensure all passed in data is converted to bytes
@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 13, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e2f9f81) 99.77% compared to head (3e6b2d4) 99.77%.
Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1332   +/-   ##
=======================================
  Coverage   99.77%   99.77%           
=======================================
  Files          30       30           
  Lines        3143     3164   +21     
  Branches      524      528    +4     
=======================================
+ Hits         3136     3157   +21     
  Misses          5        5           
  Partials        2        2           

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

Comment thread src/zeroconf/_services/info.py
@bdraco bdraco marked this pull request as ready for review December 13, 2023 23:28
@bdraco bdraco merged commit 9b595a1 into master Dec 13, 2023
@bdraco bdraco deleted the decoded_properties branch December 13, 2023 23:28
openstack-mirroring pushed a commit to openstack/openstack that referenced this pull request Jan 5, 2024
* Update ironic-lib from branch 'master'
  to 523407eebf22b68a3b1a3926666e8bb24fedf871
  - Merge "Compatibility with zeroconf 0.129.0"
  - Compatibility with zeroconf 0.129.0
    
    From Zeroconf CHANGELOG.md:
    v0.129.0 (2023-12-13)
    
    Feature
    
    * Add decoded_properties method to ServiceInfo
    python-zeroconf/python-zeroconf#1332
    python-zeroconf/python-zeroconf@9b595a1
    * Ensure ServiceInfo.properties always returns bytes
    python-zeroconf/python-zeroconf#1333
    python-zeroconf/python-zeroconf@d29553a
    
    Technically breaking change
    
    * `ServiceInfo.properties` always returns a dictionary with type
    `dict[bytes, bytes | None]` instead of a mix `str` and `bytes`. It was
    only possible to get a mixed dictionary if it was manually passed in
    when `ServiceInfo` was constructed.
    
    Co-Authored-By: Dmitry Tantsur <dtantsur@protonmail.com>
    Change-Id: I7f1a0c3329e5f29ec3e274558e3681142cc2ef78
openstack-mirroring pushed a commit to openstack/ironic-lib that referenced this pull request Jan 5, 2024
From Zeroconf CHANGELOG.md:
v0.129.0 (2023-12-13)

Feature

* Add decoded_properties method to ServiceInfo
python-zeroconf/python-zeroconf#1332
python-zeroconf/python-zeroconf@9b595a1
* Ensure ServiceInfo.properties always returns bytes
python-zeroconf/python-zeroconf#1333
python-zeroconf/python-zeroconf@d29553a

Technically breaking change

* `ServiceInfo.properties` always returns a dictionary with type
`dict[bytes, bytes | None]` instead of a mix `str` and `bytes`. It was
only possible to get a mixed dictionary if it was manually passed in
when `ServiceInfo` was constructed.

Co-Authored-By: Dmitry Tantsur <dtantsur@protonmail.com>
Change-Id: I7f1a0c3329e5f29ec3e274558e3681142cc2ef78
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.

1 participant