Mercurial > hg > auditok
changeset 409:183696f0111e
Update __repr__
author | Amine Sehili <amine.sehili@gmail.com> |
---|---|
date | Wed, 19 Jun 2024 23:24:23 +0200 |
parents | 60a7fb533fba |
children | 9c9112e23c1c |
files | auditok/core.py auditok/io.py auditok/util.py |
diffstat | 3 files changed, 14 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/auditok/core.py Wed Jun 19 23:12:01 2024 +0200 +++ b/auditok/core.py Wed Jun 19 23:24:23 2024 +0200 @@ -936,7 +936,7 @@ ) def __repr__(self): - return str(self) + return "<{}>".format(str(self)) def __add__(self, other): """
--- a/auditok/io.py Wed Jun 19 23:12:01 2024 +0200 +++ b/auditok/io.py Wed Jun 19 23:24:23 2024 +0200 @@ -228,6 +228,17 @@ """Number of channels in audio stream (alias for `channels`).""" return self.channels + def __str__(self): + return f"{self.__class__.__name__}(sampling_rate={self.sr}, sampling_rate={self.sw}, channels={self.ch})" # noqa: B950 + + def __repr__(self): + return ( + f"<{self.__class__.__name__}(" + f"sampling_rate={self.sampling_rate!r}, " + f"sample_width={self.sample_width!r}, " + f"channels={self.channels!r})>" + ) + class Rewindable(AudioSource): """
--- a/auditok/util.py Wed Jun 19 23:12:01 2024 +0200 +++ b/auditok/util.py Wed Jun 19 23:24:23 2024 +0200 @@ -691,9 +691,9 @@ if self.max_read is not None: max_read = "{:.3f}".format(self.max_read) return ( - "{cls}(block_dur={block_dur}, " + "<{cls}(block_dur={block_dur}, " "hop_dur={hop_dur}, record={rewindable}, " - "max_read={max_read})" + "max_read={max_read})>" ).format( cls=self.__class__.__name__, block_dur=block_dur,