feat: added __str__ to PreProcessing and DataTypes#717
Open
mark-neuracore wants to merge 1 commit into
Open
Conversation
aditya-neuraco
approved these changes
Jun 18, 2026
| resolve_preprocessing_config, | ||
| ) | ||
| from neuracore.ml.preprocessing.base import PreprocessingConfiguration | ||
| from neuracore.ml.utils.preprocessing_utils import resolve_preprocessing_config |
Contributor
There was a problem hiding this comment.
Nit: since it's already in the utils file, no need to call it preprocessing_utils
Comment on lines
+61
to
+65
| assert "PreprocessingConfiguration({" in rendered | ||
| assert "RGB_IMAGES: [ResizePad(size=[224, 224])]" in rendered | ||
| assert "DEPTH_IMAGES: [ResizePad(size=[224, 224])]" in rendered | ||
| assert "object at 0x" not in rendered | ||
| assert "DataType." not in rendered |
Contributor
There was a problem hiding this comment.
It's a good idea to assert the whole string here for strict correctness.
Comment on lines
+41
to
+49
| def __str__(self) -> str: | ||
| """Return a human-readable representation of the preprocessing method.""" | ||
| params = {k: v for k, v in self.to_dict().items() if k != "_target_"} | ||
| param_str = ", ".join(f"{name}={value!r}" for name, value in params.items()) | ||
| return f"{self.__class__.__name__}({param_str})" | ||
|
|
||
| def __repr__(self) -> str: | ||
| """Return a human-readable representation for debugging.""" | ||
| return self.__str__() |
Contributor
There was a problem hiding this comment.
I feel __str__ and __repr__ should be flipped here.
__repr__ shoul tell you more about the class, __str__ is supposed to be a easy to interpret string representation,
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Features
Items