Skip to content

feat: added __str__ to PreProcessing and DataTypes#717

Open
mark-neuracore wants to merge 1 commit into
mainfrom
feat/add-__str__-to-preprocessing-and-datatypes
Open

feat: added __str__ to PreProcessing and DataTypes#717
mark-neuracore wants to merge 1 commit into
mainfrom
feat/add-__str__-to-preprocessing-and-datatypes

Conversation

@mark-neuracore

Copy link
Copy Markdown
Contributor

Features

  • added string to data types and preprocessing.

Items

@mark-neuracore mark-neuracore self-assigned this Jun 17, 2026
@mark-neuracore mark-neuracore added the version:patch non-breaking bug fixes; no input/output changes (except defaults) label Jun 17, 2026

@aditya-neuraco aditya-neuraco left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM w/ comments

resolve_preprocessing_config,
)
from neuracore.ml.preprocessing.base import PreprocessingConfiguration
from neuracore.ml.utils.preprocessing_utils import resolve_preprocessing_config

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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__()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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,

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

Labels

version:patch non-breaking bug fixes; no input/output changes (except defaults)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants