Skip to content

Commit

Permalink
remove extra fstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
tomato39 committed Jun 6, 2020
1 parent bd0034c commit a5adeb2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Expand Up @@ -21,7 +21,7 @@ jobs:
python3 -m pip install --upgrade pip
pip install -r requirements-dev.txt
pip install .
pip install -U git+https://github.com/Irrational-Encoding-Wizardry/vsutil.git#egg=vsutil
pip install -U git+https://github.com/Irrational-Encoding-Wizardry/vsutil.git@stux-switch-to-package#egg=vsutil
- name: Running flake8
run: flake8 lvsfunc --count --ignore=E501,W503,E226 --show-source --statistics
- name: Running mypy
Expand Down
18 changes: 9 additions & 9 deletions lvsfunc/comparison.py
Expand Up @@ -48,15 +48,15 @@ def _resample(clip: vs.VideoNode) -> vs.VideoNode:

# Error handling
if frames and len(frames) > clip_a.num_frames:
raise ValueError(f"compare: 'More comparisons requested than frames available'")
raise ValueError("compare: 'More comparisons requested than frames available'")

if force_resample:
clip_a, clip_b = _resample(clip_a), _resample(clip_b)
else:
if clip_a.format is None or clip_b.format is None:
raise ValueError("compare: 'Variable-format clips not supported'")
if clip_a.format.id != clip_b.format.id:
raise ValueError(f"compare: 'The format of both clips must be equal'")
raise ValueError("compare: 'The format of both clips must be equal'")

if print_frame:
clip_a, clip_b = clip_a.text.FrameNum(), clip_b.text.FrameNum()
Expand Down Expand Up @@ -93,18 +93,18 @@ def stack_compare(*clips: vs.VideoNode,
:return: Clip with clips stacked
"""
if len(clips) < 2:
raise ValueError(f"stack_compare: 'Too few clips supplied'")
raise ValueError("stack_compare: 'Too few clips supplied'")

if len(clips) != 2 and make_diff:
raise ValueError(f"stack_compare: 'You can only create a diff for two clips'")
raise ValueError("stack_compare: 'You can only create a diff for two clips'")

formats = set()
for c in clips:
if c.format is None:
raise ValueError("stack_compare: 'Variable-format clips not supported'")
formats.add(c.format.id)
if len(formats) != 1:
raise ValueError(f"stack_compare: 'The format of every clip must be equal'")
raise ValueError("stack_compare: 'The format of every clip must be equal'")

if make_diff:
diff = core.std.MakeDiff(clips[0], clips[1])
Expand All @@ -116,7 +116,7 @@ def stack_compare(*clips: vs.VideoNode,
stack = core.std.StackHorizontal(clips)
if warn:
if len(set([c.num_frames for c in clips])) != 1:
stack = core.text.Text(stack, f"Clip Length Mismatch Detected! \nPlease make sure the lengths of all clips match!\n"+"".join(f"\nClip {i+1}: {c.num_frames} Frames" for i, c in enumerate(clips)), 2)
stack = core.text.Text(stack, "Clip Length Mismatch Detected! \nPlease make sure the lengths of all clips match!\n"+"".join(f"\nClip {i+1}: {c.num_frames} Frames" for i, c in enumerate(clips)), 2)
return stack


Expand Down Expand Up @@ -144,7 +144,7 @@ def stack_planes(clip: vs.VideoNode,
elif subsampling == '444':
return core.std.StackVertical(planes) if stack_vertical else core.std.StackHorizontal(planes)
else:
raise ValueError(f"stack_planes: 'Input clip must be in YUV format with 444 or 420 chroma subsampling'")
raise ValueError("stack_planes: 'Input clip must be in YUV format with 444 or 420 chroma subsampling'")


def tvbd_diff(tv: vs.VideoNode, bd: vs.VideoNode,
Expand Down Expand Up @@ -173,7 +173,7 @@ def tvbd_diff(tv: vs.VideoNode, bd: vs.VideoNode,
:param return_array: Return frames as an interleaved comparison (using py:func:`lvsfunc.comparison.compare`) (Default: False)
"""
if thr > 128:
raise ValueError(f"tvbd_diff: \"thr\" should neither be nor exceed 128!'")
raise ValueError("tvbd_diff: \"thr\" should neither be nor exceed 128!'")

tv, bd = depth(tv, 8), depth(bd, 8)

Expand All @@ -188,7 +188,7 @@ def tvbd_diff(tv: vs.VideoNode, bd: vs.VideoNode,
frames = [i for i, f in enumerate(diff.frames()) if get_prop(f, "PlaneStatsMin", t) <= thr or get_prop(f, "PlaneStatsMax", t) >= 255 - thr]

if not frames:
raise ValueError(f"tvbd_diff: 'No differences found'")
raise ValueError("tvbd_diff: 'No differences found'")

if return_array:
return compare(tv.text.FrameNum().text.Text('Clip A', 9),
Expand Down
2 changes: 1 addition & 1 deletion lvsfunc/deinterlace.py
Expand Up @@ -159,7 +159,7 @@ def dir_unsharp(clip: vs.VideoNode,

dir = dir.lower()
if dir not in ['v', 'h']:
raise ValueError(f"dir_unsharp: '\"dir\" must be either \"v\" or \"h\"'")
raise ValueError("dir_unsharp: '\"dir\" must be either \"v\" or \"h\"'")

den = core.knlm.KNLMeansCL(clip, d=3, a=3, h=h)
diff = core.std.MakeDiff(clip, den)
Expand Down
4 changes: 2 additions & 2 deletions lvsfunc/denoise.py
Expand Up @@ -77,7 +77,7 @@ def quick_denoise(clip: vs.VideoNode,
planes[1] = planes[1].dfttest.DFTTest(sosize=int(sbsize * 0.75), **kwargs)
planes[2] = planes[2].dfttest.DFTTest(sosize=int(sbsize * 0.75), **kwargs)
except KeyError:
raise ValueError(f"quick_denoise: '\"sbsize\" not specified'")
raise ValueError("quick_denoise: '\"sbsize\" not specified'")
elif cmode in [4, 'smd', 'smdegrain']:
try:
import havsfunc as haf
Expand All @@ -87,7 +87,7 @@ def quick_denoise(clip: vs.VideoNode,
planes[1] = haf.SMDegrain(planes[1], prefilter=3, **kwargs)
planes[2] = haf.SMDegrain(planes[2], prefilter=3, **kwargs)
else:
raise ValueError(f"quick_denoise: 'Unknown cmode'")
raise ValueError("quick_denoise: 'Unknown cmode'")

ref = ref or planes[0]
planes[0] = mvf.BM3D(planes[0], sigma=sigma, psample=0, radius1=1, ref=ref)
Expand Down
4 changes: 2 additions & 2 deletions lvsfunc/misc.py
Expand Up @@ -49,9 +49,9 @@ def source(file: str, ref: Optional[vs.VideoNode] = None,

# Error handling for some file types
if file.endswith('.mpls') and mpls is False:
raise ValueError(f"source: 'Please set \"mpls = True\" and give a path to the base Blu-ray directory when trying to load in mpls files'")
raise ValueError("source: 'Please set \"mpls = True\" and give a path to the base Blu-ray directory when trying to load in mpls files'")
if file.endswith('.vob') or file.endswith('.ts'):
raise ValueError(f"source: 'Please index VOB and TS files with d2v before importing them'")
raise ValueError("source: 'Please index VOB and TS files with d2v before importing them'")

if force_lsmas:
return core.lsmas.LWLibavSource(file)
Expand Down

0 comments on commit a5adeb2

Please sign in to comment.