Skip to content

Commit

Permalink
Overhaul implementation of NamedLists and StringLists. (#12)
Browse files Browse the repository at this point in the history
We no longer inherit from a list, so as to avoid complications with the base
types. We also refactor the StringList class so that it is now based on
NamedList, thus giving it access to names. (We make sure to prevent
naming of Factor levels, though, as that is unnecessarily complicated.)
  • Loading branch information
LTLA authored Nov 14, 2023
1 parent acf7630 commit af70930
Show file tree
Hide file tree
Showing 6 changed files with 623 additions and 411 deletions.
2 changes: 2 additions & 0 deletions src/biocutils/Factor.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def __init__(self, codes: Sequence[int], levels: Sequence[str], ordered: bool =

if not isinstance(levels, StringList):
levels = StringList(levels)
if levels.get_names() is not None:
levels = levels.set_names(None)

self._codes = codes
self._levels = levels
Expand Down
Loading

0 comments on commit af70930

Please sign in to comment.