From 4baaa75ee474d63ff9f6a90e9ef89692fcd07bbd Mon Sep 17 00:00:00 2001 From: MarkusHackspacher Date: Fri, 7 Sep 2018 06:52:32 +0200 Subject: [PATCH] fix E501 line too long in lines with more than 145 characters --- setup.cfg | 4 ++-- src/gpodder/dbsqlite.py | 7 +++++-- src/gpodder/gtkui/desktop/sync.py | 4 +++- src/gpodder/gtkui/draw.py | 6 +++++- src/gpodder/gtkui/main.py | 32 +++++++++++++++++++++++-------- src/gpodder/opml.py | 15 ++++++++++++--- src/gpodder/sync.py | 6 +++++- src/gpodder/util.py | 7 +++++-- 8 files changed, 61 insertions(+), 20 deletions(-) diff --git a/setup.cfg b/setup.cfg index ee66ad06..8101f2e0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,8 +1,8 @@ [pycodestyle] count=1 -select = W1, W2, W3, E11, E121, E122, E123, E124, E125, E127, E129, E13, E2, E3, E401, E502, E703, E711, E712, E713, E721, E731, E74, E9 +select = W1, W2, W3, E11, E121, E122, E123, E124, E125, E127, E129, E13, E2, E3, E401, E5, E703, E711, E712, E713, E721, E731, E74, E9 # https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes -max-line-length = 100 +max-line-length = 145 [isort] known_third_party=dbus,gi,mutagen,cairo,requests diff --git a/src/gpodder/dbsqlite.py b/src/gpodder/dbsqlite.py index fcba2c23..94fc17a8 100644 --- a/src/gpodder/dbsqlite.py +++ b/src/gpodder/dbsqlite.py @@ -128,9 +128,12 @@ class Database(object): with self.lock: cur = self.cursor() if podcast_id is not None: - cur.execute('SELECT COUNT(*), state, is_new FROM %s WHERE podcast_id = ? GROUP BY state, is_new' % self.TABLE_EPISODE, (podcast_id,)) + cur.execute('SELECT COUNT(*), state, is_new FROM %s ' + 'WHERE podcast_id = ? GROUP BY state, is_new' + % self.TABLE_EPISODE, (podcast_id,)) else: - cur.execute('SELECT COUNT(*), state, is_new FROM %s GROUP BY state, is_new' % self.TABLE_EPISODE) + cur.execute('SELECT COUNT(*), state, is_new FROM %s ' + 'GROUP BY state, is_new' % self.TABLE_EPISODE) for count, state, is_new in cur: total += count if state == gpodder.STATE_DELETED: diff --git a/src/gpodder/gtkui/desktop/sync.py b/src/gpodder/gtkui/desktop/sync.py index c7727c85..2c3f5489 100644 --- a/src/gpodder/gtkui/desktop/sync.py +++ b/src/gpodder/gtkui/desktop/sync.py @@ -177,7 +177,9 @@ class gPodderSyncUI(object): self.commit_changes_to_database() for current_channel in self.channels: # only sync those channels marked for syncing - if (self._config.device_sync.device_type == 'filesystem' and current_channel.sync_to_mp3_player and self._config.device_sync.playlists.create): + if (self._config.device_sync.device_type == 'filesystem' + and current_channel.sync_to_mp3_player + and self._config.device_sync.playlists.create): # get playlist object playlist = gPodderDevicePlaylist(self._config, diff --git a/src/gpodder/gtkui/draw.py b/src/gpodder/gtkui/draw.py index 3b4530f2..0d8e12eb 100644 --- a/src/gpodder/gtkui/draw.py +++ b/src/gpodder/gtkui/draw.py @@ -306,7 +306,11 @@ def cairo_surface_to_pixbuf(s): # load. This happens in PyCairo < 1.1.6, see: # http://webcvs.cairographics.org/pycairo/NEWS?view=markup # Thanks to Chris Arnold for reporting this bug - bio.write('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A\n/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9cMEQkqIyxn3RkAAAAZdEVYdENv\nbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAADUlEQVQI12NgYGBgAAAABQABXvMqOgAAAABJ\nRU5ErkJggg==\n'.decode('base64')) + bio.write('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4' + 'c6QAAAAZiS0dEAP8A\n/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAA' + 'AAd0SU1FB9cMEQkqIyxn3RkAAAAZdEVYdENv\nbW1lbnQAQ3JlYXRlZCB3a' + 'XRoIEdJTVBXgQ4XAAAADUlEQVQI12NgYGBgAAAABQABXvMqOgAAAABJ\nRU' + '5ErkJggg==\n'.decode('base64')) pbl = GdkPixbuf.PixbufLoader() pbl.write(bio.getvalue()) diff --git a/src/gpodder/gtkui/main.py b/src/gpodder/gtkui/main.py index bbadf3b0..9258fbbd 100644 --- a/src/gpodder/gtkui/main.py +++ b/src/gpodder/gtkui/main.py @@ -1267,7 +1267,8 @@ class gPodder(BuilderWidget, dbus.service.Object): return self.download_list_update_enabled except Exception as e: logger.error('Exception happened while updating download list.', exc_info=True) - self.show_message('%s\n\n%s' % (_('Please report this problem and restart gPodder:'), str(e)), _('Unhandled exception'), important=True) + self.show_message('%s\n\n%s' % (_('Please report this problem and restart gPodder:'), + str(e)), _('Unhandled exception'), important=True) # We return False here, so the update loop won't be called again, # that's why we require the restart of gPodder in the message. return False @@ -1648,16 +1649,31 @@ class gPodder(BuilderWidget, dbus.service.Object): menu = Gtk.Menu() if can_force: - menu.append(make_menu_item(_('Start download now'), 'document-save', selected_tasks, download.DownloadTask.QUEUED, force_start=True)) + menu.append(make_menu_item(_('Start download now'), 'document-save', + selected_tasks, + download.DownloadTask.QUEUED, + force_start=True)) else: - menu.append(make_menu_item(_('Download'), 'document-save', selected_tasks, download.DownloadTask.QUEUED, can_queue)) - menu.append(make_menu_item(_('Cancel'), 'media-playback-stop', selected_tasks, download.DownloadTask.CANCELLED, can_cancel)) - menu.append(make_menu_item(_('Pause'), 'media-playback-pause', selected_tasks, download.DownloadTask.PAUSED, can_pause)) + menu.append(make_menu_item(_('Download'), 'document-save', + selected_tasks, + download.DownloadTask.QUEUED, + can_queue)) + + menu.append(make_menu_item(_('Cancel'), 'media-playback-stop', + selected_tasks, + download.DownloadTask.CANCELLED, + can_cancel)) + menu.append(make_menu_item(_('Pause'), 'media-playback-pause', + selected_tasks, + download.DownloadTask.PAUSED, can_pause)) menu.append(Gtk.SeparatorMenuItem()) - menu.append(make_menu_item(_('Move up'), 'go-up', action=move_selected_items_up)) - menu.append(make_menu_item(_('Move down'), 'go-down', action=move_selected_items_down)) + menu.append(make_menu_item(_('Move up'), 'go-up', + action=move_selected_items_up)) + menu.append(make_menu_item(_('Move down'), 'go-down', + action=move_selected_items_down)) menu.append(Gtk.SeparatorMenuItem()) - menu.append(make_menu_item(_('Remove from list'), 'list-remove', selected_tasks, sensitive=can_remove)) + menu.append(make_menu_item(_('Remove from list'), 'list-remove', + selected_tasks, sensitive=can_remove)) menu.attach_to_widget(treeview) menu.show_all() diff --git a/src/gpodder/opml.py b/src/gpodder/opml.py index 3157d0ba..ec29d085 100644 --- a/src/gpodder/opml.py +++ b/src/gpodder/opml.py @@ -80,9 +80,18 @@ class Importer(object): if outline.getAttribute('xmlUrl') or outline.getAttribute('url'): channel = { - 'url': outline.getAttribute('xmlUrl') or outline.getAttribute('url'), - 'title': outline.getAttribute('title') or outline.getAttribute('text') or outline.getAttribute('xmlUrl') or outline.getAttribute('url'), - 'description': outline.getAttribute('text') or outline.getAttribute('xmlUrl') or outline.getAttribute('url'), + 'url': + outline.getAttribute('xmlUrl') + or outline.getAttribute('url'), + 'title': + outline.getAttribute('title') + or outline.getAttribute('text') + or outline.getAttribute('xmlUrl') + or outline.getAttribute('url'), + 'description': + outline.getAttribute('text') + or outline.getAttribute('xmlUrl') + or outline.getAttribute('url'), } if channel['description'] == channel['title']: diff --git a/src/gpodder/sync.py b/src/gpodder/sync.py index c7abcff5..debe000a 100644 --- a/src/gpodder/sync.py +++ b/src/gpodder/sync.py @@ -853,7 +853,11 @@ class MTPDevice(Device): needed = util.calculate_size(filename) free = self.get_free_space() if needed > free: - logger.error('Not enough space on device %s: %s available, but need at least %s', self.get_name(), util.format_filesize(free), util.format_filesize(needed)) + logger.error('Not enough space on device %s: %s available, but ' + 'need at least %s', + self.get_name(), + util.format_filesize(free), + util.format_filesize(needed)) self.cancelled = True return False diff --git a/src/gpodder/util.py b/src/gpodder/util.py index 12a10a61..1c03bf5e 100644 --- a/src/gpodder/util.py +++ b/src/gpodder/util.py @@ -1998,8 +1998,11 @@ class Popen(subprocess.Popen): if gpodder.ui.win32 and kwargs['close_fds']: if [(k, v) for (k, v) in kwargs.items() if k in ('stdin', 'stdout', 'stderr') and v]: logger = logging.getLogger(__name__) - logger.error('util.Popen(close_fds=True) is incompatible with stream redirection on Windows.') - logger.error('With close_fds=False, the process keeps all currently open files locked. It might be tolerable for short-lived commands. Or use temp files.') + logger.error('util.Popen(close_fds=True) is incompatible with' + ' stream redirection on Windows.') + logger.error('With close_fds=False, the process keeps all ' + 'currently open files locked. It might be tolerable ' + 'for short-lived commands. Or use temp files.') raise e