Skip to content

Contrib bc input converter#101

Merged
tbittar merged 49 commits intomainfrom
contrib_bc_input_converter
Jul 3, 2025
Merged

Contrib bc input converter#101
tbittar merged 49 commits intomainfrom
contrib_bc_input_converter

Conversation

@killian-scalian
Copy link
Collaborator

No description provided.

@killian-scalian killian-scalian marked this pull request as ready for review June 18, 2025 09:05
initial_value: Union[pd.DataFrame, float],
preprocessed_values: Optional[Union[dict[str, float], float]] = None,
) -> Union[float, pd.DataFrame]:
def resolve(value):
Copy link
Collaborator

Choose a reason for hiding this comment

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

You could define the function outside the class as a free function

has_valid_area = any(area.id in valid_areas for area in self.areas.values())

def _convert_area_to_component_list(self, lib_id: str) -> list[InputComponent]:
if has_valid_area:
Copy link
Collaborator

Choose a reason for hiding this comment

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

En lisant le code, j'ai vraiment du mal à comprendre ce que fais cette fonction..., Je ne comprends pas bien pourquoi le if/else : dans quel cas se retrouve-t-on sans "valid_areas" ? Pourquoi parcourt-on toutes les areas dans le cas où il y en a au moins une de valide... ?

to_exclude = [
item
for area in self.areas.values()
if area.id not in valid_areas
Copy link
Collaborator

Choose a reason for hiding this comment

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

Pourquoi cette ligne ? On sait déjà qu'on n'a pas d'area valide dans ce bloc

# Get area pattern for binding constraint from model config
self.bc_area_pattern = f"${{{bc_data['template-parameters'][0]['name']}}}"

model_config_datas: dict = self._extract_legacy_objects_from_model_config(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
model_config_datas: dict = self._extract_legacy_objects_from_model_config(
legacy_objects_used_for_bc: dict = self._extract_legacy_objects_from_model_config(

obtained_components, key=lambda x: x["id"]
)

def test_multiply_operation(self):
Copy link
Collaborator

Choose a reason for hiding this comment

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

The following tests should not be in the Testconverter class

@tbittar tbittar merged commit d8bac2f into main Jul 3, 2025
2 checks passed
@tbittar tbittar deleted the contrib_bc_input_converter branch July 3, 2025 09:52
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