Skip to content

Commit cd0fa74

Browse files
committed
switch to classmethod
1 parent c8aa740 commit cd0fa74

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/biocutils/named_list.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -482,28 +482,28 @@ def as_dict(self) -> Dict[str, Any]:
482482
output[n] = self[i]
483483
return output
484484

485-
@staticmethod
486-
def from_list(x: list) -> "NamedList":
485+
@classmethod
486+
def from_list(cls, x: list) -> "NamedList":
487487
"""
488488
Args:
489489
x: List of data elements.
490490
491491
Returns:
492-
A ``NamedList`` instance with the contents of ``x`` and no names.
492+
A instance with the contents of ``x`` and no names.
493493
"""
494-
return NamedList(x)
494+
return cls(x)
495495

496-
@staticmethod
497-
def from_dict(x: dict) -> "NamedList":
496+
@classmethod
497+
def from_dict(cls, x: dict) -> "NamedList":
498498
"""
499499
Args:
500500
x: Dictionary where keys are strings (or can be coerced to them).
501501
502502
Returns:
503-
A ``NamedList`` instance where the list elements are the values of
503+
A instance where the list elements are the values of
504504
``x`` and the names are the stringified keys.
505505
"""
506-
return NamedList(list(x.values()), names=Names(str(y) for y in x.keys()))
506+
return cls(list(x.values()), names=Names(str(y) for y in x.keys()))
507507

508508

509509
@subset_sequence.register

0 commit comments

Comments
 (0)