diff options
author | DjLegolas <djlegolas@protonmail.com> | 2021-12-28 22:20:57 +0200 |
---|---|---|
committer | Calum Lind <calumlind+deluge@gmail.com> | 2021-12-29 21:51:07 +0000 |
commit | ec0bcc11f510cd113bbdb6cd551b27c697f03f53 (patch) | |
tree | c60c19a61a14fa157227ad7531406f250493b78e /deluge/plugins/Stats/deluge_stats | |
parent | 16895b4a492aedca8bcc2929a905207341c36b35 (diff) | |
download | deluge-ec0bcc11f510cd113bbdb6cd551b27c697f03f53.tar.gz deluge-ec0bcc11f510cd113bbdb6cd551b27c697f03f53.tar.bz2 deluge-ec0bcc11f510cd113bbdb6cd551b27c697f03f53.zip |
Upgrade codebase with pyupgrade (>=py3.6)
Added pyupgrade utility with manual stage to pre-commit and run on all
files.
Ref: https://github.com/asottile/pyupgrade
Closes: deluge-torrent/deluge#326
Diffstat (limited to 'deluge/plugins/Stats/deluge_stats')
-rw-r--r-- | deluge/plugins/Stats/deluge_stats/__init__.py | 7 | ||||
-rw-r--r-- | deluge/plugins/Stats/deluge_stats/common.py | 1 | ||||
-rw-r--r-- | deluge/plugins/Stats/deluge_stats/core.py | 1 | ||||
-rw-r--r-- | deluge/plugins/Stats/deluge_stats/graph.py | 5 | ||||
-rw-r--r-- | deluge/plugins/Stats/deluge_stats/gtkui.py | 7 | ||||
-rw-r--r-- | deluge/plugins/Stats/deluge_stats/tests/test_stats.py | 3 | ||||
-rw-r--r-- | deluge/plugins/Stats/deluge_stats/webui.py | 1 |
7 files changed, 9 insertions, 16 deletions
diff --git a/deluge/plugins/Stats/deluge_stats/__init__.py b/deluge/plugins/Stats/deluge_stats/__init__.py index a7ec1b701..ca7b0bb83 100644 --- a/deluge/plugins/Stats/deluge_stats/__init__.py +++ b/deluge/plugins/Stats/deluge_stats/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com> # @@ -19,7 +18,7 @@ class CorePlugin(PluginInitBase): from .core import Core as _pluginCls self._plugin_cls = _pluginCls - super(CorePlugin, self).__init__(plugin_name) + super().__init__(plugin_name) class GtkUIPlugin(PluginInitBase): @@ -27,7 +26,7 @@ class GtkUIPlugin(PluginInitBase): from .gtkui import GtkUI as _pluginCls self._plugin_cls = _pluginCls - super(GtkUIPlugin, self).__init__(plugin_name) + super().__init__(plugin_name) class WebUIPlugin(PluginInitBase): @@ -35,4 +34,4 @@ class WebUIPlugin(PluginInitBase): from .webui import WebUI as _pluginCls self._plugin_cls = _pluginCls - super(WebUIPlugin, self).__init__(plugin_name) + super().__init__(plugin_name) diff --git a/deluge/plugins/Stats/deluge_stats/common.py b/deluge/plugins/Stats/deluge_stats/common.py index 28233e984..eb47f1398 100644 --- a/deluge/plugins/Stats/deluge_stats/common.py +++ b/deluge/plugins/Stats/deluge_stats/common.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Basic plugin template created by: # Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com> diff --git a/deluge/plugins/Stats/deluge_stats/core.py b/deluge/plugins/Stats/deluge_stats/core.py index 148a4033a..1be51e659 100644 --- a/deluge/plugins/Stats/deluge_stats/core.py +++ b/deluge/plugins/Stats/deluge_stats/core.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2009 Ian Martin <ianmartin@cantab.net> # Copyright (C) 2008 Damien Churchill <damoxc@gmail.com> diff --git a/deluge/plugins/Stats/deluge_stats/graph.py b/deluge/plugins/Stats/deluge_stats/graph.py index eb54dbd5f..7589a31c8 100644 --- a/deluge/plugins/Stats/deluge_stats/graph.py +++ b/deluge/plugins/Stats/deluge_stats/graph.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2009 Ian Martin <ianmartin@cantab.net> # Copyright (C) 2008 Damien Churchill <damoxc@gmail.com> @@ -60,7 +59,7 @@ def change_opacity(color, opactiy): return tuple(color) -class Graph(object): +class Graph: def __init__(self): self.width = 100 self.height = 100 @@ -176,7 +175,7 @@ class Graph(object): te = self.ctx.text_extents(text) return math.ceil(te[4] - te[0]) - y_tick_width = max((space_required(text) for text in y_tick_text)) + y_tick_width = max(space_required(text) for text in y_tick_text) top = font_extents[2] / 2 # bounds(left, top, right, bottom) diff --git a/deluge/plugins/Stats/deluge_stats/gtkui.py b/deluge/plugins/Stats/deluge_stats/gtkui.py index e207c0471..c088060dc 100644 --- a/deluge/plugins/Stats/deluge_stats/gtkui.py +++ b/deluge/plugins/Stats/deluge_stats/gtkui.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2009 Ian Martin <ianmartin@cantab.net> # Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com> @@ -83,7 +82,7 @@ def text_to_rgba(color): class GraphsTab(Tab): def __init__(self, colors): - super(GraphsTab, self).__init__() + super().__init__() builder = Gtk.Builder() builder.add_from_file(get_resource('tabs.ui')) @@ -268,7 +267,7 @@ class GtkUI(Gtk3PluginBase): for graph, colors in self.config['colors'].items(): gtkconf[graph] = {} for value, color in colors.items(): - color_btn = self.builder.get_object('%s_%s_color' % (graph, value)) + color_btn = self.builder.get_object(f'{graph}_{value}_color') try: gtkconf[graph][value] = color_btn.get_color().to_string() except Exception: @@ -283,7 +282,7 @@ class GtkUI(Gtk3PluginBase): for graph, colors in self.config['colors'].items(): for value, color in colors.items(): try: - color_btn = self.builder.get_object('%s_%s_color' % (graph, value)) + color_btn = self.builder.get_object(f'{graph}_{value}_color') color_btn.set_rgba(text_to_rgba(color)) except Exception as ex: log.debug('Unable to set %s %s %s: %s', graph, value, color, ex) diff --git a/deluge/plugins/Stats/deluge_stats/tests/test_stats.py b/deluge/plugins/Stats/deluge_stats/tests/test_stats.py index 7b2c2fbff..f40497b15 100644 --- a/deluge/plugins/Stats/deluge_stats/tests/test_stats.py +++ b/deluge/plugins/Stats/deluge_stats/tests/test_stats.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. @@ -88,7 +87,7 @@ class StatsTestCase(BaseTestCase): TorrentDetails() Preferences() - class FakeFile(object): + class FakeFile: def __init__(self): self.data = [] diff --git a/deluge/plugins/Stats/deluge_stats/webui.py b/deluge/plugins/Stats/deluge_stats/webui.py index 9e7e6992d..f38daeb64 100644 --- a/deluge/plugins/Stats/deluge_stats/webui.py +++ b/deluge/plugins/Stats/deluge_stats/webui.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com> # |