mirror of
https://github.com/Zulko/moviepy.git
synced 2021-07-27 01:17:47 +03:00
Add missing modules docstrings (except for FXs) (#1611)
* Add module docstrings except in FXs * Update flake8 config * Remove 'find_latest_imagemagick_version.py' * Add tests modules docstrings * Don't execute doctests for tests/ modules * Prevent test error in Windows
This commit is contained in:
2
.github/workflows/format_check.yml
vendored
2
.github/workflows/format_check.yml
vendored
@@ -29,7 +29,7 @@ jobs:
|
||||
- name: Lint examples
|
||||
run: flake8 examples --show-source
|
||||
- name: Lint scripts
|
||||
run: flake8 setup.py find_latest_imagemagick_version.py docs/conf.py --show-source
|
||||
run: flake8 setup.py docs/conf.py --show-source
|
||||
- name: Lint tests
|
||||
run: flake8 tests --show-source
|
||||
- name: Lint moviepy
|
||||
|
||||
4
.github/workflows/test_suite.yml
vendored
4
.github/workflows/test_suite.yml
vendored
@@ -59,7 +59,7 @@ jobs:
|
||||
|
||||
- name: Test with pytest
|
||||
run: |
|
||||
pythonw -m pytest tests/ --doctest-modules -v --cov moviepy --cov-report term-missing
|
||||
pythonw -m pytest --doctest-glob "moviepy/**/**.py" -v --cov moviepy --cov-report term-missing
|
||||
|
||||
- name: Coveralls
|
||||
run: coveralls
|
||||
@@ -172,7 +172,7 @@ jobs:
|
||||
|
||||
- name: PyTest
|
||||
run: |
|
||||
pytest tests/ --doctest-modules -v --cov moviepy --cov-report term-missing
|
||||
python -m pytest --doctest-glob "moviepy/**/**.py" --cov moviepy --cov-report term-missing
|
||||
|
||||
- name: Test pip installation
|
||||
run: |
|
||||
|
||||
13
docs/conf.py
13
docs/conf.py
@@ -1,15 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# MoviePy documentation build configuration file, created by
|
||||
# sphinx-quickstart on Sat Jul 13 14:47:48 2013.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its containing dir.
|
||||
#
|
||||
# Note that not all possible configuration values are present in this
|
||||
# autogenerated file.
|
||||
#
|
||||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
"""MoviePy documentation build configuration file."""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
"""Parses url below to extract latest image magick version (major version 6.9),
|
||||
to feed it into CI system. Not the best way for reproducible builds, but it's
|
||||
preferred for now over storing imagemagick installer into the GIT repository.
|
||||
"""
|
||||
|
||||
import re
|
||||
from urllib import request
|
||||
|
||||
|
||||
url = "https://legacy.imagemagick.org/script/index.php"
|
||||
|
||||
response = request.urlopen(url)
|
||||
html = response.read().decode(r"utf-8")
|
||||
r = re.compile(r"6\.9\.[0-9]+-[0-9]+")
|
||||
version = r.findall(html)
|
||||
if len(version) == 0:
|
||||
raise ValueError(
|
||||
"Could not find latest legacy 6.9.X-Y ImageMagick version from {}".format(url)
|
||||
)
|
||||
version = version[0]
|
||||
# Append Q16 build
|
||||
version += "-Q16"
|
||||
print(version)
|
||||
@@ -1,3 +1,9 @@
|
||||
"""Implements AudioClip (base class for audio clips) and its main subclasses:
|
||||
|
||||
- Audio clips: AudioClip, AudioFileClip, AudioArrayClip
|
||||
- Composition: CompositeAudioClip
|
||||
"""
|
||||
|
||||
import numbers
|
||||
import os
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"""Implements AudioFileClip, a class for audio clips creation using audio files."""
|
||||
|
||||
from moviepy.audio.AudioClip import AudioClip
|
||||
from moviepy.audio.io.readers import FFMPEG_AudioReader
|
||||
from moviepy.decorators import convert_path_to_string
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"""MoviePy audio writing with ffmpeg."""
|
||||
|
||||
import subprocess as sp
|
||||
|
||||
import proglog
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"""Audio preview functions for MoviePy editor."""
|
||||
|
||||
import time
|
||||
|
||||
import numpy as np
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"""MoviePy audio reading with ffmpeg."""
|
||||
|
||||
import subprocess as sp
|
||||
import warnings
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"""Cutting utilities working with audio."""
|
||||
|
||||
import numpy as np
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"""Third party programs configuration for MoviePy."""
|
||||
|
||||
import os
|
||||
import subprocess as sp
|
||||
from pathlib import Path
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"""Useful utilities working with MoviePy."""
|
||||
|
||||
from moviepy.audio.io.AudioFileClip import AudioFileClip
|
||||
from moviepy.video.io.VideoFileClip import VideoFileClip
|
||||
from moviepy.video.VideoClip import ImageClip
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
"""Implements VideoClip (base class for video clips) and its main subclasses:
|
||||
|
||||
- Animated clips: VideofileClip, ImageSequenceClip
|
||||
- Animated clips: VideoFileClip, ImageSequenceClip, BitmapClip
|
||||
- Static image clips: ImageClip, ColorClip, TextClip,
|
||||
"""
|
||||
|
||||
import copy as _copy
|
||||
import os
|
||||
import subprocess as sp
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"""Main video composition interface of MoviePy."""
|
||||
|
||||
import numpy as np
|
||||
from PIL import Image
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"""Video clips concatenation."""
|
||||
|
||||
from functools import reduce
|
||||
|
||||
import numpy as np
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
"""Implements ImageSequenceClip, a class to create a video clip from a set
|
||||
of image files.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
import numpy as np
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"""Implements VideoFileClip, a class for video clips creation using video files."""
|
||||
|
||||
from moviepy.audio.io.AudioFileClip import AudioFileClip
|
||||
from moviepy.decorators import convert_path_to_string
|
||||
from moviepy.video.io.ffmpeg_reader import FFMPEG_VideoReader
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"""MoviePy video GIFs writing."""
|
||||
|
||||
import os
|
||||
import subprocess as sp
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"""Video preview functions for MoviePy editor."""
|
||||
|
||||
import threading
|
||||
import time
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"""GUI matplotlib utility to tune the outputs of a function."""
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
from matplotlib.widgets import Slider
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"""Utilities related with segmenting useful working with video clips."""
|
||||
|
||||
import numpy as np
|
||||
import scipy.ndimage as ndi
|
||||
|
||||
|
||||
10
setup.cfg
10
setup.cfg
@@ -6,8 +6,6 @@ extend-ignore =
|
||||
W503,
|
||||
# allow lambda expressions
|
||||
E731,
|
||||
# don't require docstrings for public modules
|
||||
D100,
|
||||
# don't require docstrings for public packages
|
||||
D104,
|
||||
# don't require docstrings for magic methods
|
||||
@@ -26,12 +24,16 @@ per-file-ignores =
|
||||
# allow imports not placed at the top of the file
|
||||
# allow 'from moviepy import *' in editor.py
|
||||
moviepy/editor.py: E402, F403, F405
|
||||
# the version file doesn't need module level docstring
|
||||
# the version file doesn't require module docstring
|
||||
moviepy/version.py: D100
|
||||
# FX modules don't require module docstring
|
||||
moviepy/audio/fx/*.py: D100
|
||||
moviepy/video/fx/*.py: D100
|
||||
# tests doesn't require docstring (although is recommended)
|
||||
tests/*.py: D101,D102,D103
|
||||
# examples don't require module docstring
|
||||
# allow 'from moviepy import *' in examples
|
||||
examples/*.py: F403, F405
|
||||
examples/*.py: D100, F403, F405
|
||||
docstring-convention = numpy
|
||||
|
||||
# Complexity should be decreased before uncomment:
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"""BitmapClip tests."""
|
||||
|
||||
import numpy as np
|
||||
import pytest
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"""Clip tests."""
|
||||
|
||||
import copy
|
||||
|
||||
import numpy as np
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"""TextClip tests."""
|
||||
|
||||
import pytest
|
||||
|
||||
from moviepy.utils import close_all_clips
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"""VideoClip tests."""
|
||||
|
||||
import copy
|
||||
import os
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"""MoviePy examples tests."""
|
||||
|
||||
import os
|
||||
|
||||
import numpy as np
|
||||
|
||||
@@ -57,7 +57,10 @@ def test_ffmpeg_write_video(
|
||||
):
|
||||
filename = os.path.join(TMP_DIR, f"moviepy_ffmpeg_write_video{ext}")
|
||||
if os.path.isfile(filename):
|
||||
os.remove(filename)
|
||||
try:
|
||||
os.remove(filename)
|
||||
except PermissionError:
|
||||
pass
|
||||
|
||||
logfile_name = filename + ".log"
|
||||
if os.path.isfile(logfile_name):
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"""MoviePy video and audio effects tests."""
|
||||
|
||||
import decimal
|
||||
import importlib
|
||||
import math
|
||||
|
||||
@@ -292,7 +292,7 @@ def test_decorators_argument_converters_consistency(decorator_name):
|
||||
This test is util to prevent next case in which the parameter names doesn't
|
||||
match between the decorator and the function definition:
|
||||
|
||||
>>> @convert_parameter_to_seconds(['foo']) # doctest: +SKIP
|
||||
>>> @convert_parameter_to_seconds(['foo'])
|
||||
>>> def whatever_function(bar): # bar not converted to seconds
|
||||
... pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user