Skip to content

Commit

Permalink
fixed minor flake8 formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
k4yt3x committed Mar 18, 2022
1 parent 0fca5c8 commit fa3bd38
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 31 deletions.
2 changes: 1 addition & 1 deletion video2x/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def run(self) -> None:
self.exception = e

# ignore queue closed
if not "is closed" in str(e):
if "is closed" not in str(e):
logger.exception(e)
break

Expand Down
9 changes: 2 additions & 7 deletions video2x/interpolator.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,16 @@
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
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}

Expand Down
15 changes: 6 additions & 9 deletions video2x/upscaler.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@
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
Expand All @@ -36,9 +30,11 @@
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
Expand Down Expand Up @@ -175,7 +171,8 @@ def run(self) -> None:
# 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

Expand Down
24 changes: 10 additions & 14 deletions video2x/video2x.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -39,14 +39,6 @@
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
Expand All @@ -55,7 +47,8 @@
import sys
import time

# third-party imports
import cv2
import ffmpeg
from loguru import logger
from rich import print
from rich.console import Console
Expand All @@ -69,9 +62,12 @@
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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit fa3bd38

Please sign in to comment.