Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use string enums for natural gas company #169

Merged
merged 2 commits into from
May 1, 2024
Merged

Conversation

alanisaac
Copy link
Collaborator

Fixes #167

@alanisaac alanisaac requested a review from eriksynn April 30, 2024 23:28
Copy link
Collaborator

@plocket plocket left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@alanisaac
Copy link
Collaborator Author

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
Copy link
Collaborator

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

@alanisaac
Copy link
Collaborator Author

@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

@alanisaac alanisaac requested a review from debajyotid2 May 1, 2024 00:07
@debajyotid2
Copy link
Collaborator

LGTM

@alanisaac alanisaac merged commit 0653a98 into main May 1, 2024
12 checks passed
@alanisaac alanisaac deleted the issue-167-string-enums branch May 1, 2024 00:10
AdamFinkle pushed a commit to AdamFinkle/home-energy-analysis-tool that referenced this pull request May 22, 2024
* use string enums for natural gas company

* use StrEnum
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.

Use string enums for NaturalGasCompany
3 participants