Fix linter issues for pycodestyle 2.11.0.

This commit is contained in:
auouymous 2023-08-07 19:46:44 -06:00
parent a077b54082
commit 839b0b2aa5
5 changed files with 8 additions and 5 deletions

View File

@ -68,7 +68,10 @@ unittest:
ISORTOPTS := -c share src/gpodder tools bin/* *.py
lint:
pycodestyle --version
pycodestyle share src/gpodder tools bin/* *.py
isort --version
isort -q $(ISORTOPTS) || isort --df $(ISORTOPTS)
release: distclean

View File

@ -109,7 +109,7 @@ class YoutubeCustomDownload(download.CustomDownload):
outtmpl = tempname.replace('%', '%%')
info, opts = self._ytdl.fetch_info(self._url, outtmpl, self._my_hook)
if program_name == 'yt-dlp':
default = opts['outtmpl']['default'] if type(opts['outtmpl']) == dict else opts['outtmpl']
default = opts['outtmpl']['default'] if isinstance(opts['outtmpl'], dict) else opts['outtmpl']
self.partial_filename = os.path.join(opts['paths']['home'], default) % info
elif program_name == 'youtube-dl':
self.partial_filename = opts['outtmpl'] % info
@ -463,7 +463,7 @@ class gPodderYoutubeDL(download.CustomDownloader):
with youtube_dl.YoutubeDL(self._ydl_opts) as ydl:
# youtube-dl returns a list, yt-dlp returns a dict
ies = ydl._ies
if type(ydl._ies) == dict:
if isinstance(ydl._ies, dict):
ies = ydl._ies.values()
for ie in ies:
if ie.suitable(url) and ie.ie_key() not in self.ie_blacklist:

View File

@ -154,7 +154,7 @@ class ProgressIndicator(object):
self.tick_counter += 1
if time.time() >= self.next_update or (final and self.dialog):
if type(final) == str:
if isinstance(final, str):
self.on_message(final)
self.on_progress(1.0)
elif self.max_ticks is not None:

View File

@ -161,7 +161,7 @@ class JsonConfig(object):
work_queue.append((data[key], value))
elif type(value) != type(data[key]): # noqa
# Type mismatch of current value and default
if type(value) == int and type(data[key]) == float:
if isinstance(value, int) and isinstance(data[key], float):
# Convert float to int if default value is int
data[key] = int(data[key])

View File

@ -66,7 +66,7 @@ class Resolver(object):
def unregister_instance(self, klass):
logger.debug('Unregistering {} resolver instance: {}'.format(self._name, klass))
self._resolvers = [r for r in self._resolvers if type(r) != klass]
self._resolvers = [r for r in self._resolvers if not isinstance(r, klass)]
def _info(self, resolver):
return '%s from %s' % (resolver.__name__ if hasattr(resolver, '__name__')