Skip to content

Commit

Permalink
fix the repr for OrderedSet to actually execute correctly
Browse files Browse the repository at this point in the history
Old:
```
OrderedSet("'foo'", "'bar'", "'baz'")
```

New:
```
OrderedSet(['foo', 'bar', 'baz'])
```

The old one looked nasty *and* was totally non-functional.
  • Loading branch information
eli-schwartz authored and xclaesse committed Oct 20, 2023
1 parent 34ac2e4 commit ae7a9b0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mesonbuild/utils/universal.py
Original file line number Diff line number Diff line change
Expand Up @@ -1886,8 +1886,8 @@ def __len__(self) -> int:
def __repr__(self) -> str:
# Don't print 'OrderedSet("")' for an empty set.
if self.__container:
return 'OrderedSet("{}")'.format(
'", "'.join(repr(e) for e in self.__container.keys()))
return 'OrderedSet([{}])'.format(
', '.join(repr(e) for e in self.__container.keys()))
return 'OrderedSet()'

def __reversed__(self) -> T.Iterator[_T]:
Expand Down

0 comments on commit ae7a9b0

Please sign in to comment.