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

__repr__ implemented for SettingProperties. #5497

Merged
merged 11 commits into from
Sep 30, 2024
4 changes: 4 additions & 0 deletions argilla/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ These are the section headers that we use:

- Added `limit` argument when fetching records. ([#5525](https://github.com/argilla-io/argilla/pull/5525)

### Changed

- Changed the __repr__ method for `SettingsProperties` to display the details of all the properties in `Setting` object. ([#5380](https://github.com/argilla-io/argilla/issues/5380))
bikash119 marked this conversation as resolved.
Show resolved Hide resolved
### Fixed

- Fixed the deployment yaml used to create a new Argilla server in K8s. Added `USERNAME` and `PASSWORD` to the environment variables of pod template. ([#5434](https://github.com/argilla-io/argilla/issues/5434))
Expand Down Expand Up @@ -52,6 +55,7 @@ These are the section headers that we use:
- Added multiple error handling methods to the `rg.Dataset.records.log` method to warn, ignore, or raise errors. ([#5466](https://github.com/argilla-io/argilla/pull/5463))
- Changed dataset import and export of `rg.LabelQuestion` to use `datasets.ClassLabel` not `datasets.Value`. ([#5474](https://github.com/argilla-io/argilla/pull/5474))


## [2.1.0](https://github.com/argilla-io/argilla/compare/v2.0.1...v2.1.0)

### Added
Expand Down
5 changes: 5 additions & 0 deletions argilla/src/argilla/settings/_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,11 @@ def _validate_new_property(self, property: Property) -> None:
if property.name in dir(self):
raise ValueError(f"Property with name {property.name!r} conflicts with an existing attribute")

def __repr__(self) -> str:
bikash119 marked this conversation as resolved.
Show resolved Hide resolved
"""Return a string representation of the object."""

return f"{repr([prop for prop in self])}"


class QuestionsProperties(SettingsProperties[QuestionType]):
"""
Expand Down
11 changes: 10 additions & 1 deletion argilla/tests/unit/test_settings/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,25 @@ def test_settings_repr(self):
settings = rg.Settings(
fields=[
rg.TextField(name="text", title="text"),
rg.ImageField(name="image", title="image"),
],
metadata=[
rg.FloatMetadataProperty("source"),
],
questions=[
rg.LabelQuestion(name="label", title="text", labels=["positive", "negative"]),
rg.RatingQuestion(name="rating", title="text", values=[1, 2, 3, 4, 5]),
rg.TextQuestion(name="text", title="text"),
rg.SpanQuestion(
name="span",
title="text",
field="text",
labels=["Apparatus", "Method", "Machine", "Manufacture", "Design"],
visible_labels=3,
),
],
vectors=[rg.VectorField(name="text", dimensions=3)],
)

assert (
settings.__repr__() == f"Settings(guidelines=None, allow_extra_metadata=False, "
"distribution=OverlapTaskDistribution(min_submitted=1), "
Expand Down