Skip to content

Commit

Permalink
make flake8 happier
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentin Zulkower committed Nov 20, 2024
1 parent 2cce9c9 commit 0201fec
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 38 deletions.
10 changes: 4 additions & 6 deletions moviepy/audio/io/readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@


class FFMPEG_AudioReader:
"""
A class to read the audio in either video files or audio files
"""A class to read the audio in either video files or audio files
using ffmpeg. ffmpeg will read any audio and transform them into
raw data.
Expand Down Expand Up @@ -172,8 +171,7 @@ def read_chunk(self, chunksize):
return result

def seek(self, pos):
"""
Reads a frame at time t. Note for coders: getting an arbitrary
"""Read a frame at time t. Note for coders: getting an arbitrary
frame in the video with ffmpeg can be painfully slow if some
decoding has to be done. This function tries to avoid fectching
arbitrary frames whenever possible, by moving between adjacent
Expand All @@ -189,7 +187,7 @@ def seek(self, pos):
self.pos = pos

def get_frame(self, tt):
"""Retrieves the audio frame(s) corresponding to the given timestamp(s).
"""Retrieve the audio frame(s) corresponding to the given timestamp(s).
Parameters
----------
Expand Down Expand Up @@ -259,7 +257,7 @@ def get_frame(self, tt):
return self.buffer[ind - self.buffer_startframe]

def buffer_around(self, frame_number):
"""Fills the buffer with frames, centered on ``frame_number``if possible"""
"""Fill the buffer with frames, centered on frame_number if possible."""
# start-frame for the buffer
new_bufferstart = max(0, frame_number - self.buffersize // 2)

Expand Down
2 changes: 1 addition & 1 deletion moviepy/video/VideoClip.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ def fill_array(self, pre_array, shape=(0, 0)):
The resulting array with the filled shape is returned.
Parameters
------------
----------
pre_array (numpy.ndarray)
The original array to be filled.
Expand Down
27 changes: 13 additions & 14 deletions moviepy/video/fx/Crop.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,10 @@

@dataclass
class Crop(Effect):
x1: int = None
y1: int = None
x2: int = None
y2: int = None
width: int = None
height: int = None
x_center: int = None
y_center: int = None

"""
Returns a new clip in which just a rectangular subregion of the
original clip is conserved. x1,y1 indicates the top left corner and
x2,y2 is the lower right corner of the croped region.
All coordinates are in pixels. Float numbers are accepted.
"""Effect to crop a clip to get a new clip in which just a rectangular
subregion of the original clip is conserved. `x1,y1` indicates the top left
corner and `x2,y2` is the lower right corner of the cropped region. All
coordinates are in pixels. Float numbers are accepted.
To crop an arbitrary rectangle:
Expand All @@ -44,6 +34,15 @@ class Crop(Effect):
"""

x1: int = None
y1: int = None
x2: int = None
y2: int = None
width: int = None
height: int = None
x_center: int = None
y_center: int = None

def apply(self, clip: Clip) -> Clip:
"""Apply the effect to the clip."""
if self.width and self.x1 is not None:
Expand Down
3 changes: 2 additions & 1 deletion moviepy/video/fx/Resize.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

@dataclass
class Resize(Effect):
"""Returns a video clip that is a resized version of the clip.
"""Effect returning a video clip that is a resized version of the clip.
Parameters
----------
Expand Down Expand Up @@ -44,6 +44,7 @@ class Resize(Effect):
apply_to_mask: bool = True

def resizer(self, pic, new_size):
"""Resize the image using PIL."""
new_size = list(map(int, new_size))
pil_img = Image.fromarray(pic)
resized_pil = pil_img.resize(new_size, Image.Resampling.LANCZOS)
Expand Down
34 changes: 18 additions & 16 deletions moviepy/video/fx/Scroll.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@


class Scroll(Effect):
"""Effect that scrolls horizontally or vertically a clip, e.g. to make end credits
Parameters
----------
w, h
The width and height of the final clip. Default to clip.w and clip.h
x_speed, y_speed
The speed of the scroll in the x and y directions.
x_start, y_start
The starting position of the scroll in the x and y directions.
apply_to
Whether to apply the effect to the mask too.
"""

def __init__(
self,
w=None,
Expand All @@ -12,23 +30,7 @@ def __init__(
y_start=0,
apply_to="mask",
):
"""
Scrolls horizontally or vertically a clip, e.g. to make end credits
Parameters
----------
w, h
The width and height of the final clip. Default to clip.w and clip.h
x_speed, y_speed
x_start, y_start
apply_to

"""
self.w = w
self.h = h
self.x_speed = x_speed
Expand Down

0 comments on commit 0201fec

Please sign in to comment.