From deaeb9cf57db75a61ec2e28a01e4f06db71c053c Mon Sep 17 00:00:00 2001 From: in03 Date: Thu, 9 Feb 2023 11:22:37 +1000 Subject: [PATCH] style: package wide isort --- src/proxima/__init__.py | 12 +++++------- src/proxima/app/core.py | 2 +- src/proxima/app/link.py | 7 ++++--- src/proxima/app/package.py | 13 ++++++------- src/proxima/app/resolve.py | 15 ++++++++------- src/proxima/celery/celery.py | 1 + src/proxima/celery/ffmpeg/ffmpeg_process.py | 6 +++--- src/proxima/celery/ffmpeg/utils.py | 3 ++- src/proxima/celery/launch_workers.py | 5 ++--- src/proxima/celery/shared.py | 13 ++++--------- src/proxima/celery/tasks.py | 17 +++++++++-------- src/proxima/cli/main.py | 2 +- src/proxima/settings/__init__.py | 3 +-- src/proxima/settings/manager.py | 5 +++-- src/proxima/settings/schema.py | 3 +-- src/proxima/tests/test_checks.py | 3 +-- src/proxima/types/batch.py | 14 +++++++------- src/proxima/types/job.py | 13 ++++--------- src/proxima/types/media_pool_index.py | 1 + 19 files changed, 64 insertions(+), 74 deletions(-) diff --git a/src/proxima/__init__.py b/src/proxima/__init__.py index bc8b2b7..aa2fc97 100644 --- a/src/proxima/__init__.py +++ b/src/proxima/__init__.py @@ -1,6 +1,7 @@ __version__ = "1.0.2" import os + import semver _semver = semver.VersionInfo.parse(__version__) @@ -8,11 +9,8 @@ os.environ["PROXIMA_VERSION"] = __version__ os.environ["PROXIMA_VC_KEY"] = f"{_semver.major}.{_semver.minor}" -from .app import core -from .celery import shared -from .app import checks -from .app import exceptions -from .app import resolve -from .app.link import ProxyLinker - from proxima.cli import main as cli + +from .app import checks, core, exceptions, resolve +from .app.link import ProxyLinker +from .celery import shared diff --git a/src/proxima/app/core.py b/src/proxima/app/core.py index 1dd8cc7..a33268b 100644 --- a/src/proxima/app/core.py +++ b/src/proxima/app/core.py @@ -4,9 +4,9 @@ import time from notifypy import Notify +from rich.console import Console from rich.logging import RichHandler from rich.prompt import Prompt -from rich.console import Console console = Console() diff --git a/src/proxima/app/link.py b/src/proxima/app/link.py index 49a3082..c82becd 100644 --- a/src/proxima/app/link.py +++ b/src/proxima/app/link.py @@ -3,14 +3,15 @@ import logging import os +from pydavinci import davinci +from pydavinci.wrappers.mediapoolitem import MediaPoolItem from rich.console import Console -from proxima.app import core + from proxima import exceptions +from proxima.app import core from proxima.settings import settings -from pydavinci import davinci from proxima.types.job import Job from proxima.types.media_pool_index import media_pool_index -from pydavinci.wrappers.mediapoolitem import MediaPoolItem resolve = davinci.Resolve() console = Console() diff --git a/src/proxima/app/package.py b/src/proxima/app/package.py index 080475e..2720d4c 100644 --- a/src/proxima/app/package.py +++ b/src/proxima/app/package.py @@ -1,18 +1,17 @@ +import importlib import logging import os +import subprocess +import sys from distutils.sysconfig import get_python_lib -from pathlib import Path from functools import cached_property +from pathlib import Path -import importlib -import subprocess -import sys +from git.exc import InvalidGitRepositoryError +from git.repo import Repo from proxima.settings import settings -from git.repo import Repo -from git.exc import InvalidGitRepositoryError - logger = logging.getLogger("proxima") logger.setLevel(settings["app"]["loglevel"]) diff --git a/src/proxima/app/resolve.py b/src/proxima/app/resolve.py index 7cd2f5f..8a74a59 100644 --- a/src/proxima/app/resolve.py +++ b/src/proxima/app/resolve.py @@ -1,17 +1,18 @@ import logging import os -from proxima.app import core -from proxima.settings import settings, SettingsManager from pydavinci import davinci -from pydavinci.wrappers.timeline import Timeline -from pydavinci.wrappers.project import Project -from pydavinci.wrappers.timelineitem import TimelineItem from pydavinci.wrappers.mediapool import MediaPool from pydavinci.wrappers.mediapoolitem import MediaPoolItem -from proxima.types.media_pool_index import media_pool_index -from proxima.types.job import Job, ProjectMetadata, SourceMetadata +from pydavinci.wrappers.project import Project +from pydavinci.wrappers.timeline import Timeline +from pydavinci.wrappers.timelineitem import TimelineItem + +from proxima.app import core +from proxima.settings import SettingsManager, settings from proxima.types.batch import Batch +from proxima.types.job import Job, ProjectMetadata, SourceMetadata +from proxima.types.media_pool_index import media_pool_index resolve = davinci.Resolve() diff --git a/src/proxima/celery/celery.py b/src/proxima/celery/celery.py index 6d8da28..b47da1d 100644 --- a/src/proxima/celery/celery.py +++ b/src/proxima/celery/celery.py @@ -5,6 +5,7 @@ import sys from celery import Celery + from proxima.settings import settings # QUEUE - Celery routing queue using version constraint key diff --git a/src/proxima/celery/ffmpeg/ffmpeg_process.py b/src/proxima/celery/ffmpeg/ffmpeg_process.py index 7c7e463..09f5be4 100644 --- a/src/proxima/celery/ffmpeg/ffmpeg_process.py +++ b/src/proxima/celery/ffmpeg/ffmpeg_process.py @@ -1,7 +1,7 @@ +import json import logging import os import subprocess -import json from rich.console import Console from rich.progress import ( @@ -13,11 +13,11 @@ ) from rich.prompt import Confirm -from .utils import ffprobe - from proxima.app import core from proxima.settings import settings +from .utils import ffprobe + core.install_rich_tracebacks() logger = logging.getLogger("proxima") logger.setLevel(settings["worker"]["loglevel"]) diff --git a/src/proxima/celery/ffmpeg/utils.py b/src/proxima/celery/ffmpeg/utils.py index cda2c40..f061adb 100644 --- a/src/proxima/celery/ffmpeg/utils.py +++ b/src/proxima/celery/ffmpeg/utils.py @@ -1,10 +1,11 @@ -import logging import json +import logging import os import shlex import subprocess import sys from fractions import Fraction + from proxima.app import core from proxima.settings import settings diff --git a/src/proxima/celery/launch_workers.py b/src/proxima/celery/launch_workers.py index b940eb9..0238cc5 100644 --- a/src/proxima/celery/launch_workers.py +++ b/src/proxima/celery/launch_workers.py @@ -5,14 +5,13 @@ import os import platform import subprocess -import shortuuid import time from shutil import which +import shortuuid from rich import print -from proxima.app import core -from proxima.app import package +from proxima.app import core, package from proxima.settings import settings core.install_rich_tracebacks() diff --git a/src/proxima/celery/shared.py b/src/proxima/celery/shared.py index c224ca2..5b03e83 100644 --- a/src/proxima/celery/shared.py +++ b/src/proxima/celery/shared.py @@ -1,16 +1,11 @@ -from typing import List import logging import time +from typing import List + +from celery.result import AsyncResult, GroupResult from rich.console import Group -from rich.progress import ( - BarColumn, - Progress, - SpinnerColumn, - TextColumn, -) from rich.live import Live -from celery.result import AsyncResult -from celery.result import GroupResult +from rich.progress import BarColumn, Progress, SpinnerColumn, TextColumn logger = logging.getLogger("proxima") diff --git a/src/proxima/celery/tasks.py b/src/proxima/celery/tasks.py index 8d8132b..6358ec2 100644 --- a/src/proxima/celery/tasks.py +++ b/src/proxima/celery/tasks.py @@ -1,18 +1,19 @@ -from dataclasses import dataclass, fields import logging import os +from dataclasses import dataclass, fields + +from celery.exceptions import Reject +from rich import print +from rich.console import Console + from proxima.app import core -from proxima.settings import settings -from proxima.settings.manager import SettingsManager from proxima.celery import celery_app -from proxima.celery.ffmpeg import FfmpegProcess from proxima.celery.celery import celery_queue -from celery.exceptions import Reject +from proxima.celery.ffmpeg import FfmpegProcess +from proxima.settings import settings +from proxima.settings.manager import SettingsManager from proxima.types.job import ProjectMetadata, SourceMetadata -from rich import print -from rich.console import Console - # Worker and Celery settings pulled from local user_settings file # All other settings are passed from queuer console = Console() diff --git a/src/proxima/cli/main.py b/src/proxima/cli/main.py index 3289aa6..bcdd653 100644 --- a/src/proxima/cli/main.py +++ b/src/proxima/cli/main.py @@ -4,9 +4,9 @@ from typing import List, Optional import typer +from pyfiglet import Figlet from rich import print from rich.console import Console -from pyfiglet import Figlet # Init classes cli_app = typer.Typer() diff --git a/src/proxima/settings/__init__.py b/src/proxima/settings/__init__.py index 4fdd456..565fc98 100644 --- a/src/proxima/settings/__init__.py +++ b/src/proxima/settings/__init__.py @@ -1,2 +1 @@ -from .manager import settings -from .manager import SettingsManager +from .manager import SettingsManager, settings diff --git a/src/proxima/settings/manager.py b/src/proxima/settings/manager.py index b90bfad..1054496 100644 --- a/src/proxima/settings/manager.py +++ b/src/proxima/settings/manager.py @@ -9,13 +9,14 @@ import typer from deepdiff import DeepDiff -from proxima.app import core from rich import print from rich.prompt import Confirm, Prompt from ruamel.yaml import YAML +from schema import SchemaError from yaspin import yaspin -from schema import SchemaError +from proxima.app import core + from .schema import settings_schema core.install_rich_tracebacks() diff --git a/src/proxima/settings/schema.py b/src/proxima/settings/schema.py index 5e034b1..7c35d9d 100644 --- a/src/proxima/settings/schema.py +++ b/src/proxima/settings/schema.py @@ -2,8 +2,7 @@ import re from commonregex import link -from schema import Schema, And, Optional - +from schema import And, Optional, Schema settings_schema = Schema( { diff --git a/src/proxima/tests/test_checks.py b/src/proxima/tests/test_checks.py index 1fed6ea..de40581 100644 --- a/src/proxima/tests/test_checks.py +++ b/src/proxima/tests/test_checks.py @@ -1,10 +1,9 @@ import pytest +from shortuuid import uuid from proxima.app import checks from proxima.celery import launch_workers -from shortuuid import uuid - @pytest.fixture def test_launch_workers(): diff --git a/src/proxima/types/batch.py b/src/proxima/types/batch.py index 8794ecf..4c2adc5 100644 --- a/src/proxima/types/batch.py +++ b/src/proxima/types/batch.py @@ -1,17 +1,17 @@ -from functools import cached_property +import json import logging import os -from rich.prompt import Confirm, Prompt +from dataclasses import asdict +from functools import cached_property + from rich import print from rich.console import Console from rich.panel import Panel -from dataclasses import asdict -import json +from rich.prompt import Confirm, Prompt -from proxima.app import core, exceptions -from proxima.app import link -from proxima.types.job import Job +from proxima.app import core, exceptions, link from proxima.settings import settings +from proxima.types.job import Job core.install_rich_tracebacks() logger = logging.getLogger("proxima") diff --git a/src/proxima/types/job.py b/src/proxima/types/job.py index f534622..d9cc76d 100644 --- a/src/proxima/types/job.py +++ b/src/proxima/types/job.py @@ -1,20 +1,15 @@ import logging -import os - -from proxima.app import core -from proxima.celery import ffmpeg - import os import pathlib import re - from dataclasses import dataclass -from glob import glob from functools import cached_property +from glob import glob -from proxima.settings import settings, SettingsManager +from proxima.app import core, exceptions +from proxima.celery import ffmpeg +from proxima.settings import SettingsManager, settings from proxima.types.media_pool_index import media_pool_index -from proxima.app import exceptions core.install_rich_tracebacks() logger = logging.getLogger("proxima") diff --git a/src/proxima/types/media_pool_index.py b/src/proxima/types/media_pool_index.py index 0c15572..a959524 100644 --- a/src/proxima/types/media_pool_index.py +++ b/src/proxima/types/media_pool_index.py @@ -1,4 +1,5 @@ from pydavinci.wrappers.mediapoolitem import MediaPoolItem + from proxima.app.exceptions import MPIAlreadyRegistered