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

[FIX] Checks if Enum contains string #119

Merged
merged 3 commits into from
Jun 12, 2024
Merged

[FIX] Checks if Enum contains string #119

merged 3 commits into from
Jun 12, 2024

Conversation

runame
Copy link
Collaborator

@runame runame commented Jun 12, 2024

Fixes #118.

Also, I have added the FisherType and KFACType Enums to __init__ to make them easy to import.

@runame runame added the bug Something isn't working label Jun 12, 2024
@runame runame requested a review from f-dangel June 12, 2024 20:58
@runame runame self-assigned this Jun 12, 2024
@coveralls
Copy link

coveralls commented Jun 12, 2024

Pull Request Test Coverage Report for Build 9489624969

Details

  • 9 of 11 (81.82%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.08%) to 88.867%

Changes Missing Coverage Covered Lines Changed/Added Lines %
curvlinops/kfac.py 8 10 80.0%
Totals Coverage Status
Change from base Build 9488896670: -0.08%
Covered Lines: 1333
Relevant Lines: 1500

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 12, 2024

Pull Request Test Coverage Report for Build 9489631898

Details

  • 9 of 11 (81.82%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.08%) to 88.867%

Changes Missing Coverage Covered Lines Changed/Added Lines %
curvlinops/kfac.py 8 10 80.0%
Totals Coverage Status
Change from base Build 9488896670: -0.08%
Covered Lines: 1333
Relevant Lines: 1500

💛 - Coveralls

@wiseodd
Copy link
Collaborator

wiseodd commented Jun 12, 2024

Seems like the issue is actually because of a newer version of Python. Your check works in Python 3.8, but fails in Python 3.9 (the default of laplace-torch).

This works in Python 3.9:

In [5]: [v.value for  v in FisherType]
Out[5]: ['type-2', 'mc', 'empirical', 'forward-only']

@wiseodd
Copy link
Collaborator

wiseodd commented Jun 12, 2024

PS. Python 3.8 will be deprecated soon https://devguide.python.org/versions/.

@runame
Copy link
Collaborator Author

runame commented Jun 12, 2024

@wiseodd Have you tried the fix in this PR? I also tested it with Python 3.11 and it worked.

@coveralls
Copy link

coveralls commented Jun 12, 2024

Pull Request Test Coverage Report for Build 9489716093

Details

  • 9 of 11 (81.82%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.08%) to 88.867%

Changes Missing Coverage Covered Lines Changed/Added Lines %
curvlinops/kfac.py 8 10 80.0%
Totals Coverage Status
Change from base Build 9488896670: -0.08%
Covered Lines: 1333
Relevant Lines: 1500

💛 - Coveralls

@wiseodd
Copy link
Collaborator

wiseodd commented Jun 12, 2024

Yes, the fix here works.

Can't wait to finally free from the shackles of Python < 3.10. Pattern matching, StrEnum, Rust/cargo-like compiler messages... 🤤

@runame runame merged commit 92ccd9f into main Jun 12, 2024
13 checks passed
@runame runame deleted the fix-enum branch June 12, 2024 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Check if string is in Enum incompatible with older Python versions
3 participants