Skip to content

Commit

Permalink
Fix all Ruff and isort linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rlaphoenix committed Dec 2, 2023
1 parent e4500a5 commit ab307a2
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 27 deletions.
6 changes: 3 additions & 3 deletions devine/commands/dl.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from pywidevine.cdm import Cdm as WidevineCdm
from pywidevine.device import Device
from pywidevine.remotecdm import RemoteCdm
from rich.console import Group
from rich.live import Live
from rich.padding import Padding
from rich.panel import Panel
Expand All @@ -37,7 +38,6 @@
from rich.table import Table
from rich.text import Text
from rich.tree import Tree
from rich.console import Group

from devine.core.config import config
from devine.core.console import console
Expand All @@ -51,9 +51,9 @@
from devine.core.services import Services
from devine.core.titles import Movie, Song, Title_T
from devine.core.titles.episode import Episode
from devine.core.tracks import Audio, Subtitle, Video, Tracks
from devine.core.tracks import Audio, Subtitle, Tracks, Video
from devine.core.utilities import get_binary_path, is_close_match, time_elapsed_since
from devine.core.utils.click_types import LANGUAGE_RANGE, SEASON_RANGE, ContextData, QUALITY_LIST
from devine.core.utils.click_types import LANGUAGE_RANGE, QUALITY_LIST, SEASON_RANGE, ContextData
from devine.core.utils.collections import merge_dict
from devine.core.utils.subprocess import ffprobe
from devine.core.vaults import Vaults
Expand Down
3 changes: 1 addition & 2 deletions devine/commands/wvd.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import logging
import shutil
from pathlib import Path
from typing import Optional

import click
import yaml
import shutil

from google.protobuf.json_format import MessageToDict
from pywidevine.device import Device
from pywidevine.license_protocol_pb2 import FileHashes
Expand Down
6 changes: 3 additions & 3 deletions devine/core/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

import click
import urllib3
from rich import traceback
from rich.console import Group
from rich.padding import Padding
from rich.text import Text
from urllib3.exceptions import InsecureRequestWarning
from rich import traceback
from rich.padding import Padding

from devine.core import __version__
from devine.core.commands import Commands
Expand Down Expand Up @@ -66,7 +66,7 @@ def main(version: bool, debug: bool, log_path: Path) -> None:
style="ascii.art"
),
f"v[repr.number]{__version__}[/] Copyright © 2019-{datetime.now().year} rlaphoenix",
f" [bright_blue]https://github.com/devine-dl/devine[/]"
" [bright_blue]https://github.com/devine-dl/devine[/]"
),
(1, 21, 1, 20),
expand=True
Expand Down
23 changes: 14 additions & 9 deletions devine/core/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,12 @@ class ComfyConsole(Console):
Args:
color_system (str, optional): The color system supported by your terminal,
either ``"standard"``, ``"256"`` or ``"truecolor"``. Leave as ``"auto"`` to autodetect.
force_terminal (Optional[bool], optional): Enable/disable terminal control codes, or None to auto-detect terminal. Defaults to None.
force_jupyter (Optional[bool], optional): Enable/disable Jupyter rendering, or None to auto-detect Jupyter. Defaults to None.
force_interactive (Optional[bool], optional): Enable/disable interactive mode, or None to auto detect. Defaults to None.
force_terminal (Optional[bool], optional): Enable/disable terminal control codes, or None to auto-detect
terminal. Defaults to None.
force_jupyter (Optional[bool], optional): Enable/disable Jupyter rendering, or None to auto-detect Jupyter.
Defaults to None.
force_interactive (Optional[bool], optional): Enable/disable interactive mode, or None to auto-detect.
Defaults to None.
soft_wrap (Optional[bool], optional): Set soft wrap default on print method. Defaults to False.
theme (Theme, optional): An optional style theme object, or ``None`` for default theme.
stderr (bool, optional): Use stderr rather than stdout if ``file`` is not specified. Defaults to False.
Expand All @@ -145,7 +148,7 @@ class ComfyConsole(Console):
width (int, optional): The width of the terminal. Leave as default to auto-detect width.
height (int, optional): The height of the terminal. Leave as default to auto-detect height.
style (StyleType, optional): Style to apply to all output, or None for no style. Defaults to None.
no_color (Optional[bool], optional): Enabled no color mode, or None to auto detect. Defaults to None.
no_color (Optional[bool], optional): Enabled no color mode, or None to auto-detect. Defaults to None.
tab_size (int, optional): Number of spaces used to replace a tab character. Defaults to 8.
record (bool, optional): Boolean to enable recording of terminal output,
required to call :meth:`export_html`, :meth:`export_svg`, and :meth:`export_text`. Defaults to False.
Expand All @@ -155,13 +158,15 @@ class ComfyConsole(Console):
highlight (bool, optional): Enable automatic highlighting. Defaults to True.
log_time (bool, optional): Boolean to enable logging of time by :meth:`log` methods. Defaults to True.
log_path (bool, optional): Boolean to enable the logging of the caller by :meth:`log`. Defaults to True.
log_time_format (Union[str, TimeFormatterCallable], optional): If ``log_time`` is enabled, either string for strftime or callable that formats the time. Defaults to "[%X] ".
log_time_format (Union[str, TimeFormatterCallable], optional): If ``log_time`` is enabled, either string for
strftime or callable that formats the time. Defaults to "[%X] ".
highlighter (HighlighterType, optional): Default highlighter.
legacy_windows (bool, optional): Enable legacy Windows mode, or ``None`` to auto detect. Defaults to ``None``.
legacy_windows (bool, optional): Enable legacy Windows mode, or ``None`` to auto-detect. Defaults to ``None``.
safe_box (bool, optional): Restrict box options that don't render on legacy Windows.
get_datetime (Callable[[], datetime], optional): Callable that gets the current time as a datetime.datetime object (used by Console.log),
or None for datetime.now.
get_time (Callable[[], time], optional): Callable that gets the current time in seconds, default uses time.monotonic.
get_datetime (Callable[[], datetime], optional): Callable that gets the current time as a datetime.datetime
object (used by Console.log), or None for datetime.now.
get_time (Callable[[], time], optional): Callable that gets the current time in seconds, default uses
time.monotonic.
"""

def __init__(
Expand Down
2 changes: 1 addition & 1 deletion devine/core/downloaders/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio

from ..config import config
from .aria2c import aria2c
from .requests import requests
from ..config import config

downloader = {
"aria2c": lambda *args, **kwargs: asyncio.run(aria2c(*args, **kwargs)),
Expand Down
4 changes: 2 additions & 2 deletions devine/core/downloaders/aria2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from functools import partial
from http.cookiejar import CookieJar
from pathlib import Path
from typing import Optional, Union, MutableMapping
from typing import MutableMapping, Optional, Union

import requests
from requests.cookies import RequestsCookieJar, get_cookie_header, cookiejar_from_dict
from requests.cookies import RequestsCookieJar, cookiejar_from_dict, get_cookie_header
from rich.text import Text

from devine.core.config import config
Expand Down
2 changes: 1 addition & 1 deletion devine/core/downloaders/requests.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import time
from functools import partial
from pathlib import Path
from typing import Optional, Union, Any, MutableMapping
from typing import Any, MutableMapping, Optional, Union

from requests import Session
from requests.cookies import RequestsCookieJar
Expand Down
5 changes: 3 additions & 2 deletions devine/core/manifests/dash.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from hashlib import md5
from pathlib import Path
from threading import Event
from typing import Any, Callable, Optional, Union, MutableMapping
from typing import Any, Callable, MutableMapping, Optional, Union
from urllib.parse import urljoin, urlparse
from uuid import UUID

Expand All @@ -27,7 +27,8 @@
from rich import filesize

from devine.core.constants import AnyTrack
from devine.core.downloaders import downloader, requests as requests_downloader
from devine.core.downloaders import downloader
from devine.core.downloaders import requests as requests_downloader
from devine.core.drm import Widevine
from devine.core.tracks import Audio, Subtitle, Tracks, Video
from devine.core.utilities import is_close_match
Expand Down
3 changes: 2 additions & 1 deletion devine/core/manifests/hls.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
from rich import filesize

from devine.core.constants import AnyTrack
from devine.core.downloaders import downloader, requests as requests_downloader
from devine.core.downloaders import downloader
from devine.core.downloaders import requests as requests_downloader
from devine.core.drm import DRM_T, ClearKey, Widevine
from devine.core.tracks import Audio, Subtitle, Tracks, Video
from devine.core.utilities import is_close_match
Expand Down
3 changes: 2 additions & 1 deletion devine/core/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ def authenticate(self, cookies: Optional[MozillaCookieJar] = None, credential: O
raise TypeError(f"Expected cookies to be a {MozillaCookieJar}, not {cookies!r}.")
self.session.cookies.update(cookies)

def get_widevine_service_certificate(self, *, challenge: bytes, title: Title_T, track: AnyTrack) -> Union[bytes, str]:
def get_widevine_service_certificate(self, *, challenge: bytes, title: Title_T, track: AnyTrack) \
-> Union[bytes, str]:
"""
Get the Widevine Service Certificate used for Privacy Mode.
Expand Down
2 changes: 1 addition & 1 deletion devine/core/tracks/tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from Cryptodome.Random import get_random_bytes
from langcodes import Language, closest_supported_match
from rich.progress import Progress, TextColumn, SpinnerColumn, BarColumn, TimeRemainingColumn
from rich.progress import BarColumn, Progress, SpinnerColumn, TextColumn, TimeRemainingColumn
from rich.table import Table
from rich.tree import Tree

Expand Down
1 change: 0 additions & 1 deletion devine/core/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import shutil
import sys
import time

import unicodedata
from collections import defaultdict
from datetime import datetime
Expand Down

0 comments on commit ab307a2

Please sign in to comment.