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

refactor(thermal, renewable): create user classes #79

Merged
merged 41 commits into from
Feb 12, 2025

Conversation

MartinBelthle
Copy link
Contributor

No description provided.

@MartinBelthle MartinBelthle self-assigned this Feb 11, 2025
@MartinBelthle MartinBelthle changed the title Refactor/create user class for thermal refactor(thermal, renewable): create user classes Feb 11, 2025
@MartinBelthle MartinBelthle marked this pull request as ready for review February 11, 2025 16:43
Copy link
Member

@sylvlecl sylvlecl left a comment

Choose a reason for hiding this comment

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

Looks good, just non blocking minor comments

prepro: Optional[pd.DataFrame] = None,
modulation: Optional[pd.DataFrame] = None,
series: Optional[pd.DataFrame] = None,
CO2Cost: Optional[pd.DataFrame] = None,
fuelCost: Optional[pd.DataFrame] = None,
co2_cost: Optional[pd.DataFrame] = None,
Copy link
Member

Choose a reason for hiding this comment

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

nice, the case was ugly

from pydantic.alias_generators import to_camel


class APIBaseModel(BaseModel):
Copy link
Member

Choose a reason for hiding this comment

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

Nice, maybe we could move it to a base_model.py module for more visibility

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes why not it's a bit hidden inside the init file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll do it inside another PR :)

return RenewableClusterPropertiesAPI.model_validate(user_dict)

def to_user_model(self) -> RenewableClusterProperties:
return RenewableClusterProperties(
Copy link
Member

Choose a reason for hiding this comment

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

It looks kind of dirty that it passes the type checking since strictly speaking the properties are optional now.
But we can dismiss that issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed. We have the same issue concerning the settings. What should we do ? Introduce the same object with the default fields ?

@MartinBelthle MartinBelthle merged commit a5d6a44 into main Feb 12, 2025
7 of 8 checks passed
@MartinBelthle MartinBelthle deleted the refactor/create_user_class_for_thermal branch February 12, 2025 10:28
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.

2 participants