Skip to content

Commit

Permalink
Format everything with isort
Browse files Browse the repository at this point in the history
  • Loading branch information
rdbende committed Mar 26, 2024
1 parent 0d3f59a commit ad26c04
Show file tree
Hide file tree
Showing 42 changed files with 80 additions and 95 deletions.
21 changes: 10 additions & 11 deletions cozy/app_controller.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
from gi.repository import Gio

import cozy.ext.inject as inject
from peewee import SqliteDatabase

from cozy.control.offline_cache import OfflineCache
from cozy.media.files import Files
from cozy.media.gst_player import GstPlayer
from cozy.media.player import Player
from cozy.model.database_importer import DatabaseImporter
from cozy.power_manager import PowerManager
from cozy.report import reporter
import cozy.ext.inject as inject
from cozy.application_settings import ApplicationSettings
from cozy.architecture.singleton import Singleton
from cozy.control.db import get_db
from cozy.control.filesystem_monitor import FilesystemMonitor
from cozy.control.offline_cache import OfflineCache
from cozy.media.files import Files
from cozy.media.gst_player import GstPlayer
from cozy.media.player import Player
from cozy.model.book import Book
from cozy.model.database_importer import DatabaseImporter
from cozy.model.library import Library
from cozy.model.settings import Settings
from cozy.open_view import OpenView
from cozy.power_manager import PowerManager
from cozy.report import reporter
from cozy.ui.app_view import AppView
from cozy.ui.book_detail_view import BookDetailView
from cozy.ui.headerbar import Headerbar
from cozy.ui.toaster import ToastNotifier
from cozy.ui.library_view import LibraryView
from cozy.ui.main_view import CozyUI
from cozy.ui.media_controller import MediaController
from cozy.ui.search_view import SearchView
from cozy.ui.toaster import ToastNotifier
from cozy.view import View
from cozy.view_model.app_view_model import AppViewModel
from cozy.view_model.book_detail_view_model import BookDetailViewModel
from cozy.view_model.headerbar_view_model import HeaderbarViewModel
from cozy.view_model.library_view_model import LibraryViewModel, LibraryViewMode
from cozy.view_model.library_view_model import LibraryViewMode, LibraryViewModel
from cozy.view_model.playback_control_view_model import PlaybackControlViewModel
from cozy.view_model.playback_speed_view_model import PlaybackSpeedViewModel
from cozy.view_model.search_view_model import SearchViewModel
Expand Down
2 changes: 1 addition & 1 deletion cozy/architecture/observable.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import logging
from typing import Callable

from gi.repository import GLib

from cozy.report import reporter
import logging

log = logging.getLogger("observable")

Expand Down
4 changes: 2 additions & 2 deletions cozy/architecture/profiler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import time
import logging
import functools
import logging
import time

log = logging.getLogger("timing")

Expand Down
2 changes: 1 addition & 1 deletion cozy/control/artwork_cache.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
import os
import uuid
import logging

from gi.repository import Gdk, GdkPixbuf

Expand Down
1 change: 0 additions & 1 deletion cozy/control/db.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import logging
import time


from cozy.control.db_updater import update_db
from cozy.db.artwork_cache import ArtworkCache
from cozy.db.book import Book
Expand Down
2 changes: 1 addition & 1 deletion cozy/control/db_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import shutil
from datetime import datetime

from peewee import IntegerField, BooleanField, FloatField, ForeignKeyField, fn
from peewee import BooleanField, FloatField, ForeignKeyField, IntegerField, fn
from playhouse.migrate import SqliteMigrator, migrate
from playhouse.reflection import generate_models

Expand Down
2 changes: 1 addition & 1 deletion cozy/control/filesystem_monitor.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import logging

import cozy.ext.inject as inject
from gi.repository import Gio

import cozy.ext.inject as inject
from cozy.architecture.event_sender import EventSender
from cozy.model.book import Book
from cozy.model.settings import Settings
Expand Down
8 changes: 3 additions & 5 deletions cozy/control/offline_cache.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import logging
import uuid
import os
import uuid

from gi.repository import Gio

import cozy.tools as tools
from cozy.architecture.event_sender import EventSender
from cozy.control.application_directories import get_cache_dir
import cozy.tools as tools

from gi.repository import Gio

from cozy.db.file import File
from cozy.db.offline_cache import OfflineCache as OfflineCacheModel
from cozy.db.track_to_file import TrackToFile
Expand Down
2 changes: 1 addition & 1 deletion cozy/db/artwork_cache.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from peewee import ForeignKeyField, CharField
from peewee import CharField, ForeignKeyField

from cozy.db.book import Book
from cozy.db.model_base import ModelBase
Expand Down
3 changes: 2 additions & 1 deletion cozy/db/book.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from peewee import BlobField, BooleanField, CharField, FloatField, IntegerField

from cozy.db.model_base import ModelBase
from peewee import CharField, IntegerField, BlobField, FloatField, BooleanField


class Book(ModelBase):
Expand Down
4 changes: 2 additions & 2 deletions cozy/db/offline_cache.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from peewee import ForeignKeyField, BooleanField, CharField
from peewee import BooleanField, CharField, ForeignKeyField

from cozy.db.model_base import ModelBase
from cozy.db.file import File
from cozy.db.model_base import ModelBase


class OfflineCache(ModelBase):
Expand Down
4 changes: 2 additions & 2 deletions cozy/db/settings.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from peewee import CharField, BooleanField, ForeignKeyField, IntegerField
from peewee import BooleanField, CharField, ForeignKeyField, IntegerField

from cozy.db.model_base import ModelBase
from cozy.db.book import Book
from cozy.db.model_base import ModelBase

DB_VERSION = 10

Expand Down
2 changes: 1 addition & 1 deletion cozy/db/storage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from peewee import CharField, IntegerField, BooleanField
from peewee import BooleanField, CharField, IntegerField

from cozy.db.model_base import ModelBase

Expand Down
4 changes: 2 additions & 2 deletions cozy/db/track.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from peewee import CharField, IntegerField, ForeignKeyField, FloatField
from peewee import CharField, FloatField, ForeignKeyField, IntegerField

from cozy.db.model_base import ModelBase
from cozy.db.book import Book
from cozy.db.model_base import ModelBase


class Track(ModelBase):
Expand Down
4 changes: 2 additions & 2 deletions cozy/media/gst_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
from enum import Enum, auto
from typing import Optional

from gi.repository import Gst

from cozy.architecture.event_sender import EventSender
from cozy.report import reporter

from gi.repository import Gst

log = logging.getLogger("gst_player")


Expand Down
4 changes: 2 additions & 2 deletions cozy/media/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
import time
from enum import Enum, auto
from multiprocessing.pool import Pool as Pool
from urllib.parse import urlparse, unquote
from urllib.parse import unquote, urlparse

from cozy.architecture.event_sender import EventSender
from cozy.architecture.profiler import timing
from cozy.control.filesystem_monitor import FilesystemMonitor, StorageNotFound
from cozy.ext import inject
from cozy.media.media_detector import MediaDetector, NotAnAudioFile, AudioFileCouldNotBeDiscovered
from cozy.media.media_detector import AudioFileCouldNotBeDiscovered, MediaDetector, NotAnAudioFile
from cozy.media.media_file import MediaFile
from cozy.model.database_importer import DatabaseImporter
from cozy.model.library import Library
Expand Down
5 changes: 2 additions & 3 deletions cozy/media/media_detector.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import logging
import pathlib

from cozy.architecture.event_sender import EventSender
from gi.repository import Gst, GstPbutils

from cozy.architecture.event_sender import EventSender
from cozy.media.media_file import MediaFile
from cozy.media.tag_reader import TagReader

from gi.repository import Gst, GstPbutils

log = logging.getLogger("media_detector")


Expand Down
2 changes: 1 addition & 1 deletion cozy/media/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import time
from threading import Thread
from typing import Optional
from cozy.media.importer import Importer, ScanStatus

from gi.repository import GLib, Gst

Expand All @@ -12,6 +11,7 @@
from cozy.control.offline_cache import OfflineCache
from cozy.ext import inject
from cozy.media.gst_player import GstPlayer, GstPlayerState
from cozy.media.importer import Importer, ScanStatus
from cozy.model.book import Book
from cozy.model.chapter import Chapter
from cozy.model.library import Library
Expand Down
3 changes: 1 addition & 2 deletions cozy/media/tag_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
from urllib.parse import unquote, urlparse

import mutagen
from gi.repository import GLib, Gst, GstPbutils
from mutagen.mp4 import MP4

from gi.repository import GstPbutils, Gst, GLib

from cozy.media.chapter import Chapter
from cozy.media.media_file import MediaFile

Expand Down
4 changes: 2 additions & 2 deletions cozy/model/book.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import logging
from contextlib import suppress

from peewee import SqliteDatabase, DoesNotExist
from peewee import DoesNotExist, SqliteDatabase

from cozy.application_settings import ApplicationSettings
from cozy.architecture.event_sender import EventSender
from cozy.architecture.observable import Observable
from cozy.db.collation import collate_natural
from cozy.db.book import Book as BookModel
from cozy.db.collation import collate_natural
from cozy.db.track import Track as TrackModel
from cozy.db.track_to_file import TrackToFile
from cozy.ext import inject
Expand Down
2 changes: 1 addition & 1 deletion cozy/model/database_importer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging

from peewee import fn, SqliteDatabase
from peewee import SqliteDatabase, fn

from cozy.db.book import Book as BookModel
from cozy.db.file import File
Expand Down
2 changes: 1 addition & 1 deletion cozy/model/track.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging

from peewee import SqliteDatabase, DoesNotExist
from peewee import DoesNotExist, SqliteDatabase

from cozy.db.file import File
from cozy.db.track import Track as TrackModel
Expand Down
16 changes: 7 additions & 9 deletions cozy/report/report_to_loki.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
import datetime
import os

import platform
from contextlib import suppress

import requests
import datetime
import pytz
import distro
import platform
import pytz
import requests
from gi.repository import Gtk
from mutagen import version_string as MutagenVersion
from peewee import __version__ as PeeweeVersion

from cozy.application_settings import ApplicationSettings
from cozy.ext import inject
from cozy.report.log_level import LogLevel
from cozy.version import __version__ as CozyVersion
from peewee import __version__ as PeeweeVersion
from mutagen import version_string as MutagenVersion

from gi.repository import Gtk

URL = 'https://errors.cozy.sh:3100/api/prom/push'
ENABLE = '@INSTALLED@'
Expand Down
4 changes: 1 addition & 3 deletions cozy/report/reporter.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import traceback

from cozy.report.log_level import LogLevel

from multiprocessing.pool import ThreadPool as Pool

from cozy.report.log_level import LogLevel
from cozy.report.report_to_loki import report

report_pool = Pool(5)
Expand Down
9 changes: 5 additions & 4 deletions cozy/tools.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from datetime import datetime
import time
import logging as log
import threading
from platform import system as get_system
import time
from datetime import datetime
from enum import Enum
from gettext import ngettext
import logging as log
from platform import system as get_system

import distro


Expand Down
4 changes: 2 additions & 2 deletions cozy/ui/app_view.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from gi.repository import Gtk, Adw
from gi.repository import Adw, Gtk

from cozy.ext import inject
from cozy.view_model.app_view_model import AppViewModel
from cozy.view import View
from cozy.view_model.app_view_model import AppViewModel

LIBRARY = "main"
EMPTY_STATE = "welcome"
Expand Down
7 changes: 3 additions & 4 deletions cozy/ui/book_detail_view.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import logging
from contextlib import suppress
import time
from contextlib import suppress
from threading import Event, Thread
from typing import Optional, Callable
from typing import Callable, Optional

from gi.repository import Adw, GLib, Gtk

from cozy.control.artwork_cache import ArtworkCache
from cozy.ext import inject
Expand All @@ -14,8 +15,6 @@
from cozy.ui.disk_element import DiskElement
from cozy.view_model.book_detail_view_model import BookDetailViewModel

from gi.repository import Adw, GLib, Gtk

log = logging.getLogger("BookDetailView")


Expand Down
2 changes: 1 addition & 1 deletion cozy/ui/chapter_element.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from gi.repository import Gtk, GObject, Gdk
from gi.repository import Gdk, GObject, Gtk

from cozy.control.string_representation import seconds_to_str
from cozy.model.chapter import Chapter
Expand Down
6 changes: 2 additions & 4 deletions cozy/ui/headerbar.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import logging

from gi.repository import Adw, GObject, Gtk

from cozy.ext import inject
from cozy.ui.widgets.progress_popover import ProgressPopover
from cozy.view_model.headerbar_view_model import HeaderbarViewModel, HeaderBarState

from gi.repository import Adw, Gtk, GObject

from cozy.view_model.headerbar_view_model import HeaderBarState, HeaderbarViewModel

log = logging.getLogger("Headerbar")

Expand Down
1 change: 0 additions & 1 deletion cozy/ui/import_failed_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from cozy.ext import inject


HEADER = _("This can have multiple reasons:")
POSSIBILITIES = "\n • ".join(( # yes, it is a hack, because \t would be too wide
"",
Expand Down
Loading

0 comments on commit ad26c04

Please sign in to comment.