openaq / openaq-api-v2

OpenAQ API
https://api.openaq.org
39 stars 9 forks source link

Python 3.11 enums #258

Closed russbiggs closed 9 months ago

russbiggs commented 9 months ago

enums have new behavior in Python 3.11 that is breaking a number of queries. currently when outputing a string an enum now looks like this

class Foo(str, enum):
    bar = "baz"

print(Foo.bar)

will return "Foo.bar" not the expected "baz" from previous version

https://blog.pecar.me/python-enum

We'll need to convert any str, enum mixins with the new StrEnum from enum import StrEnum