codeforboston / home-energy-analysis-tool

https://www.codeforboston.org/projects/
MIT License
7 stars 25 forks source link

Use string enums for natural gas company #169

Closed alanisaac closed 2 months ago

alanisaac commented 2 months ago

Fixes #167

alanisaac commented 2 months ago

I'm a fan in general. I'm curious why there are two arguments to the function now. Is that just a python typing thing?

I assume in reference to this:

class NaturalGasCompany(str, Enum):

This is a class definition, and in this case, this is a class implementing multiple inheritance. As to why we use it here, that's the recommended solution for making string-backed enums.

debajyotid2 commented 2 months ago

@alanisaac We could probably use StrEnum directly - see here.

alanisaac commented 2 months ago

@alanisaac We could probably use StrEnum directly - see here.

Oh neat, that's new(er). I'm still used to writing in older versions. Will update

debajyotid2 commented 2 months ago

LGTM