From c9f239af356422bdc0ef3a1e515bcec834735582 Mon Sep 17 00:00:00 2001 From: awagenknecht <57978199+awagenknecht@users.noreply.github.com> Date: Thu, 30 May 2024 14:26:07 -0300 Subject: [PATCH 1/3] Test docstring add with setattr --- src/python/essentia/algorithms.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/python/essentia/algorithms.py b/src/python/essentia/algorithms.py index 0783925bb..9282dd417 100644 --- a/src/python/essentia/algorithms.py +++ b/src/python/essentia/algorithms.py @@ -140,3 +140,4 @@ def frame_times(self, sampleRate): setattr(essentia, 'FrameGenerator', FrameGenerator) + setattr(FrameGenerator, '__doc__', '''Test docstring 3''') From a9c8ea81f8dd75332aebe3099d52789ff8a298a1 Mon Sep 17 00:00:00 2001 From: awagenknecht <57978199+awagenknecht@users.noreply.github.com> Date: Thu, 30 May 2024 16:07:31 -0300 Subject: [PATCH 2/3] Set FrameGenerator docstring --- src/python/essentia/algorithms.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/python/essentia/algorithms.py b/src/python/essentia/algorithms.py index 9282dd417..02dd97101 100644 --- a/src/python/essentia/algorithms.py +++ b/src/python/essentia/algorithms.py @@ -138,6 +138,15 @@ def frame_times(self, sampleRate): times.append((start + self.hopSize * i) / sampleRate) return times + # Copy the docstring from FrameCutter and modify for FrameGenerator + docstr = default_fc.__doc__ + docstr = docstr.replace('FrameCutter', 'FrameGenerator') + # change input name for consistency with class definition + docstr = docstr.replace('Inputs:\n\n [vector_real] signal', 'Inputs:\n\n [vector_real] audio') + docstr = docstr.replace('Outputs:\n\n [vector_real] frame - the frame to write to', + 'Outputs:\n\n An iterator that returns each frame [vector_real] of the input signal.') + docstr = docstr[0:docstr.find('Description:')] + docstr += ('Description:\n\n ' + FrameGenerator.__struct__['description']) + setattr(FrameGenerator, '__doc__', docstr) setattr(essentia, 'FrameGenerator', FrameGenerator) - setattr(FrameGenerator, '__doc__', '''Test docstring 3''') From d274307542e9eff17aba0669e1c8dc0e0a7f6bbc Mon Sep 17 00:00:00 2001 From: awagenknecht <57978199+awagenknecht@users.noreply.github.com> Date: Thu, 30 May 2024 16:22:15 -0300 Subject: [PATCH 3/3] Minor change to FrameGenerator docstring --- src/python/essentia/algorithms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/essentia/algorithms.py b/src/python/essentia/algorithms.py index 02dd97101..7a427110e 100644 --- a/src/python/essentia/algorithms.py +++ b/src/python/essentia/algorithms.py @@ -144,7 +144,7 @@ def frame_times(self, sampleRate): # change input name for consistency with class definition docstr = docstr.replace('Inputs:\n\n [vector_real] signal', 'Inputs:\n\n [vector_real] audio') docstr = docstr.replace('Outputs:\n\n [vector_real] frame - the frame to write to', - 'Outputs:\n\n An iterator that returns each frame [vector_real] of the input signal.') + 'Outputs:\n\n An iterator that returns each frame [vector_real] of the input audio.') docstr = docstr[0:docstr.find('Description:')] docstr += ('Description:\n\n ' + FrameGenerator.__struct__['description']) setattr(FrameGenerator, '__doc__', docstr)