Remove unused imports and pass statements

Fixes flake8 error F401.
Most errors were fixed by running

autoflake -i -r --remove-all-unused-imports .

which also removes unnecessary 'pass' statements, some by hand-editing.
This commit is contained in:
Teemu Ikonen 2022-09-06 22:42:46 +03:00
parent 80cec0d024
commit 6bd0bb0530
41 changed files with 10 additions and 97 deletions

View File

@ -39,7 +39,6 @@ logger = logging.getLogger(__name__)
try: try:
import dbus import dbus
from dbus.mainloop.glib import DBusGMainLoop
have_dbus = True have_dbus = True
except ImportError: except ImportError:
print(""" print("""

View File

@ -26,7 +26,6 @@
import configparser import configparser
import os import os
import re
import shutil import shutil
import sys import sys

View File

@ -18,7 +18,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import glob
import os import os
import re import re
import sys import sys

View File

@ -6,7 +6,6 @@
import datetime import datetime
import logging import logging
import os import os
import subprocess
import gpodder import gpodder
from gpodder import util from gpodder import util

View File

@ -5,7 +5,6 @@
import logging import logging
import os import os
import subprocess
from gi.repository import Gtk from gi.repository import Gtk

View File

@ -5,7 +5,6 @@
# Released under the same license terms as gPodder itself. # Released under the same license terms as gPodder itself.
import functools import functools
import logging import logging
import subprocess
import gpodder import gpodder
from gpodder import util from gpodder import util

View File

@ -44,11 +44,6 @@ import tempfile
import gpodder import gpodder
import gi # isort:skip
gi.require_version('Gtk', '3.0') # isort:skip
from gi.repository import Gtk # isort:skip
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
_ = gpodder.gettext _ = gpodder.gettext

View File

@ -26,7 +26,6 @@ import base64
import datetime import datetime
import logging import logging
import mimetypes import mimetypes
import os
from mutagen import File from mutagen import File
from mutagen.easyid3 import EasyID3 from mutagen.easyid3 import EasyID3

View File

@ -32,6 +32,7 @@ from comtypes import COMMETHOD, GUID, IUnknown, client, wireHWND
import gpodder import gpodder
import gi # isort:skip import gi # isort:skip
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk # isort:skip from gi.repository import Gtk # isort:skip

View File

@ -4,12 +4,8 @@
# Thomas Perl <thp@gpodder.org>; 2012-02-06 # Thomas Perl <thp@gpodder.org>; 2012-02-06
import logging import logging
import os
import subprocess
import sys
import gpodder import gpodder
from gpodder import util
import gi # isort:skip import gi # isort:skip
gi.require_version('Unity', '7.0') # isort:skip gi.require_version('Unity', '7.0') # isort:skip

View File

@ -11,7 +11,7 @@ import os
import subprocess import subprocess
import gpodder import gpodder
from gpodder import util, youtube from gpodder import util
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -25,8 +25,6 @@
# #
import logging import logging
import re
import sys
import threading import threading
from sqlite3 import dbapi2 as sqlite from sqlite3 import dbapi2 as sqlite

View File

@ -23,8 +23,6 @@
# Thomas Perl <thp@gpodder.org>; 2014-10-22 # Thomas Perl <thp@gpodder.org>; 2014-10-22
# #
import json
import os
import urllib.error import urllib.error
import urllib.parse import urllib.parse
import urllib.request import urllib.request

View File

@ -25,15 +25,12 @@
# Based on libwget.py (2005-10-29) # Based on libwget.py (2005-10-29)
# #
import collections
import email
import glob import glob
import logging import logging
import mimetypes import mimetypes
import os import os
import os.path import os.path
import shutil import shutil
import socket
import threading import threading
import time import time
import urllib.error import urllib.error

View File

@ -32,15 +32,9 @@ For an example extension see share/gpodder/examples/extensions.py
import functools import functools
import glob import glob
import imp import imp
import inspect
import json
import logging import logging
import os import os
import re import re
import shlex
import subprocess
import sys
from datetime import datetime
import gpodder import gpodder
from gpodder import util from gpodder import util
@ -414,7 +408,6 @@ class ExtensionManager(object):
@param update_podcast_callback: Function to update a podcast feed @param update_podcast_callback: Function to update a podcast feed
@param download_episode_callback: Function to download an episode @param download_episode_callback: Function to download an episode
""" """
pass
@call_extensions @call_extensions
def on_podcast_subscribe(self, podcast): def on_podcast_subscribe(self, podcast):
@ -422,7 +415,6 @@ class ExtensionManager(object):
@param podcast: A gpodder.model.PodcastChannel instance @param podcast: A gpodder.model.PodcastChannel instance
""" """
pass
@call_extensions @call_extensions
def on_podcast_updated(self, podcast): def on_podcast_updated(self, podcast):
@ -432,7 +424,6 @@ class ExtensionManager(object):
@param podcast: A gpodder.model.PodcastChannel instance @param podcast: A gpodder.model.PodcastChannel instance
""" """
pass
@call_extensions @call_extensions
def on_podcast_update_failed(self, podcast, exception): def on_podcast_update_failed(self, podcast, exception):
@ -442,7 +433,6 @@ class ExtensionManager(object):
@param exception: The reason. @param exception: The reason.
""" """
pass
@call_extensions @call_extensions
def on_podcast_save(self, podcast): def on_podcast_save(self, podcast):
@ -453,7 +443,6 @@ class ExtensionManager(object):
@param podcast: A gpodder.model.PodcastChannel instance @param podcast: A gpodder.model.PodcastChannel instance
""" """
pass
@call_extensions @call_extensions
def on_podcast_delete(self, podcast): def on_podcast_delete(self, podcast):
@ -461,7 +450,6 @@ class ExtensionManager(object):
@param podcast: A gpodder.model.PodcastChannel instance @param podcast: A gpodder.model.PodcastChannel instance
""" """
pass
@call_extensions @call_extensions
def on_episode_playback(self, episode): def on_episode_playback(self, episode):
@ -472,7 +460,6 @@ class ExtensionManager(object):
@param episode: A gpodder.model.PodcastEpisode instance @param episode: A gpodder.model.PodcastEpisode instance
""" """
pass
@call_extensions @call_extensions
def on_episode_save(self, episode): def on_episode_save(self, episode):
@ -483,7 +470,6 @@ class ExtensionManager(object):
@param episode: A gpodder.model.PodcastEpisode instance @param episode: A gpodder.model.PodcastEpisode instance
""" """
pass
@call_extensions @call_extensions
def on_episode_downloaded(self, episode): def on_episode_downloaded(self, episode):
@ -493,13 +479,11 @@ class ExtensionManager(object):
@param episode: A gpodder.model.PodcastEpisode instance @param episode: A gpodder.model.PodcastEpisode instance
""" """
pass
@call_extensions @call_extensions
def on_all_episodes_downloaded(self): def on_all_episodes_downloaded(self):
"""Called when all episodes has been downloaded """Called when all episodes has been downloaded
""" """
pass
@call_extensions @call_extensions
def on_episode_synced(self, device, episode): def on_episode_synced(self, device, episode):
@ -515,7 +499,6 @@ class ExtensionManager(object):
@param device: A gpodder.sync.Device instance @param device: A gpodder.sync.Device instance
@param episode: A gpodder.model.PodcastEpisode instance @param episode: A gpodder.model.PodcastEpisode instance
""" """
pass
@call_extensions @call_extensions
def on_create_menu(self): def on_create_menu(self):
@ -529,7 +512,6 @@ class ExtensionManager(object):
[('Sync to Smartphone', lambda : ...)] [('Sync to Smartphone', lambda : ...)]
""" """
pass
@call_extensions @call_extensions
def on_episodes_context_menu(self, episodes): def on_episodes_context_menu(self, episodes):
@ -546,7 +528,6 @@ class ExtensionManager(object):
@param episodes: A list of gpodder.model.PodcastEpisode instances @param episodes: A list of gpodder.model.PodcastEpisode instances
""" """
pass
@call_extensions @call_extensions
def on_channel_context_menu(self, channel): def on_channel_context_menu(self, channel):
@ -561,13 +542,11 @@ class ExtensionManager(object):
[('Update channel', lambda channel: ...)] [('Update channel', lambda channel: ...)]
@param channel: A gpodder.model.PodcastChannel instance @param channel: A gpodder.model.PodcastChannel instance
""" """
pass
@call_extensions @call_extensions
def on_episode_delete(self, episode, filename): def on_episode_delete(self, episode, filename):
"""Called just before the episode's disk file is about to be """Called just before the episode's disk file is about to be
deleted.""" deleted."""
pass
@call_extensions @call_extensions
def on_episode_removed_from_podcast(self, episode): def on_episode_removed_from_podcast(self, episode):
@ -577,7 +556,6 @@ class ExtensionManager(object):
@param podcast: A gpodder.model.PodcastChannel instance @param podcast: A gpodder.model.PodcastChannel instance
""" """
pass
@call_extensions @call_extensions
def on_notification_show(self, title, message): def on_notification_show(self, title, message):
@ -586,7 +564,6 @@ class ExtensionManager(object):
@param title: title of the notification @param title: title of the notification
@param message: message of the notification @param message: message of the notification
""" """
pass
@call_extensions @call_extensions
def on_download_progress(self, progress): def on_download_progress(self, progress):
@ -594,7 +571,6 @@ class ExtensionManager(object):
@param progress: The current progress value (0..1) @param progress: The current progress value (0..1)
""" """
pass
@call_extensions @call_extensions
def on_ui_object_available(self, name, ui_object): def on_ui_object_available(self, name, ui_object):
@ -606,7 +582,6 @@ class ExtensionManager(object):
@param name: The name/ID of the object @param name: The name/ID of the object
@param ui_object: The object itself @param ui_object: The object itself
""" """
pass
@call_extensions @call_extensions
def on_application_started(self): def on_application_started(self):
@ -619,7 +594,6 @@ class ExtensionManager(object):
It is called after on_ui_object_available and on_ui_initialized. It is called after on_ui_object_available and on_ui_initialized.
""" """
pass
@call_extensions @call_extensions
def on_find_partial_downloads_done(self): def on_find_partial_downloads_done(self):
@ -630,7 +604,6 @@ class ExtensionManager(object):
It is called after on_application_started. It is called after on_application_started.
""" """
pass
@call_extensions @call_extensions
def on_preferences(self): def on_preferences(self):
@ -644,7 +617,6 @@ class ExtensionManager(object):
[('Tab name', lambda: ...)] [('Tab name', lambda: ...)]
""" """
pass
@call_extensions @call_extensions
def on_channel_settings(self, channel): def on_channel_settings(self, channel):
@ -661,4 +633,3 @@ class ExtensionManager(object):
@param channel: A gpodder.model.PodcastChannel instance @param channel: A gpodder.model.PodcastChannel instance
""" """
pass

View File

@ -27,8 +27,6 @@ import urllib.parse
from html.parser import HTMLParser from html.parser import HTMLParser
from io import BytesIO from io import BytesIO
from requests.exceptions import RequestException
from gpodder import util, youtube from gpodder import util, youtube
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -22,7 +22,6 @@ Based on SimpleGladeApp.py Copyright (C) 2004 Sandino Flores Moreno
import os import os
import re import re
import sys
import tokenize import tokenize
from gi.repository import Gtk from gi.repository import Gtk
@ -103,7 +102,6 @@ class GtkBuilderWidget(object):
Method called when the user interface is loaded and ready to be used. Method called when the user interface is loaded and ready to be used.
At this moment, the widgets are loaded and can be refered as self.widget_name At this moment, the widgets are loaded and can be refered as self.widget_name
""" """
pass
def main(self): def main(self):
""" """
@ -149,4 +147,3 @@ class GtkBuilderWidget(object):
This method is called by the default implementation of run() This method is called by the default implementation of run()
after a program is finished by pressing Control-C. after a program is finished by pressing Control-C.
""" """
pass

View File

@ -18,10 +18,7 @@
# #
import os import os
from gi.repository import Gtk, Pango
import gpodder import gpodder
from gpodder import util
from gpodder.gtkui.interface.common import BuilderWidget from gpodder.gtkui.interface.common import BuilderWidget
_ = gpodder.gettext _ = gpodder.gettext

View File

@ -19,7 +19,6 @@
import html import html
import logging import logging
import urllib.parse
from gi.repository import Gdk, Gtk, Pango from gi.repository import Gdk, Gtk, Pango

View File

@ -169,7 +169,6 @@ class UserAppsReader(object):
self.__has_read = True self.__has_read = True
if gpodder.ui.win32: if gpodder.ui.win32:
import winreg
for caption, types, hkey in WIN32_APP_REG_KEYS: for caption, types, hkey in WIN32_APP_REG_KEYS:
try: try:
cmdline = win32_read_registry_key(hkey) cmdline = win32_read_registry_key(hkey)

View File

@ -28,8 +28,6 @@ import math
import cairo import cairo
import gpodder
import gi # isort:skip import gi # isort:skip
gi.require_version('Gdk', '3.0') # isort:skip gi.require_version('Gdk', '3.0') # isort:skip
gi.require_version('Gtk', '3.0') # isort:skip gi.require_version('Gtk', '3.0') # isort:skip

View File

@ -18,7 +18,6 @@
# #
import os import os
import shutil
from gi.repository import Gdk, Gtk from gi.repository import Gdk, Gtk

View File

@ -34,8 +34,7 @@ import requests.exceptions
import urllib3.exceptions import urllib3.exceptions
import gpodder import gpodder
from gpodder import (common, download, extensions, feedcore, my, opml, player, from gpodder import common, download, feedcore, my, opml, player, util, youtube
util, youtube)
from gpodder.dbusproxy import DBusPodcastsProxy from gpodder.dbusproxy import DBusPodcastsProxy
from gpodder.model import Model, PodcastEpisode from gpodder.model import Model, PodcastEpisode
from gpodder.syncui import gPodderSyncUI from gpodder.syncui import gPodderSyncUI
@ -59,7 +58,7 @@ from .services import CoverDownloader
import gi # isort:skip import gi # isort:skip
gi.require_version('Gtk', '3.0') # isort:skip gi.require_version('Gtk', '3.0') # isort:skip
from gi.repository import Gdk, GdkPixbuf, Gio, GLib, Gtk, Pango # isort:skip from gi.repository import Gdk, Gio, GLib, Gtk, Pango # isort:skip
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -25,7 +25,7 @@
import logging import logging
from gi.repository import GdkPixbuf, Gtk from gi.repository import GdkPixbuf
import gpodder import gpodder
from gpodder import coverart, util from gpodder import coverart, util

View File

@ -18,7 +18,6 @@
# #
import html import html
import logging import logging
import re
from urllib.parse import urlparse from urllib.parse import urlparse
import gpodder import gpodder

View File

@ -23,9 +23,8 @@
# Thomas Perl <thp@gpodder.org> 2009-03-31 # Thomas Perl <thp@gpodder.org> 2009-03-31
# #
import html
from gi.repository import Gdk, GObject, Gtk, Pango from gi.repository import Gtk
class SpinningProgressIndicator(Gtk.Image): class SpinningProgressIndicator(Gtk.Image):

View File

@ -28,7 +28,6 @@
import ctypes import ctypes
import logging import logging
import os import os
import struct
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -24,7 +24,6 @@
# Based on libpodcasts.py (thp, 2005-10-29) # Based on libpodcasts.py (thp, 2005-10-29)
# #
import collections
import datetime import datetime
import glob import glob
import hashlib import hashlib

View File

@ -38,7 +38,6 @@ import io
import logging import logging
import os import os
import os.path import os.path
import shutil
import xml.dom.minidom import xml.dom.minidom
from email.utils import formatdate from email.utils import formatdate

View File

@ -20,7 +20,6 @@
# Soundcloud.com API client module for gPodder # Soundcloud.com API client module for gPodder
# Thomas Perl <thp@gpodder.org>; 2009-11-03 # Thomas Perl <thp@gpodder.org>; 2009-11-03
import email
import json import json
import logging import logging
import os import os

View File

@ -23,15 +23,10 @@
# based on libipodsync.py (2006-04-05 Thomas Perl) # based on libipodsync.py (2006-04-05 Thomas Perl)
# Ported to gPodder 3 by Joseph Wickremasinghe in June 2012 # Ported to gPodder 3 by Joseph Wickremasinghe in June 2012
import calendar
import glob
import logging import logging
import os.path import os.path
import threading import threading
import time import time
from enum import Enum
from re import S
from urllib.parse import urlparse
import gpodder import gpodder
from gpodder import download, services, util from gpodder import download, services, util

View File

@ -22,7 +22,6 @@
# Ported to gPodder 3 by Joseph Wickremasinghe in June 2012 # Ported to gPodder 3 by Joseph Wickremasinghe in June 2012
import logging import logging
import os
import gpodder import gpodder
from gpodder import sync, util from gpodder import sync, util

View File

@ -33,11 +33,8 @@ import collections
import datetime import datetime
import email import email
import glob import glob
import gzip
import http.client import http.client
import io
import itertools import itertools
import json
import locale import locale
import logging import logging
import mimetypes import mimetypes
@ -57,7 +54,6 @@ import time
import urllib.error import urllib.error
import urllib.parse import urllib.parse
import webbrowser import webbrowser
import xml.dom.minidom
from html.entities import entitydefs, name2codepoint from html.entities import entitydefs, name2codepoint
from html.parser import HTMLParser from html.parser import HTMLParser
@ -2373,7 +2369,6 @@ def mount_volume_for_file(file, op=None):
def scale_pixbuf(pixbuf, max): def scale_pixbuf(pixbuf, max):
import gi
from gi.repository import GdkPixbuf from gi.repository import GdkPixbuf
w_cur = pixbuf.get_width() w_cur = pixbuf.get_width()

View File

@ -20,7 +20,7 @@
import ctypes import ctypes
from ctypes import HRESULT, Structure, byref, c_ulonglong from ctypes import HRESULT, Structure, byref, c_ulonglong
from ctypes.wintypes import (BOOL, BYTE, DWORD, HANDLE, LPCWSTR, MAX_PATH, from ctypes.wintypes import (BOOL, BYTE, DWORD, HANDLE, LPCWSTR,
PULARGE_INTEGER, WORD) PULARGE_INTEGER, WORD)
from uuid import UUID from uuid import UUID

View File

@ -23,7 +23,6 @@
# #
import json
import logging import logging
import re import re

View File

@ -23,7 +23,6 @@
import unittest import unittest
import gpodder
from gpodder import model from gpodder import model

View File

@ -21,7 +21,7 @@ import io
import pytest import pytest
import requests.exceptions import requests.exceptions
from gpodder.feedcore import Fetcher, Result, NEW_LOCATION, NOT_MODIFIED, UPDATED_FEED from gpodder.feedcore import Fetcher, NEW_LOCATION, Result, UPDATED_FEED
class MyFetcher(Fetcher): class MyFetcher(Fetcher):

View File

@ -5,7 +5,6 @@
import os import os
import sys import sys
import gi
from gi.repository import GLib from gi.repository import GLib
BASE = os.path.normpath(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) BASE = os.path.normpath(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))

View File

@ -1,10 +1,9 @@
import dbus.exceptions import dbus.exceptions # noqa: F401
class SessionBus(object): class SessionBus(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.fake = True self.fake = True
pass
def add_signal_receiver(self, *args, **kwargs): def add_signal_receiver(self, *args, **kwargs):
pass pass

View File

@ -10,7 +10,6 @@ import math
import os import os
import re import re
import subprocess import subprocess
import sys
width = 40 width = 40

View File

@ -7,7 +7,7 @@ import subprocess
import sys import sys
import time import time
import traceback import traceback
from os.path import dirname, expanduser, join from os.path import join
from subprocess import PIPE, CalledProcessError, Popen from subprocess import PIPE, CalledProcessError, Popen