Skip to content

Video editing with Python

format(black): formatted files to latest version (#1735)

Tharun K0b63f472ee0b
diff --git a/examples/moving_letters.py b/examples/moving_letters.py
index 696affd3..ece42208 100644
--- a/examples/moving_letters.py
+++ b/examples/moving_letters.py
@@ -20,7 +20,7 @@ rotMatrix = lambda a: np.array([[np.cos(a), np.sin(a)], [-np.sin(a), np.cos(a)]]
def vortex(screenpos, i, nletters): # noqa D103
- d = lambda t: 1.0 / (0.3 + t ** 8) # damping
+ d = lambda t: 1.0 / (0.3 + t**8) # damping
a = i * np.pi / nletters # angle of the movement
v = rotMatrix(a).dot([-1, 0])
if i % 2:
@@ -30,7 +30,7 @@ def vortex(screenpos, i, nletters): # noqa D103
def cascade(screenpos, i, nletters): # noqa D103
v = np.array([0, -1])
- d = lambda t: 1 if t < 0 else abs(np.sinc(t) / (1 + t ** 4))
+ d = lambda t: 1 if t < 0 else abs(np.sinc(t) / (1 + t**4))
return lambda t: screenpos + v * 400 * d(t - 0.15 * i)
diff --git a/moviepy/audio/tools/cuts.py b/moviepy/audio/tools/cuts.py
index 6abf5ea2..e0ade76d 100644
--- a/moviepy/audio/tools/cuts.py
+++ b/moviepy/audio/tools/cuts.py
@@ -21,7 +21,7 @@ def find_audio_period(clip, min_time=0.1, max_time=2, time_resolution=0.01):
chunksize = int(time_resolution * clip.fps)
chunk_duration = 1.0 * chunksize / clip.fps
# v denotes the list of volumes
- v = np.array([(chunk ** 2).sum() for chunk in clip.iter_chunks(chunksize)])
+ v = np.array([(chunk**2).sum() for chunk in clip.iter_chunks(chunksize)])
v = v - v.mean()
corrs = np.correlate(v, v, mode="full")[-len(v) :]
corrs[: int(min_time / chunk_duration)] = 0
diff --git a/moviepy/video/fx/accel_decel.py b/moviepy/video/fx/accel_decel.py
index d157675a..8145c17c 100644
--- a/moviepy/video/fx/accel_decel.py
+++ b/moviepy/video/fx/accel_decel.py
@@ -3,7 +3,7 @@ def _f_accel_decel(t, old_duration, new_duration, abruptness=1.0, soonness=1.0):
def _f(t):
def f1(t):
- return (0.5) ** (1 - a) * (t ** a)
+ return (0.5) ** (1 - a) * (t**a)
def f2(t):
return 1 - f1(1 - t)
diff --git a/moviepy/video/fx/mask_color.py b/moviepy/video/fx/mask_color.py
index fec1ddc8..cc82e2f6 100644
--- a/moviepy/video/fx/mask_color.py
+++ b/moviepy/video/fx/mask_color.py
@@ -21,7 +21,7 @@ def mask_color(clip, color=None, threshold=0, stiffness=1):
def hill(x):
if threshold:
- return x ** stiffness / (threshold ** stiffness + x ** stiffness)
+ return x**stiffness / (threshold**stiffness + x**stiffness)
else:
return 1.0 * (x != 0)
diff --git a/moviepy/video/io/ffmpeg_reader.py b/moviepy/video/io/ffmpeg_reader.py
index 21181e80..3e245573 100644
--- a/moviepy/video/io/ffmpeg_reader.py
+++ b/moviepy/video/io/ffmpeg_reader.py
@@ -791,7 +791,7 @@ def ffmpeg_parse_infos(
popen_params = cross_platform_popen_params(
{
- "bufsize": 10 ** 5,
+ "bufsize": 10**5,
"stdout": sp.PIPE,
"stderr": sp.PIPE,
"stdin": sp.DEVNULL,
diff --git a/moviepy/video/io/html_tools.py b/moviepy/video/io/html_tools.py
index 706cc6c7..d18b6a4e 100644
--- a/moviepy/video/io/html_tools.py
+++ b/moviepy/video/io/html_tools.py
@@ -27,7 +27,6 @@ try: # pragma: no cover
def __add__(self, other):
return HTML2(self.data + other.data)
-
except ImportError:
def HTML2(content): # noqa D103
diff --git a/moviepy/video/tools/drawing.py b/moviepy/video/tools/drawing.py
index f702e3fa..070bf485 100644
--- a/moviepy/video/tools/drawing.py
+++ b/moviepy/video/tools/drawing.py
@@ -165,7 +165,7 @@ def color_gradient(
vector = np.array(vector[::-1])
norm = np.linalg.norm(vector)
- n_vec = vector / norm ** 2 # norm 1/norm(vector)
+ n_vec = vector / norm**2 # norm 1/norm(vector)
p1 = p1 + offset * vector
arr = (M - p1).dot(n_vec) / (1 - offset)
diff --git a/tests/test_examples.py b/tests/test_examples.py
index 085c3cd9..2c3fe228 100644
--- a/tests/test_examples.py
+++ b/tests/test_examples.py
@@ -31,7 +31,7 @@ def test_matplotlib_simple_example(util):
def make_frame(t):
ax.clear()
- ax.plot(x, np.sinc(x ** 2) + np.sin(x + 2 * np.pi / duration * t), lw=3)
+ ax.plot(x, np.sinc(x**2) + np.sin(x + 2 * np.pi / duration * t), lw=3)
ax.set_ylim(-1.5, 2.5)
return mplfig_to_npimage(fig)
diff --git a/tests/test_issues.py b/tests/test_issues.py
index 02bf32b1..1abcedc6 100644
--- a/tests/test_issues.py
+++ b/tests/test_issues.py
@@ -293,7 +293,7 @@ def test_issue_368(util):
classifier = svm.SVC(gamma=2, C=1)
# the varying weights make the points appear one after the other
- weights = np.minimum(1, np.maximum(0, t ** 2 + 10 - np.arange(50)))
+ weights = np.minimum(1, np.maximum(0, t**2 + 10 - np.arange(50)))
classifier.fit(X, Y, sample_weight=weights)
Z = classifier.decision_function(np.c_[xx.ravel(), yy.ravel()])
Z = Z.reshape(xx.shape)