Skip to content

Commit

Permalink
core.LenaSequence gets a comparison operator (Split already had it).
Browse files Browse the repository at this point in the history
  • Loading branch information
ynikitenko committed Sep 20, 2023
1 parent 269824e commit b9fd312
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lena/core/lena_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ def repr_maybe_nested(el, base_indent, indent):
return "".join([base_indent, self._name,
"(", mnl, elems, mnl, mbi, ")"])

def __eq__(self, other):
if not isinstance(other, LenaSequence):
return NotImplemented
return self._seq == other._seq

def __repr__(self):
# maybe: make a compact representation with repr
# and nested with str
Expand Down
3 changes: 2 additions & 1 deletion lena/core/split.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def repr_maybe_nested(el, base_indent, indent):
mnl = ""
mbi = ""
# diff here in name and brackets
return "".join([base_indent, "Split",
return "".join([base_indent, self._name,
"([", mnl, elems, mnl, mbi, "])"])

def _get_context(self):
Expand Down Expand Up @@ -272,6 +272,7 @@ def __init__(self, seqs, bufsize=1000, copy_buf=True):
"or None, {} provided".format(bufsize)
)
self._bufsize = bufsize
self._name = "Split"

super(Split, self).__init__(new_seqs)

Expand Down

0 comments on commit b9fd312

Please sign in to comment.