From fa3bd38217af48c75b0281fde78701f709ac23af Mon Sep 17 00:00:00 2001 From: k4yt3x Date: Fri, 18 Mar 2022 23:14:20 +0000 Subject: [PATCH] fixed minor flake8 formatting issues --- video2x/decoder.py | 2 +- video2x/interpolator.py | 9 ++------- video2x/upscaler.py | 15 ++++++--------- video2x/video2x.py | 24 ++++++++++-------------- 4 files changed, 19 insertions(+), 31 deletions(-) diff --git a/video2x/decoder.py b/video2x/decoder.py index 82b4808..2b129b8 100755 --- a/video2x/decoder.py +++ b/video2x/decoder.py @@ -148,7 +148,7 @@ class VideoDecoder(threading.Thread): self.exception = e # ignore queue closed - if not "is closed" in str(e): + if "is closed" not in str(e): logger.exception(e) break diff --git a/video2x/interpolator.py b/video2x/interpolator.py index 2ad5185..3aeb153 100755 --- a/video2x/interpolator.py +++ b/video2x/interpolator.py @@ -22,10 +22,6 @@ Date Created: May 27, 2021 Last Modified: February 28, 2022 """ -# local imports -from rife_ncnn_vulkan_python.rife_ncnn_vulkan import Rife - -# built-in imports import multiprocessing import multiprocessing.managers import multiprocessing.sharedctypes @@ -33,10 +29,9 @@ import queue import signal import time -# third-party imports -from PIL import ImageChops, ImageStat from loguru import logger - +from PIL import ImageChops, ImageStat +from rife_ncnn_vulkan_python.rife_ncnn_vulkan import Rife ALGORITHM_CLASSES = {"rife": Rife} diff --git a/video2x/upscaler.py b/video2x/upscaler.py index 1581dff..a41f290 100755 --- a/video2x/upscaler.py +++ b/video2x/upscaler.py @@ -22,12 +22,6 @@ Date Created: May 27, 2021 Last Modified: February 16, 2022 """ -# local imports -from realsr_ncnn_vulkan_python.realsr_ncnn_vulkan import Realsr -from srmd_ncnn_vulkan_python.srmd_ncnn_vulkan import Srmd -from waifu2x_ncnn_vulkan_python.waifu2x_ncnn_vulkan import Waifu2x - -# built-in imports import math import multiprocessing import multiprocessing.managers @@ -36,9 +30,11 @@ import queue import signal import time -# third-party imports -from PIL import Image, ImageChops, ImageStat from loguru import logger +from PIL import Image, ImageChops, ImageStat +from realsr_ncnn_vulkan_python.realsr_ncnn_vulkan import Realsr +from srmd_ncnn_vulkan_python.srmd_ncnn_vulkan import Srmd +from waifu2x_ncnn_vulkan_python.waifu2x_ncnn_vulkan import Waifu2x # fixed scaling ratios supported by the algorithms # that only support certain fixed scale ratios @@ -175,7 +171,8 @@ class Upscaler(multiprocessing.Process): # process the image with the selected algorithm image1 = processor_object.process(image1) - # downscale the image to the desired output size and save the image to disk + # downscale the image to the desired output size and + # save the image to disk image1 = image1.resize((output_width, output_height), Image.LANCZOS) self.processed_frames[frame_index] = image1 diff --git a/video2x/video2x.py b/video2x/video2x.py index f2e6e97..a6c43ce 100755 --- a/video2x/video2x.py +++ b/video2x/video2x.py @@ -27,7 +27,7 @@ __ __ _ _ ___ __ __ Name: Video2X Creator: K4YT3X Date Created: February 24, 2018 -Last Modified: February 28, 2022 +Last Modified: March 18, 2022 Editor: BrianPetkovsek Last Modified: June 17, 2019 @@ -39,14 +39,6 @@ Editor: 28598519a Last Modified: March 23, 2020 """ -# local imports -from . import __version__ -from .decoder import VideoDecoder -from .encoder import VideoEncoder -from .interpolator import Interpolator -from .upscaler import Upscaler - -# built-in imports import argparse import math import multiprocessing @@ -55,7 +47,8 @@ import pathlib import sys import time -# third-party imports +import cv2 +import ffmpeg from loguru import logger from rich import print from rich.console import Console @@ -69,9 +62,12 @@ from rich.progress import ( TimeRemainingColumn, ) from rich.text import Text -import cv2 -import ffmpeg +from . import __version__ +from .decoder import VideoDecoder +from .encoder import VideoEncoder +from .interpolator import Interpolator +from .upscaler import Upscaler LEGAL_INFO = """Video2X\t\t{} Author:\t\tK4YT3X @@ -526,7 +522,7 @@ def main() -> int: logger.critical(f"Cannot find input file: {args.input}") return 1 elif not args.input.is_file(): - logger.critical(f"Input path is not a file") + logger.critical("Input path is not a file") return 1 # set logger level @@ -570,7 +566,7 @@ def main() -> int: ) # don't print the traceback for manual terminations - except KeyboardInterrupt as e: + except KeyboardInterrupt: return 2 except Exception as e: