Merge pull request #1112 from auouymous/fix-1054-linting

Fix linting issues from #1054
This commit is contained in:
auouymous 2021-07-29 17:02:17 -07:00 committed by GitHub
commit 3c2362ebe1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 10 deletions

View File

@ -34,6 +34,7 @@ from gpodder import download, util
_ = gpodder.gettext
class TaskQueue:
def __init__(self):
self.lock = threading.Lock()
@ -81,6 +82,7 @@ class TaskQueue:
except ValueError:
pass
class DownloadStatusModel:
# Symbolic names for our columns, so we know what we're up to
C_TASK, C_NAME, C_URL, C_PROGRESS, C_PROGRESS_TEXT, C_ICON_NAME = list(range(6))
@ -220,6 +222,7 @@ class DownloadStatusModel:
task.status = task.DOWNLOADING
return True
class DownloadTaskMonitor(object):
"""A helper class that abstracts download events"""
def __init__(self, episode, on_can_resume, on_can_pause, on_finished):

View File

@ -1235,8 +1235,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
title.append(N_('%(queued)d task queued',
'%(queued)d tasks queued',
queued) % {'queued': queued})
if ((downloading + synchronizing + queued) == 0 and
self.things_adding_tasks == 0):
if (downloading + synchronizing + queued) == 0 and self.things_adding_tasks == 0:
self.set_download_progress(1.)
self.downloads_finished(self.download_tasks_seen)
gpodder.user_extensions.on_all_episodes_downloaded()
@ -3707,7 +3706,7 @@ class gPodder(BuilderWidget, dbus.service.Object):
file.mount_enclosing_volume_finish(res)
except GLib.Error as err:
if (not err.matches(Gio.io_error_quark(), Gio.IOErrorEnum.NOT_SUPPORTED) and
not err.matches(Gio.io_error_quark(), Gio.IOErrorEnum.ALREADY_MOUNTED)):
not err.matches(Gio.io_error_quark(), Gio.IOErrorEnum.ALREADY_MOUNTED)):
logger.error('mounting volume %s failed: %s' % (file.get_uri(), err.message))
result = False
finally:
@ -3736,7 +3735,6 @@ class gPodder(BuilderWidget, dbus.service.Object):
self.mount_volume_for_file)
self.sync_ui.on_synchronize_episodes(self.channels, episodes, force_played)
# self.set_download_list_state)
def on_extension_enabled(self, extension):
if getattr(extension, 'on_ui_object_available', None) is not None:

View File

@ -503,6 +503,7 @@ class iPodDevice(Device):
except:
logger.warning('Seems like your python-gpod is out-of-date.')
class MP3PlayerDevice(Device):
def __init__(self, config,
download_status_model,
@ -597,7 +598,8 @@ class MP3PlayerDevice(Device):
to_file.get_uri())
from_file = Gio.File.new_for_path(from_file)
try:
hookconvert = lambda current_bytes, total_bytes, user_data : reporthook(current_bytes, 1, total_bytes)
def hookconvert(current_bytes, total_bytes, user_data):
return reporthook(current_bytes, 1, total_bytes)
from_file.copy(to_file, Gio.FileCopyFlags.OVERWRITE, None, hookconvert, None)
except GLib.Error as err:
logger.error('Error copying %s to %s: %s', from_file.get_uri(), to_file.get_uri(), err.message)

View File

@ -249,8 +249,7 @@ class gPodderSyncUI(object):
# if playlist doesn't exist (yet) episodes_in_playlist will be empty
if episodes_in_playlists:
for episode_filename in episodes_in_playlists:
if not playlist.mountpoint.resolve_relative_path(
episode_filename).query_exists():
if not playlist.mountpoint.resolve_relative_path(episode_filename).query_exists():
# episode was synced but no longer on device
# i.e. must have been deleted by user, so delete from gpodder
try:

View File

@ -63,7 +63,7 @@ from html.parser import HTMLParser
import gi
gi.require_version('Gtk', '3.0') # isort:skip
from gi.repository import Gio, GLib, Gtk # isort:skip
from gi.repository import Gio, GLib, Gtk # isort:skip
import requests
import requests.exceptions
@ -2259,7 +2259,7 @@ def response_text(response, default_encoding='utf-8'):
return response.content.decode(default_encoding)
def mount_volume_for_file(file, op = None):
def mount_volume_for_file(file, op=None):
"""
Utility method to mount the enclosing volume for the given file in a blocking
fashion
@ -2274,7 +2274,7 @@ def mount_volume_for_file(file, op = None):
result = True
except GLib.Error as err:
if (not err.matches(Gio.io_error_quark(), Gio.IOErrorEnum.NOT_SUPPORTED) and
not err.matches(Gio.io_error_quark(), Gio.IOErrorEnum.ALREADY_MOUNTED)):
not err.matches(Gio.io_error_quark(), Gio.IOErrorEnum.ALREADY_MOUNTED)):
message = err.message
result = False
finally: