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

implement __repr__ such that eval(repr(instance)) is an instance #237

Merged
merged 26 commits into from
Mar 17, 2022
Merged

Conversation

carnisj
Copy link
Owner

@carnisj carnisj commented Mar 16, 2022

Implement correctly the __repr__ method in classes such that eval(repr(instance)) is itself an instance of the class.

  • Implement generic functions utilities.create_repr and utilities.format_repr
  • Use the generic functions in all __repr__ methods
  • Add corresponding unit tests
  • As a side effect, the parameter beamline from Setup had to be renamed beamline_name, because it was overlapping with the attribute beamline which is a Beamline instance

Fixes #207

Tests pass, also checked with the example dataset.

Type of change

  • New feature (breaking change which adds functionality)

Checklist:

  • I have made corresponding changes to the documentation
  • I have added corresponding unit tests
  • I have run doit and all tasks have passed

@carnisj carnisj marked this pull request as draft March 16, 2022 07:35
@carnisj carnisj marked this pull request as ready for review March 16, 2022 13:42
@carnisj carnisj requested a review from DSimonne March 16, 2022 20:21
@carnisj
Copy link
Owner Author

carnisj commented Mar 16, 2022

Hi @DSimonne could you have a look at this PR? I would like to merge it before to avoid conflicts

@DSimonne
Copy link
Collaborator

I can try to have a look this week

@carnisj carnisj merged commit 695c27f into main Mar 17, 2022
@carnisj carnisj deleted the repr branch March 17, 2022 20:25
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.

[Refactor] implement __repr__ in the correct way in the classes
2 participants