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

Lowlevel helpers clean up #1410

Merged
merged 7 commits into from
Nov 19, 2024
Merged

Lowlevel helpers clean up #1410

merged 7 commits into from
Nov 19, 2024

Conversation

lewisblake
Copy link
Member

@lewisblake lewisblake commented Nov 18, 2024

Change Summary

  • Implement _AuxReadSpec in terms of pydantic
  • Consequently, remove unused Validator child classes StrWithDefault, FlexList, EitherOf, ListOfStrings

Related issue number

N/A

Checklist

  • Start with a draft-PR
  • The PR title is a good summary of the changes
  • PR is set to AeroTools and a tentative milestone
  • Documentation reflects the changes where applicable
  • Tests for the changes exist where applicable
  • Tests pass locally
  • Tests pass on CI
  • At least 1 reviewer is selected
  • Make PR ready to review

Copy link

codecov bot commented Nov 18, 2024

Codecov Report

Attention: Patch coverage is 90.90909% with 2 lines in your changes missing coverage. Please review.

Project coverage is 78.35%. Comparing base (d68a9f8) to head (7fd10ab).
Report is 35 commits behind head on main-dev.

Files with missing lines Patch % Lines
pyaerocom/aeroval/aux_io_helpers.py 90.90% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           main-dev    #1410      +/-   ##
============================================
+ Coverage     78.32%   78.35%   +0.03%     
============================================
  Files           137      137              
  Lines         20910    20885      -25     
============================================
- Hits          16378    16365      -13     
+ Misses         4532     4520      -12     
Flag Coverage Δ
unittests 78.35% <90.90%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@lewisblake lewisblake added this to the m2024-12 milestone Nov 18, 2024
@lewisblake lewisblake marked this pull request as ready for review November 18, 2024 19:29
funcs: dict[str, Callable]

@model_validator(mode="after")
def validate_fun(self) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Return type should be _AuxReadSpec

Copy link
Member Author

Choose a reason for hiding this comment

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

Can return Self

elif isinstance(fun, str):
return funcs[fun]
raise ValueError("failed to retrieve aux func")
fun: str | Callable
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it possible to use something like this to make fun typehint as str only during typechecking, since that's what we expect it to be after validation? I think this would work better with tools such as mypy and code autocompletion.

@lewisblake lewisblake merged commit 49ef7d0 into main-dev Nov 19, 2024
8 checks passed
@lewisblake lewisblake deleted the lowlevel_helpers_clean_up branch November 19, 2024 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants