Skip to content

Commit

Permalink
chore(refactor): Sort imports
Browse files Browse the repository at this point in the history
  • Loading branch information
rfsbraz committed Mar 8, 2024
1 parent 111bbff commit cc4fe49
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 33 deletions.
12 changes: 7 additions & 5 deletions app/config.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# encoding: utf-8

import yaml
from app import logger
import sys
import os
import sys

import requests
from app.modules.trakt import Trakt
import yaml

from app import logger
from app.constants import VALID_ACTION_MODES, VALID_SORT_FIELDS, VALID_SORT_ORDERS
from app.modules.tautulli import Tautulli
from app.constants import VALID_SORT_FIELDS, VALID_SORT_ORDERS, VALID_ACTION_MODES
from app.modules.trakt import Trakt
from app.utils import validate_units


Expand Down
11 changes: 6 additions & 5 deletions app/deleterr.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# encoding: utf-8

import argparse
import locale
import os
import argparse

from pyarr.sonarr import SonarrAPI
from pyarr.exceptions import PyarrResourceNotFound, PyarrServerError
from pyarr.radarr import RadarrAPI
from pyarr.sonarr import SonarrAPI

from app import logger
from app.utils import print_readable_freed_space
from app.media_cleaner import MediaCleaner
from app.config import load_config
from pyarr.exceptions import PyarrResourceNotFound, PyarrServerError
from app.media_cleaner import MediaCleaner
from app.utils import print_readable_freed_space


class Deleterr:
Expand Down
2 changes: 1 addition & 1 deletion app/logger.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from logging import handlers
import logging
import os
import sys
from logging import handlers

# These settings are for file logging only
FILENAME = "deleterr.log"
Expand Down
11 changes: 6 additions & 5 deletions app/media_cleaner.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import requests
import time

from app import logger
from app.utils import print_readable_freed_space, parse_size_to_bytes
from datetime import datetime

import requests
from plexapi.server import PlexServer
from app.modules.trakt import Trakt

from app import logger
from app.modules.tautulli import Tautulli
from app.modules.trakt import Trakt
from app.utils import parse_size_to_bytes, print_readable_freed_space

DEFAULT_MAX_ACTIONS_PER_RUN = 10
DEFAULT_SONARR_SERIES_TYPE = "standard"
Expand Down
4 changes: 3 additions & 1 deletion app/modules/tautulli.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# encoding: utf-8

from tautulli import RawAPI
from datetime import datetime, timedelta

from tautulli import RawAPI

from app import logger

HISTORY_PAGE_SIZE = 300
Expand Down
4 changes: 3 additions & 1 deletion app/modules/trakt.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import trakt
import re

import trakt

from app import logger


Expand Down
3 changes: 2 additions & 1 deletion tests/test_config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest

from app.config import Config
from app.constants import VALID_SORT_FIELDS, VALID_SORT_ORDERS, VALID_ACTION_MODES
from app.constants import VALID_ACTION_MODES, VALID_SORT_FIELDS, VALID_SORT_ORDERS


# Test case for validate_libraries
Expand Down
5 changes: 3 additions & 2 deletions tests/test_config_files.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import os
import unittest
from unittest.mock import patch
from app.deleterr import load_config

from app.config import Config
from app.modules import trakt, tautulli
from app.deleterr import load_config
from app.modules import tautulli, trakt


class TestConfigFiles(unittest.TestCase):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_deleterr.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import unittest
from unittest.mock import patch, MagicMock
from unittest.mock import MagicMock, patch

from app.deleterr import main


Expand Down
3 changes: 2 additions & 1 deletion tests/test_logger.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import unittest
from unittest.mock import patch, MagicMock
from unittest.mock import MagicMock, patch

from app import logger


Expand Down
14 changes: 8 additions & 6 deletions tests/test_media_cleaner.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import unittest
from unittest.mock import MagicMock, Mock, patch

import pytest
from plexapi.server import PlexServer

from app.config import Config
from app.media_cleaner import (
DEFAULT_MAX_ACTIONS_PER_RUN,
MediaCleaner,
find_watched_data,
library_meets_disk_space_threshold,
MediaCleaner,
DEFAULT_MAX_ACTIONS_PER_RUN,
)
from unittest.mock import Mock, patch, MagicMock
from app.config import Config
from app.modules import trakt, tautulli
from plexapi.server import PlexServer
from app.modules import tautulli, trakt


@pytest.fixture
Expand Down
1 change: 1 addition & 0 deletions tests/test_sort_media.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest

from app.media_cleaner import sort_media


Expand Down
6 changes: 4 additions & 2 deletions tests/test_tautulli.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from datetime import datetime, timedelta
from unittest.mock import Mock, patch

import pytest
from unittest.mock import patch, Mock

from app.modules.tautulli import Tautulli, filter_by_most_recent
from datetime import datetime, timedelta


@pytest.mark.parametrize(
Expand Down
3 changes: 2 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
from app.utils import print_readable_freed_space, parse_size_to_bytes, validate_units

from app.utils import parse_size_to_bytes, print_readable_freed_space, validate_units


@pytest.mark.parametrize(
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
max-line-length = 200
extend-ignore = E203
exclude = tests/*
max-complexity = 15
max-complexity = 10

0 comments on commit cc4fe49

Please sign in to comment.