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:
import dbus
from dbus.mainloop.glib import DBusGMainLoop
have_dbus = True
except ImportError:
print("""

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -44,11 +44,6 @@ import tempfile
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__)
_ = gpodder.gettext

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -22,7 +22,6 @@ Based on SimpleGladeApp.py Copyright (C) 2004 Sandino Flores Moreno
import os
import re
import sys
import tokenize
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.
At this moment, the widgets are loaded and can be refered as self.widget_name
"""
pass
def main(self):
"""
@ -149,4 +147,3 @@ class GtkBuilderWidget(object):
This method is called by the default implementation of run()
after a program is finished by pressing Control-C.
"""
pass

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -34,8 +34,7 @@ import requests.exceptions
import urllib3.exceptions
import gpodder
from gpodder import (common, download, extensions, feedcore, my, opml, player,
util, youtube)
from gpodder import common, download, feedcore, my, opml, player, util, youtube
from gpodder.dbusproxy import DBusPodcastsProxy
from gpodder.model import Model, PodcastEpisode
from gpodder.syncui import gPodderSyncUI
@ -59,7 +58,7 @@ from .services import CoverDownloader
import gi # 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__)

View File

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

View File

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

View File

@ -23,9 +23,8 @@
# 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):

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -20,7 +20,7 @@
import ctypes
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)
from uuid import UUID

View File

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

View File

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

View File

@ -21,7 +21,7 @@ import io
import pytest
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):

View File

@ -5,7 +5,6 @@
import os
import sys
import gi
from gi.repository import GLib
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):
def __init__(self, *args, **kwargs):
self.fake = True
pass
def add_signal_receiver(self, *args, **kwargs):
pass

View File

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

View File

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