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

feat: Add new function that creates an instance of a model with the option to skip validation #110

Merged
merged 2 commits into from
Jan 26, 2025

Conversation

pesap
Copy link
Collaborator

@pesap pesap commented Jan 23, 2025

This PR adds a new method that creates an instance of a model but with the option skip the validation of pydantic by setting a skip_validation flag.

@pesap pesap requested review from jarry7 and kodiobika January 23, 2025 06:35
@codecov-commenter
Copy link

codecov-commenter commented Jan 23, 2025

Codecov Report

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

Project coverage is 78.02%. Comparing base (05befac) to head (e2cb6e5).

Files with missing lines Patch % Lines
src/r2x/parser/reeds.py 87.50% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #110      +/-   ##
==========================================
+ Coverage   77.98%   78.02%   +0.03%     
==========================================
  Files          39       39              
  Lines        3865     3872       +7     
==========================================
+ Hits         3014     3021       +7     
  Misses        851      851              
Files with missing lines Coverage Δ
src/r2x/parser/handler.py 85.71% <100.00%> (+0.75%) ⬆️
src/r2x/parser/reeds.py 91.25% <87.50%> (+0.02%) ⬆️

Copy link
Collaborator

@jarry7 jarry7 left a comment

Choose a reason for hiding this comment

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

  • Seems like a bunch of changes/additions in the PR to enable validation flag. Just want to understand (at a high-level) what they are for? e.g. LoadZone, Reserve, TransmissionInterface (based on the new create_model_instance) and it just seems to be for enabling the model_validation flag.
  • I would not be well positioned to decide whether it is comprehensive in coverage but can test for nodal functionality if that is what you would like? Perhaps @kodiobika would be best to test for functionality? Otherwise, have you done this already @pesap?
  • I see all the checks have passed but was wanting to see whether the functionality is as you would expect (fundamentally - avoid validation)

@pesap
Copy link
Collaborator Author

pesap commented Jan 23, 2025

At a high-level, every time we used to create an instance of a PSY model, we call this new function that allows to create a validated model or an un-validated model.

I included simple test of the function, should be enough to test that we can create a unvalidated model. See test_models.py

@pesap pesap marked this pull request as ready for review January 26, 2025 19:40
@pesap pesap merged commit dab93ff into main Jan 26, 2025
8 checks passed
@pesap pesap deleted the ps/no_validation branch January 26, 2025 19:40
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.

3 participants