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

Separate out entity models in SOFT and DLite #74

Merged
merged 12 commits into from
Feb 19, 2024

Conversation

CasperWA
Copy link
Collaborator

Closes #64

Create a "minimum set" of fields for the versioned SOFT models and then create the DLite implementations of these separately.

This should be implemented in conjunction with #70

Create a "minimum set" of fields for the versioned SOFT models and then
create the DLite implementations of these separately.
Copy link

codecov bot commented Jan 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3a980c5) 91.02% compared to head (4f36b15) 90.78%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #74      +/-   ##
==========================================
- Coverage   91.02%   90.78%   -0.25%     
==========================================
  Files          17       21       +4     
  Lines         981      955      -26     
==========================================
- Hits          893      867      -26     
  Misses         88       88              
Flag Coverage Δ
docker 70.68% <91.00%> (+0.54%) ⬆️
local 89.42% <100.00%> (-0.29%) ⬇️

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.


@model_validator(mode="before")
@classmethod
def _check_cross_dependent_fields(cls, data: Any) -> Any:

Choose a reason for hiding this comment

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

_cross_check_dependent_fields seems especially long for something that is relatively simple. Cross check also implies something more complex (e.g that the name and namespace are consistent with the version according to a complex rule or something)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It should be noted that the content and logic of the validators have not been changed. They have merely been moved around a bit to where they not belong. However, it may still be fine to address in this PR, for sure :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Essentially, namespace+version+name in that specific order MUST be equal to uri if all of these fields are given. That is what's being checked :)

shape: Annotated[
list[str] | None,
Field(
description=(
Copy link

@daniel-sintef daniel-sintef Jan 26, 2024

Choose a reason for hiding this comment

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

This description seems really complex. Maybe something like "Defines the dimensions of a multi-dimensional property using a list of expressions. "
"Each expression in the list corresponds to a dimension and can be a named dimension "
"(e.g., 'H', 'K', 'L') or an arithmetic expression involving these dimensions. "
"For example, if a property's shape is defined as ['K', 'H+1'] and the dimensions of the entity "
"are assigned values 'H=2', 'K=2', 'L=6', the resulting shape of the property will be [2, 3]. "
"This allows for dynamic sizing of properties based on the entity's dimensions. <ChatGPT said this, is it true?>" I'm personally a bit confused by how multi-dimensions work now

Choose a reason for hiding this comment

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

Technically this comment is not in the scope of the PR since it was already there but I point it out now...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Feel free to open an issue on this :)

@CasperWA CasperWA marked this pull request as ready for review January 29, 2024 13:41
@CasperWA CasperWA requested a review from Treesarj February 16, 2024 10:36
@CasperWA CasperWA merged commit 607ebeb into main Feb 19, 2024
11 checks passed
@CasperWA CasperWA deleted the cwa/close-64-rejig-pydantic-models branch February 19, 2024 13:40
CasperWA added a commit that referenced this pull request Feb 19, 2024
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.

Minimize code repeats in SOFT models
3 participants