Skip to content

FEAT: Improve consistency#7264

Open
Devin-Crawford wants to merge 14 commits intomainfrom
fix/7257_improve_consistency_get_object
Open

FEAT: Improve consistency#7264
Devin-Crawford wants to merge 14 commits intomainfrom
fix/7257_improve_consistency_get_object

Conversation

@Devin-Crawford
Copy link
Contributor

@Devin-Crawford Devin-Crawford commented Feb 15, 2026

Description

Add method modeler.get_objects_by_name to be consistent with modeler.get_objects_by_material

Issue linked

Close #7257

Checklist

  • I have tested my changes locally.
  • I have added necessary documentation or updated existing documentation.
  • I have followed the coding style guidelines of this project.
  • I have added appropriate tests (unit, integration, system).
  • I have reviewed my changes before submitting this pull request.
  • I have linked the issue or issues that are solved by the PR if any.
  • I have agreed with the Contributor License Agreement (CLA).

Add method modeler.get_objects_by_name to be consistent with modeler.get_objects_by_material
@Devin-Crawford Devin-Crawford requested a review from a team as a code owner February 15, 2026 12:13
@github-actions github-actions bot added the bug Something isn't working label Feb 15, 2026
MaxJPRey
MaxJPRey previously approved these changes Feb 15, 2026
…_object' into fix/7257_improve_consistency_get_object
Copy link
Collaborator

@SMoraisAnsys SMoraisAnsys left a comment

Choose a reason for hiding this comment

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

Should we rework the API to work differently ? Like having a single method to do both approaches ? We could allow different kind of matching mechanism, e.g. (exact, contains, start/endswith, regex), whille keeping the pattern argument (meaning varying depending on the matching mechanism) and en/disabling case sensitive.

Open to discussion

A file containing x,y datapoints can be assigned as
a table to permeability.
…_object' into fix/7257_improve_consistency_get_object
@SMoraisAnsys
Copy link
Collaborator

Any thoughts on my comment @Devin-Crawford @Samuelopez-ansys @MaxJPRey (you reviewed, blame yourself for the ping :p)

name, xlist, ylist, is_project_dataset=is_project_dataset, x_unit=units[0], y_unit=units[1], sort=sort
)
else:
self.logger.error("Input file does not exist.")
Copy link
Member

Choose a reason for hiding this comment

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

I think it should raise an Exception

Copy link
Contributor Author

@Devin-Crawford Devin-Crawford Feb 20, 2026

Choose a reason for hiding this comment

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

I agree.

Suggested change
self.logger.error("Input file does not exist.")
error_message = f"Input file '{in_file}' does not exist."
self.logger.error(error_message)
raise FileNotFoundError(error_message)

@Samuelopez-ansys
Copy link
Member

Should we rework the API to work differently ? Like having a single method to do both approaches ? We could allow different kind of matching mechanism, e.g. (exact, contains, start/endswith, regex), whille keeping the pattern argument (meaning varying depending on the matching mechanism) and en/disabling case sensitive.

Open to discussion

What do you mean @SMoraisAnsys ?

get_objects_by_name and get_object_from_name?

I would keep get_object_from_name which already exist, and I would add a new argument to specify if you want a perfect match (like now) or partial (with Sebastien's ideas).

Thanks.

Co-authored-by: Sébastien Morais <146729917+SMoraisAnsys@users.noreply.github.com>
@Devin-Crawford
Copy link
Contributor Author

Devin-Crawford commented Feb 20, 2026

Should we rework the API to work differently ? Like having a single method to do both approaches ? We could allow different kind of matching mechanism, e.g. (exact, contains, start/endswith, regex), whille keeping the pattern argument (meaning varying depending on the matching mechanism) and en/disabling case sensitive.
Open to discussion

What do you mean @SMoraisAnsys ?

get_objects_by_name and get_object_from_name?

I would keep get_object_from_name which already exist, and I would add a new argument to specify if you want a perfect match (like now) or partial (with Sebastien's ideas).

  • get_objects_by_material() returns a list of objects.
  • get_object_from_name() returns a single object and the name must be specified exactly.
  • get_objects_by_name() is new and is consistent with the first method above. There
    are two inconsistencies: "from" vs "by". It doesn't matter which preposition
    is used but they should
    be consistent. get_object_from_name() wouldn't be necessary if we
    have get_objects_by_name(). We could add a named argument exact_match to return only
    a single object and then we would have get_object_from_name() functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve consistency of get_object...

5 participants