Skip to content

Commit 9fb60b7

Browse files
committed
Fix formatting issue
1 parent d78d8e6 commit 9fb60b7

File tree

9 files changed

+21
-22
lines changed

9 files changed

+21
-22
lines changed

tests/test_daemon_handler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ def setUpClass(cls) -> None:
3535
with open(daemon_handler.SERVICE_PATH, 'r') as service:
3636
lines = service.readlines()
3737
with open(daemon_handler.SERVICE_PATH, 'w') as service:
38+
flatpak_exec = f'ExecStart={str(Path.home())}/.local/share/flatpak/exports/bin/sh.oskar.yin_yang --systemd'
3839
for line in lines:
39-
service.write(re.sub('ExecStart=\/usr\/bin\/yin_yang --systemd', 'ExecStart='+str(Path.home())+'\/.local\/share\/flatpak\/exports\/bin\/sh.oskar.yin_yang --systemd', line))
40+
service.write(re.sub('ExecStart=/usr/bin/yin_yang --systemd', flatpak_exec, line))
4041
shutil.copyfile(daemon_handler.TIMER_PATH, daemon_handler.TIMER_PATH.with_suffix('.timer_backup'))
4142

4243
@classmethod

yin_yang/__main__.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
#!/bin/env python3
22

3-
import sys
43
import logging
4+
import sys
55
from argparse import ArgumentParser
66
from logging.handlers import RotatingFileHandler
77
from pathlib import Path
8-
from threading import Timer
98

109
from PySide6 import QtWidgets
11-
from PySide6.QtCore import QTranslator, QLibraryInfo, QLocale, QObject
10+
from PySide6.QtCore import QTranslator, QLibraryInfo, QLocale
1211
from PySide6.QtGui import QIcon
1312
from PySide6.QtWidgets import QSystemTrayIcon, QMenu
1413
from systemd import journal
1514

16-
from yin_yang.helpers import is_flatpak
17-
from yin_yang.notification_handler import NotificationHandler
1815
from yin_yang import daemon_handler
19-
from yin_yang.meta import ConfigEvent
2016
from yin_yang import theme_switcher
2117
from yin_yang.config import config, Modes
18+
from yin_yang.helpers import is_flatpak
19+
from yin_yang.meta import ConfigEvent
20+
from yin_yang.notification_handler import NotificationHandler
2221
from yin_yang.repeat_timer import RepeatTimer
2322
from yin_yang.ui import main_window_connector
2423

yin_yang/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def load(self) -> None:
210210
if old_file.is_file():
211211
shutil.copyfile(old_file, config_path)
212212
os.remove(old_path)
213-
213+
214214
# check if conf exists
215215
if config_path.is_file():
216216
if self._last_save_time == config_path.stat().st_mtime:

yin_yang/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
"""Base Flatpak Arguments
1111
12-
These are the base arguments we use to execute commands when running in
12+
These are the base arguments we use to execute commands when running in
1313
a flatpak environment.
1414
"""
1515
base_flatpak_args = ['flatpak-spawn', '--host']

yin_yang/plugins/_plugin.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ def set_theme(self, theme: str):
255255

256256
class DBusPlugin(Plugin):
257257
"""A class for plugins that mainly switching theme via DBus"""
258-
258+
259259
def __init__(self):
260260
super().__init__()
261261
self.connection = QDBusConnection.sessionBus()
@@ -280,8 +280,9 @@ def list_paths(self, service: str, path: str) -> List[str]:
280280
""" Get all subpath under a given pth of service
281281
:path: should start with / but without / on its end
282282
"""
283-
284-
assert path.startswith('/') and not path.endswith('/'), "list_paths wrong, :path: should start with / but without / on its end"
283+
284+
assert path.startswith('/') and not path.endswith('/'), \
285+
"list_paths wrong, :path: should start with / but without / on its end"
285286
msg = QDBusMessage.createMethodCall(service, path, "org.freedesktop.DBus.Introspectable", "Introspect")
286287
reply = self.connection.call(msg)
287288
if reply.errorName():
@@ -314,7 +315,7 @@ def open_config(self, path: Path):
314315
case FileFormat.JSON.value:
315316
try:
316317
return json.load(file)
317-
except json.decoder.JSONDecodeError as e:
318+
except json.decoder.JSONDecodeError:
318319
return self.default_config
319320
case FileFormat.CONFIG.value:
320321
config = ConfigParser()
@@ -385,6 +386,7 @@ def flatpak_user(app_id: str) -> Path:
385386
def snap_path(app: str) -> Path:
386387
return Path(f'/var/lib/snapd/snap/{app}/current')
387388

389+
388390
def themes_from_theme_directories(type: str) -> List[Path]:
389391
theme_directories = [
390392
Path('/usr/share/themes'),

yin_yang/plugins/firefox.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def available_themes(self) -> dict:
4444
for addon in content['addons']:
4545
if addon['type'] == 'theme':
4646
themes[addon['id']] = addon['defaultLocale']['name']
47-
except FileNotFoundError as _:
47+
except FileNotFoundError:
4848
logger.warning(f'Firefox profile has no extensions installed: {path}')
4949
continue
5050

yin_yang/plugins/gtk.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
import logging
2-
from os import path, scandir
32
from pathlib import Path
43

54
from PySide6.QtDBus import QDBusMessage
65

76
from yin_yang import helpers
8-
9-
from ..meta import Desktop
107
from ._plugin import (
118
DBusPlugin,
129
PluginCommandline,
1310
PluginDesktopDependent,
1411
themes_from_theme_directories,
1512
)
1613
from .system import test_gnome_availability
14+
from ..meta import Desktop
1715

1816
logger = logging.getLogger(__name__)
1917

@@ -124,6 +122,7 @@ def set_theme(self, theme: str):
124122
color_scheme = 'prefer-dark' if theme == self.theme_dark else 'prefer-light'
125123
helpers.run(['gsettings', 'set', 'org.gnome.desktop.interface', 'color-scheme', f'{color_scheme}'])
126124

125+
127126
class _Xfce(PluginCommandline):
128127
def __init__(self):
129128
super(_Xfce, self).__init__(

yin_yang/plugins/konsole.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ def create_profiles(self):
236236
with open(dark_profile, 'w') as file:
237237
profile_config.write(file)
238238

239-
240239
def set_profile(self, service: str, profile: str, set_default_profile: bool = False):
241240
if set_default_profile:
242241
path = '/Sessions'

yin_yang/plugins/wallpaper.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import logging
2-
import subprocess
32
from pathlib import Path
43

5-
from PySide6.QtWidgets import QDialogButtonBox, QVBoxLayout, QWidget, QLineEdit
64
from PySide6.QtDBus import QDBusMessage
7-
from yin_yang import helpers
5+
from PySide6.QtWidgets import QDialogButtonBox, QVBoxLayout, QWidget, QLineEdit
86

9-
from ..meta import Desktop
7+
from yin_yang import helpers
108
from ._plugin import PluginDesktopDependent, PluginCommandline, DBusPlugin
119
from .system import test_gnome_availability
10+
from ..meta import Desktop
1211

1312
logger = logging.getLogger(__name__)
1413

0 commit comments

Comments
 (0)