From d982e37ee5282452bfc51ef5469c741686fc83a8 Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Fri, 10 Feb 2023 19:24:47 +0000 Subject: [PATCH] Re-order all imports across project with isort --- devine/commands/dl.py | 14 +++++++------- devine/commands/kv.py | 2 +- devine/core/__main__.py | 2 +- devine/core/cacher.py | 3 +-- devine/core/constants.py | 1 - devine/core/downloaders/aria2c.py | 2 +- devine/core/downloaders/saldl.py | 2 +- devine/core/manifests/hls.py | 6 +++--- devine/core/service.py | 10 +++++----- devine/core/titles/__init__.py | 3 +-- devine/core/titles/episode.py | 2 +- devine/core/titles/movie.py | 2 +- devine/core/titles/song.py | 2 +- devine/core/titles/title.py | 2 +- devine/core/tracks/__init__.py | 2 +- devine/core/tracks/tracks.py | 4 ++-- devine/core/tracks/video.py | 4 ++-- devine/core/utilities.py | 9 ++++----- devine/core/vaults.py | 4 ++-- 19 files changed, 36 insertions(+), 40 deletions(-) diff --git a/devine/commands/dl.py b/devine/commands/dl.py index bc5daaa..9bc53da 100644 --- a/devine/commands/dl.py +++ b/devine/commands/dl.py @@ -15,7 +15,7 @@ from functools import partial from http.cookiejar import MozillaCookieJar from pathlib import Path from threading import Event -from typing import Any, Optional, Callable +from typing import Any, Callable, Optional import click import jsonpickle @@ -27,18 +27,18 @@ from pywidevine.remotecdm import RemoteCdm from tqdm import tqdm from devine.core.config import config -from devine.core.constants import AnyTrack, context_settings, LOG_FORMATTER, DRM_SORT_MAP -from devine.core.drm import Widevine, DRM_T -from devine.core.proxies import Basic, NordVPN, Hola +from devine.core.constants import DRM_SORT_MAP, LOG_FORMATTER, AnyTrack, context_settings +from devine.core.credential import Credential +from devine.core.drm import DRM_T, Widevine +from devine.core.proxies import Basic, Hola, NordVPN from devine.core.service import Service from devine.core.services import Services -from devine.core.titles import Title_T, Movie, Song +from devine.core.titles import Movie, Song, Title_T from devine.core.titles.episode import Episode from devine.core.tracks import Audio, Video -from devine.core.utilities import is_close_match, get_binary_path +from devine.core.utilities import get_binary_path, is_close_match from devine.core.utils.click_types import LANGUAGE_RANGE, QUALITY, SEASON_RANGE, ContextData from devine.core.utils.collections import merge_dict -from devine.core.credential import Credential from devine.core.utils.subprocess import ffprobe from devine.core.vaults import Vaults diff --git a/devine/commands/kv.py b/devine/commands/kv.py index fc16779..61e3f34 100644 --- a/devine/commands/kv.py +++ b/devine/commands/kv.py @@ -7,10 +7,10 @@ from typing import Optional import click -from devine.core.vault import Vault from devine.core.config import config from devine.core.constants import context_settings from devine.core.services import Services +from devine.core.vault import Vault from devine.core.vaults import Vaults diff --git a/devine/core/__main__.py b/devine/core/__main__.py index 87c2265..3721ef4 100644 --- a/devine/core/__main__.py +++ b/devine/core/__main__.py @@ -6,7 +6,7 @@ import coloredlogs from devine.core import __version__ from devine.core.commands import Commands -from devine.core.constants import context_settings, LOG_FORMAT +from devine.core.constants import LOG_FORMAT, context_settings @click.command(cls=Commands, invoke_without_command=True, context_settings=context_settings) diff --git a/devine/core/cacher.py b/devine/core/cacher.py index a46455c..724d542 100644 --- a/devine/core/cacher.py +++ b/devine/core/cacher.py @@ -4,14 +4,13 @@ import zlib from datetime import datetime, timedelta from os import stat_result from pathlib import Path -from typing import Optional, Any, Union +from typing import Any, Optional, Union import jsonpickle import jwt from devine.core.config import config - EXP_T = Union[datetime, str, int, float] diff --git a/devine/core/constants.py b/devine/core/constants.py index 374722c..48fbc6b 100644 --- a/devine/core/constants.py +++ b/devine/core/constants.py @@ -1,7 +1,6 @@ import logging from typing import TypeVar, Union - LOG_FORMAT = "{asctime} [{levelname[0]}] {name} : {message}" # must be '{}' style LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S" LOG_FORMATTER = logging.Formatter(LOG_FORMAT, LOG_DATE_FORMAT, "{") diff --git a/devine/core/downloaders/aria2c.py b/devine/core/downloaders/aria2c.py index f8adf7e..591175b 100644 --- a/devine/core/downloaders/aria2c.py +++ b/devine/core/downloaders/aria2c.py @@ -1,7 +1,7 @@ import asyncio import subprocess from pathlib import Path -from typing import Union, Optional +from typing import Optional, Union from devine.core.config import config from devine.core.utilities import get_binary_path, start_pproxy diff --git a/devine/core/downloaders/saldl.py b/devine/core/downloaders/saldl.py index 5e38d4f..34166d1 100644 --- a/devine/core/downloaders/saldl.py +++ b/devine/core/downloaders/saldl.py @@ -1,6 +1,6 @@ import subprocess from pathlib import Path -from typing import Union, Optional +from typing import Optional, Union from devine.core.utilities import get_binary_path diff --git a/devine/core/manifests/hls.py b/devine/core/manifests/hls.py index 1787102..c755fde 100644 --- a/devine/core/manifests/hls.py +++ b/devine/core/manifests/hls.py @@ -2,7 +2,7 @@ from __future__ import annotations import re from hashlib import md5 -from typing import Union, Any, Optional +from typing import Any, Optional, Union import m3u8 import requests @@ -12,8 +12,8 @@ from pywidevine.cdm import Cdm as WidevineCdm from pywidevine.pssh import PSSH from requests import Session -from devine.core.drm import ClearKey, Widevine, DRM_T -from devine.core.tracks import Tracks, Video, Audio, Subtitle +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 diff --git a/devine/core/service.py b/devine/core/service.py index 71861e1..198d502 100644 --- a/devine/core/service.py +++ b/devine/core/service.py @@ -3,21 +3,21 @@ from __future__ import annotations import base64 import logging from abc import ABCMeta, abstractmethod -from http.cookiejar import MozillaCookieJar, CookieJar +from http.cookiejar import CookieJar, MozillaCookieJar from typing import Optional, Union from urllib.parse import urlparse import click import requests -from requests.adapters import Retry, HTTPAdapter +from requests.adapters import HTTPAdapter, Retry +from devine.core.cacher import Cacher from devine.core.config import config from devine.core.constants import AnyTrack -from devine.core.titles import Titles_T, Title_T +from devine.core.credential import Credential +from devine.core.titles import Title_T, Titles_T from devine.core.tracks import Chapter, Tracks from devine.core.utilities import get_ip_info -from devine.core.cacher import Cacher -from devine.core.credential import Credential class Service(metaclass=ABCMeta): diff --git a/devine/core/titles/__init__.py b/devine/core/titles/__init__.py index 3b0e89e..a406191 100644 --- a/devine/core/titles/__init__.py +++ b/devine/core/titles/__init__.py @@ -2,8 +2,7 @@ from typing import Union from .episode import Episode, Series from .movie import Movie, Movies -from .song import Song, Album - +from .song import Album, Song Title_T = Union[Movie, Episode, Song] Titles_T = Union[Movies, Series, Album] diff --git a/devine/core/titles/episode.py b/devine/core/titles/episode.py index 6e39b58..62cd6a8 100644 --- a/devine/core/titles/episode.py +++ b/devine/core/titles/episode.py @@ -1,7 +1,7 @@ import re from abc import ABC from collections import Counter -from typing import Any, Optional, Union, Iterable +from typing import Any, Iterable, Optional, Union from langcodes import Language from pymediainfo import MediaInfo diff --git a/devine/core/titles/movie.py b/devine/core/titles/movie.py index e744b38..99f1639 100644 --- a/devine/core/titles/movie.py +++ b/devine/core/titles/movie.py @@ -1,5 +1,5 @@ from abc import ABC -from typing import Any, Optional, Union, Iterable +from typing import Any, Iterable, Optional, Union from langcodes import Language from pymediainfo import MediaInfo diff --git a/devine/core/titles/song.py b/devine/core/titles/song.py index b881eb2..4cb0b85 100644 --- a/devine/core/titles/song.py +++ b/devine/core/titles/song.py @@ -1,5 +1,5 @@ from abc import ABC -from typing import Any, Optional, Union, Iterable +from typing import Any, Iterable, Optional, Union from langcodes import Language from pymediainfo import MediaInfo diff --git a/devine/core/titles/title.py b/devine/core/titles/title.py index 998af7e..f9b4bc2 100644 --- a/devine/core/titles/title.py +++ b/devine/core/titles/title.py @@ -1,7 +1,7 @@ from __future__ import annotations from abc import abstractmethod -from typing import Optional, Union, Any +from typing import Any, Optional, Union from langcodes import Language from pymediainfo import MediaInfo diff --git a/devine/core/tracks/__init__.py b/devine/core/tracks/__init__.py index 82e61bd..7bfd4b0 100644 --- a/devine/core/tracks/__init__.py +++ b/devine/core/tracks/__init__.py @@ -1,6 +1,6 @@ from .audio import Audio -from .track import Track from .chapter import Chapter from .subtitle import Subtitle +from .track import Track from .tracks import Tracks from .video import Video diff --git a/devine/core/tracks/tracks.py b/devine/core/tracks/tracks.py index e358c54..cda5009 100644 --- a/devine/core/tracks/tracks.py +++ b/devine/core/tracks/tracks.py @@ -11,11 +11,11 @@ from langcodes import Language, closest_supported_match from devine.core.config import config from devine.core.constants import LANGUAGE_MAX_DISTANCE, LANGUAGE_MUX_MAP, AnyTrack, TrackT from devine.core.tracks.audio import Audio -from devine.core.tracks.track import Track from devine.core.tracks.chapter import Chapter from devine.core.tracks.subtitle import Subtitle +from devine.core.tracks.track import Track from devine.core.tracks.video import Video -from devine.core.utilities import sanitize_filename, is_close_match +from devine.core.utilities import is_close_match, sanitize_filename from devine.core.utils.collections import as_list, flatten diff --git a/devine/core/tracks/video.py b/devine/core/tracks/video.py index 0400fe9..47b5e72 100644 --- a/devine/core/tracks/video.py +++ b/devine/core/tracks/video.py @@ -11,9 +11,9 @@ from typing import Any, Optional, Union from langcodes import Language from devine.core.config import config -from devine.core.tracks.track import Track from devine.core.tracks.subtitle import Subtitle -from devine.core.utilities import get_binary_path, get_boxes, FPS +from devine.core.tracks.track import Track +from devine.core.utilities import FPS, get_binary_path, get_boxes class Video(Track): diff --git a/devine/core/utilities.py b/devine/core/utilities.py index c04131b..b17a52f 100644 --- a/devine/core/utilities.py +++ b/devine/core/utilities.py @@ -4,15 +4,14 @@ import importlib.util import re import shutil import sys +import unicodedata +from pathlib import Path +from types import ModuleType +from typing import AsyncIterator, Optional, Sequence, Union from urllib.parse import urlparse import pproxy import requests -import unicodedata -from pathlib import Path -from types import ModuleType -from typing import Optional, Union, Sequence, AsyncIterator - from langcodes import Language, closest_match from pymp4.parser import Box from unidecode import unidecode diff --git a/devine/core/vaults.py b/devine/core/vaults.py index e210e10..49ea542 100644 --- a/devine/core/vaults.py +++ b/devine/core/vaults.py @@ -1,11 +1,11 @@ from __future__ import annotations -from typing import Iterator, Optional, Union, Any +from typing import Any, Iterator, Optional, Union from uuid import UUID -from devine.core.vault import Vault from devine.core.config import config from devine.core.utilities import import_module_by_path +from devine.core.vault import Vault _VAULTS = sorted( (