Commit 27bc3570 authored by Martin Larralde's avatar Martin Larralde
Browse files

Add `__repr__` implementation to `pyhmmer.plan7.HMMFile`

parent c13e6115
Pipeline #32790 failed with stage
in 5 minutes and 16 seconds
......@@ -139,7 +139,8 @@ cdef class HMM:
cdef class HMMFile:
cdef P7_HMMFILE* _hfp
cdef Alphabet _alphabet
cdef Alphabet _alphabet
cdef object _file
cpdef HMM read(self)
cpdef void close(self)
......
......@@ -356,6 +356,7 @@ class HMMFile(typing.ContextManager[HMMFile], typing.Iterator[HMM]):
) -> bool: ...
def __iter__(self) -> HMMFile: ...
def __next__(self) -> HMM: ...
def __repr__(self) -> str: ...
@property
def closed(self) -> bool: ...
def is_pressed(self) -> bool: ...
......@@ -447,6 +448,7 @@ class OptimizedProfile(object):
class Offsets(object):
def __init__(self, owner: typing.Union[Profile, OptimizedProfile]) -> None: ...
def __copy__(self) -> Offsets: ...
def __repr__(self) -> str: ...
@property
def model(self) -> typing.Optional[int]: ...
@model.setter
......
......@@ -2901,6 +2901,7 @@ cdef class HMMFile:
self._alphabet = Alphabet.__new__(Alphabet)
self._alphabet._abc = NULL
self._file = file
def __dealloc__(self):
if self._hfp:
......@@ -2922,6 +2923,12 @@ cdef class HMMFile:
raise StopIteration()
return hmm
def __repr__(self):
cdef type ty = type(self)
cdef str name = ty.__name__
cdef str mod = ty.__module__
return f"{mod}.{name}({self._file!r}, db={self.is_pressed()!r})"
# --- Properties ---------------------------------------------------------
@property
......@@ -3732,7 +3739,7 @@ cdef class Offsets:
copy._owner = self._owner
return copy
def __str__(self):
def __repr__(self):
ty = type(self).__name__
return "<offsets of {!r} model={!r} filter={!r} profile={!r}>".format(
self._owner,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment