File VidStab.py
has 484 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""VidStab: a class for stabilizing video files"""
from .cv2_utils import safe_import_cv2
safe_import_cv2() # inform user of pip install vidstab[cv2] if ModuleNotFoundError
Function _apply_transforms
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def _apply_transforms(self, output_path, max_frames, use_stored_transforms,
output_fourcc='MJPG', border_type='black', border_size=0,
layer_func=None, playback=False, progress_bar=None, output_fps=None):
self._set_border_options(border_size, border_type)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function stabilize
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
def stabilize(self, input_path, output_path, smoothing_window=30, max_frames=float('inf'),
Function _apply_transforms
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def _apply_transforms(self, output_path, max_frames, use_stored_transforms,
Function apply_transforms
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def apply_transforms(self, input_path, output_path, output_fourcc='MJPG',
Function stabilize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def stabilize(self, input_path, output_path, smoothing_window=30, max_frames=float('inf'),
border_type='black', border_size=0, layer_func=None, playback=False,
use_stored_transforms=False, show_progress=True, output_fourcc='MJPG',
output_fps=None):
"""Read video, perform stabilization, & write stabilized video to file
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _resize_frame
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _resize_frame(self, frame):
if self._processing_resize_kwargs == {}:
if self.processing_max_dim:
shape = frame.shape
max_dim_size = max(shape)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function stabilize_frame
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def stabilize_frame(self, input_frame, smoothing_window=30,
Function stabilize_frame
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def stabilize_frame(self, input_frame, smoothing_window=30,
border_type='black', border_size=0, layer_func=None,
use_stored_transforms=False):
"""Stabilize single frame of video being iterated
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _init_trajectory
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _init_trajectory(self, smoothing_window, max_frames, gen_all=False, show_progress=False):
self._smoothing_window = smoothing_window
if max_frames is None:
max_frames = float('inf')
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"