tomeko12 / pyelectroluxconnect

A python module to communicate with Elecrolux Connectivity Platform
Apache License 2.0
25 stars 9 forks source link

match attr : invalid syntax in Session.py #11

Closed toast1234 closed 1 year ago

toast1234 commented 1 year ago

Some syntax error on Debian Python 3.9.2 (default, Feb 28 2021, 17:03:44)

Traceback (most recent call last):
  File "/opt/scripts/elux.py", line 2, in <module>
    import pyelectroluxconnect
  File "/usr/local/lib/python3.9/dist-packages/pyelectroluxconnect/__init__.py", line 11, in <module>
    from .Session import (
  File "/usr/local/lib/python3.9/dist-packages/pyelectroluxconnect/Session.py", line 313
    match attr:
          ^
SyntaxError: invalid syntax

Works ok when removing the section

            result = {}
            for attr in ["group", "brand", "model_name"]:
                if attr in _json and _json[attr] != "":
                    result["model" if attr == "model_name" else attr] = _json[attr]
#                else:
#                    match attr:
#                        case "group":
#                            result["group"] = ""
#                        case "brand":
#                            result["brand"] = "Electrolux"
#                        case "model_name":
#                            result["model"] = self._findModel(pnc, elc)[0]
            return result
tomeko12 commented 1 year ago

Hi. Based on https://github.com/tomeko12/pyelectroluxconnect/blob/main/setup.py, this library require python 3.10, where match-case is introduced.

toast1234 commented 1 year ago

Ah, thanks. updated to 3.10.