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

Clarify behaviour and error messages for results.Result objects #41

Closed
YHordijk opened this issue Oct 14, 2023 · 2 comments · Fixed by #42
Closed

Clarify behaviour and error messages for results.Result objects #41

YHordijk opened this issue Oct 14, 2023 · 2 comments · Fixed by #42
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@YHordijk
Copy link
Contributor

Currently the results.Result object is not behaving ideally.

  1. Accessing an empty key should return None instead of an empty Result object. Alternatively, we should raise an error
  2. Accessing an empty key should not create it, only if we assign a key should we assign higher level empty keys
  3. Error messages should originate from raising a KeyValue exception
@YHordijk YHordijk added bug Something isn't working enhancement New feature or request labels Oct 14, 2023
@YHordijk YHordijk self-assigned this Oct 14, 2023
@YHordijk
Copy link
Contributor Author

I have implemented a method to get the parents of a Result object in a nice format. I then use it to give more detailed error messages when attempting to call __call__ or __hash__ of a Result object. Previously this would give a not-so-helpful "could not hash Result object" or "Result object is not callable" exception.

@YHordijk
Copy link
Contributor Author

I have also added a prune method to the Result class. This will remove empty paths in the object, cleaning it up. This might be helpful to call before printing the object or before writing it to a file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant