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

Fixed RecordArray.__repr__ (last vestige of 'override' misunderstanding). #1537

Merged
merged 1 commit into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions src/awkward/_v2/types/recordtype.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,17 +174,8 @@ def _str(self, indent, compact):
return [self._str_categorical_begin()] + out + [self._str_categorical_end()]

def __repr__(self):
if (
self._typestr != "override"
and self._parameters is not None
and len(self._parameters) == 1
and "__record__" in self._parameters
):
args = dict(zip(self._fields, [x.primitive for x in self._contents]))
return "{}[{}]".format(self._parameters["__record__"], str(args)[1:-1])
else:
args = [repr(self._contents), repr(self._fields)] + self._repr_args()
return "{}({})".format(type(self).__name__, ", ".join(args))
args = [repr(self._contents), repr(self._fields)] + self._repr_args()
return "{}({})".format(type(self).__name__, ", ".join(args))

def __eq__(self, other):
if isinstance(other, RecordType):
Expand Down
4 changes: 1 addition & 3 deletions tests/v2/test_0032-replace-dressedtype.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ def test_record_name():

a = builder.snapshot()

assert (
repr(a.layout.form._type(typestrs)) == "Dummy['one': 'int64', 'two': 'float64']"
)
assert str(a.layout.form._type(typestrs)) == "Dummy[one: int64, two: float64]"
assert a.layout.form._type(typestrs).parameters == {"__record__": "Dummy"}


Expand Down