Skip to content

Video editing with Python

make flake8 happier

Valentin Zulkower2cce9c91881a
diff --git a/moviepy/Effect.py b/moviepy/Effect.py
index 6f8bdf77..531e07c1 100644
--- a/moviepy/Effect.py
+++ b/moviepy/Effect.py
@@ -33,7 +33,7 @@ class Effect(metaclass=ABCMeta):
"""Apply the current effect on a clip
Parameters
- --------------
+ ----------
clip
The target clip to apply the effect on.
(Internally, MoviePy will always pass a copy of the original clip)
diff --git a/moviepy/audio/fx/AudioDelay.py b/moviepy/audio/fx/AudioDelay.py
index fccde9d9..25c98317 100644
--- a/moviepy/audio/fx/AudioDelay.py
+++ b/moviepy/audio/fx/AudioDelay.py
@@ -53,6 +53,7 @@ class AudioDelay(Effect):
@audio_video_effect
def apply(self, clip: Clip) -> Clip:
+ """Apply the effect to the clip."""
decayments = np.linspace(1, max(0, self.decay), self.n_repeats + 1)
return CompositeAudioClip(
[
diff --git a/moviepy/audio/fx/AudioFadeIn.py b/moviepy/audio/fx/AudioFadeIn.py
index 7ade56d7..efae2090 100644
--- a/moviepy/audio/fx/AudioFadeIn.py
+++ b/moviepy/audio/fx/AudioFadeIn.py
@@ -43,6 +43,7 @@ class AudioFadeIn(Effect):
@audio_video_effect
def apply(self, clip: Clip) -> Clip:
+ """Apply the effect to the clip."""
if clip.duration is None:
raise ValueError("Attribute 'duration' not set")
diff --git a/moviepy/audio/fx/AudioFadeOut.py b/moviepy/audio/fx/AudioFadeOut.py
index 6d1e18e7..b2d9e156 100644
--- a/moviepy/audio/fx/AudioFadeOut.py
+++ b/moviepy/audio/fx/AudioFadeOut.py
@@ -44,6 +44,7 @@ class AudioFadeOut(Effect):
@audio_video_effect
def apply(self, clip: Clip) -> Clip:
+ """Apply the effect to the clip."""
if clip.duration is None:
raise ValueError("Attribute 'duration' not set")
diff --git a/moviepy/audio/fx/AudioLoop.py b/moviepy/audio/fx/AudioLoop.py
index 0acb96db..ceea293c 100644
--- a/moviepy/audio/fx/AudioLoop.py
+++ b/moviepy/audio/fx/AudioLoop.py
@@ -29,6 +29,7 @@ class AudioLoop(Effect):
@audio_video_effect
def apply(self, clip: Clip) -> Clip:
+ """Apply the effect to the clip."""
if self.duration is not None:
self.n_loops = int(self.duration / clip.duration) + 1
return concatenate_audioclips(self.n_loops * [clip]).with_duration(
diff --git a/moviepy/audio/fx/AudioNormalize.py b/moviepy/audio/fx/AudioNormalize.py
index 6e496946..20ccd3b1 100644
--- a/moviepy/audio/fx/AudioNormalize.py
+++ b/moviepy/audio/fx/AudioNormalize.py
@@ -23,6 +23,7 @@ class AudioNormalize(Effect):
@audio_video_effect
def apply(self, clip: Clip) -> Clip:
+ """Apply the effect to the clip."""
max_volume = clip.max_volume()
if max_volume == 0:
return clip
diff --git a/moviepy/audio/fx/MultiplyStereoVolume.py b/moviepy/audio/fx/MultiplyStereoVolume.py
index de5e95ca..2bc4d964 100644
--- a/moviepy/audio/fx/MultiplyStereoVolume.py
+++ b/moviepy/audio/fx/MultiplyStereoVolume.py
@@ -28,6 +28,8 @@ class MultiplyStereoVolume(Effect):
@audio_video_effect
def apply(self, clip: Clip) -> Clip:
+ """Apply the effect to the clip."""
+
def stereo_volume(get_frame, t):
frame = get_frame(t)
if len(frame) == 1: # mono
diff --git a/moviepy/audio/fx/MultiplyVolume.py b/moviepy/audio/fx/MultiplyVolume.py
index 453f793c..3f7c20f9 100644
--- a/moviepy/audio/fx/MultiplyVolume.py
+++ b/moviepy/audio/fx/MultiplyVolume.py
@@ -70,6 +70,7 @@ class MultiplyVolume(Effect):
@audio_video_effect
def apply(self, clip: Clip) -> Clip:
+ """Apply the effect to the clip."""
if self.start_time is None and self.end_time is None:
return clip.transform(
lambda get_frame, t: self.factor * get_frame(t),
diff --git a/moviepy/audio/io/readers.py b/moviepy/audio/io/readers.py
index dd49d08e..0b1012f3 100644
--- a/moviepy/audio/io/readers.py
+++ b/moviepy/audio/io/readers.py
@@ -37,7 +37,6 @@ class FFMPEG_AudioReader:
nbytes
Desired number of bytes (1,2,4) in the signal that will be
received from ffmpeg
-
"""
def __init__(
@@ -122,25 +121,21 @@ class FFMPEG_AudioReader:
self.pos = np.round(self.fps * start_time)
def skip_chunk(self, chunksize):
- """
- This method skips a chunk of audio data by reading and discarding
- the specified number of frames from the audio stream. The audio
- stream is read from the `proc` stdout. After skipping the chunk, the
- `pos` attribute is updated accordingly.
+ """Skip a chunk of audio data by reading and discarding the specified number of
+ frames from the audio stream. The audio stream is read from the `proc` stdout.
+ After skipping the chunk, the `pos` attribute is updated accordingly.
Parameters
- -----------
-
- chunksize (int): The number of audio frames to skip.
-
+ ----------
+ chunksize (int):
+ The number of audio frames to skip.
"""
_ = self.proc.stdout.read(self.nchannels * chunksize * self.nbytes)
self.proc.stdout.flush()
self.pos = self.pos + chunksize
def read_chunk(self, chunksize):
- """
- Reads a chunk of audio data from the audio stream.
+ """Read a chunk of audio data from the audio stream.
This method reads a chunk of audio data from the audio stream. The
specified number of frames, given by `chunksize`, is read from the
@@ -150,9 +145,10 @@ class FFMPEG_AudioReader:
portion is padded with zeros, ensuring that the returned array has
the desired length. The `pos` attribute is updated accordingly.
- Parameters:
- ------------
- chunksize (float): The desired number of audio frames to read.
+ Parameters
+ ----------
+ chunksize (float):
+ The desired number of audio frames to read.
"""
# chunksize is not being autoconverted from float to int
@@ -196,12 +192,12 @@ class FFMPEG_AudioReader:
"""Retrieves the audio frame(s) corresponding to the given timestamp(s).
Parameters
- -----------
-
- tt (float or numpy.ndarray): The timestamp(s) at which to retrieve the
- audio frame(s). If `tt` is a single float value, the frame corresponding
- to that timestamp is returned. If `tt` is a NumPy array of timestamps,
- an array of frames corresponding to each timestamp is returned.
+ ----------
+ tt (float or numpy.ndarray):
+ The timestamp(s) at which to retrieve the audio frame(s).
+ If `tt` is a single float value, the frame corresponding to that
+ timestamp is returned. If `tt` is a NumPy array of timestamps, an
+ array of frames corresponding to each timestamp is returned.
"""
if isinstance(tt, np.ndarray):
# lazy implementation, but should not cause problems in
@@ -263,10 +259,7 @@ class FFMPEG_AudioReader:
return self.buffer[ind - self.buffer_startframe]
def buffer_around(self, frame_number):
- """
- Fills the buffer with frames, centered on ``frame_number``
- if possible
- """
+ """Fills the buffer with frames, centered on ``frame_number``if possible"""
# start-frame for the buffer
new_bufferstart = max(0, frame_number - self.buffersize // 2)