not compatible with python 3.8 due to dictionary union operator
Closed this issue · 3 comments
cboxed commented
In some place the union operator (|) is used to merge dictionaries. Unfortunately this is only supported by python versions >= 3.9 (https://peps.python.org/pep-0584/). According to the setup.cfg python >= 3.8 is supported.
To preserve compatibility with 3.8 the usage of the union operator for dictionaries should be avoided in the following files:
- package/bleparser/altbeacon.py
- package/bleparser/ibeacon.py
- package/bleparser/tilt.py
example for ibeacon.py:
This:
sensor_data = {
CONF_TYPE: DEVICE_TYPE,
CONF_PACKET: "no packet id",
CONF_FIRMWARE: DEVICE_TYPE,
CONF_MANUFACTURER: MANUFACTURER_DICT[comp_id] \
if comp_id in MANUFACTURER_DICT \
else DEFAULT_MANUFACTURER,
CONF_DATA: True
} | tracker_data
Should be changed to:
sensor_data = dict(
{
CONF_TYPE: DEVICE_TYPE,
CONF_PACKET: "no packet id",
CONF_FIRMWARE: DEVICE_TYPE,
CONF_MANUFACTURER: MANUFACTURER_DICT[comp_id] \
if comp_id in MANUFACTURER_DICT \
else DEFAULT_MANUFACTURER,
CONF_DATA: True
},
**tracker_data
)
I also created a branch with the fixes. But I'm not allowed to push anything ;)
Ernst79 commented
Thanks, i will have a look later this week. Does creating a branch on your own account not work, and create the PR from there?
Ernst79 commented
Thanks , I releas a new version.