Run autopep8

This was run with `--aggressive --aggressive` and then false positives were discarded
This commit is contained in:
pukkandan 2022-11-12 00:41:26 +05:30
commit e95a563ed0
No known key found for this signature in database
GPG key ID: 7EEE9E1E817D0A39
6 changed files with 13 additions and 8 deletions

View file

@ -429,5 +429,6 @@ class BuildHTTPRequestHandler(compat_http_server.BaseHTTPRequestHandler):
else: else:
self.send_response(500, 'Malformed URL') self.send_response(500, 'Malformed URL')
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View file

@ -40,8 +40,7 @@ now_iso = now.isoformat() + 'Z'
atom_template = atom_template.replace('@TIMESTAMP@', now_iso) atom_template = atom_template.replace('@TIMESTAMP@', now_iso)
versions_info = json.load(open('update/versions.json')) versions_info = json.load(open('update/versions.json'))
versions = list(versions_info['versions'].keys()) versions = sorted(versions_info['versions'].keys())
versions.sort()
entries = [] entries = []
for v in versions: for v in versions:

View file

@ -25,5 +25,6 @@ def main():
with io.open(outfile, 'w', encoding='utf-8') as outf: with io.open(outfile, 'w', encoding='utf-8') as outf:
outf.write(out) outf.write(out)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View file

@ -83,6 +83,7 @@ else:
else: else:
params['scripts'] = ['bin/youtube-dl'] params['scripts'] = ['bin/youtube-dl']
class build_lazy_extractors(Command): class build_lazy_extractors(Command):
description = 'Build the extractor lazy loading module' description = 'Build the extractor lazy loading module'
user_options = [] user_options = []
@ -99,6 +100,7 @@ class build_lazy_extractors(Command):
dry_run=self.dry_run, dry_run=self.dry_run,
) )
setup( setup(
name='youtube_dl', name='youtube_dl',
version=__version__, version=__version__,

View file

@ -2684,7 +2684,7 @@ except (AssertionError, UnicodeEncodeError):
def compat_ord(c): def compat_ord(c):
if type(c) is int: if isinstance(c, int):
return c return c
else: else:
return ord(c) return ord(c)

View file

@ -2006,6 +2006,7 @@ def get_elements_by_attribute(attribute, value, html, escape_value=True):
class HTMLAttributeParser(compat_HTMLParser): class HTMLAttributeParser(compat_HTMLParser):
"""Trivial HTML parser to gather the attributes for a single element""" """Trivial HTML parser to gather the attributes for a single element"""
def __init__(self): def __init__(self):
self.attrs = {} self.attrs = {}
compat_HTMLParser.__init__(self) compat_HTMLParser.__init__(self)
@ -2230,7 +2231,7 @@ def _htmlentity_transform(entity_with_semicolon):
def unescapeHTML(s): def unescapeHTML(s):
if s is None: if s is None:
return None return None
assert type(s) == compat_str assert isinstance(s, compat_str)
return re.sub( return re.sub(
r'&([^&;]+;)', lambda m: _htmlentity_transform(m.group(1)), s) r'&([^&;]+;)', lambda m: _htmlentity_transform(m.group(1)), s)
@ -2262,7 +2263,7 @@ def encodeFilename(s, for_subprocess=False):
@param s The name of the file @param s The name of the file
""" """
assert type(s) == compat_str assert isinstance(s, compat_str)
# Python 3 has a Unicode API # Python 3 has a Unicode API
if sys.version_info >= (3, 0): if sys.version_info >= (3, 0):
@ -2431,6 +2432,7 @@ class GeoRestrictedError(ExtractorError):
This exception may be thrown when a video is not available from your This exception may be thrown when a video is not available from your
geographic location due to geographic restrictions imposed by a website. geographic location due to geographic restrictions imposed by a website.
""" """
def __init__(self, msg, countries=None): def __init__(self, msg, countries=None):
super(GeoRestrictedError, self).__init__(msg, expected=True) super(GeoRestrictedError, self).__init__(msg, expected=True)
self.msg = msg self.msg = msg
@ -3278,7 +3280,7 @@ def _windows_write_string(s, out):
def write_string(s, out=None, encoding=None): def write_string(s, out=None, encoding=None):
if out is None: if out is None:
out = sys.stderr out = sys.stderr
assert type(s) == compat_str assert isinstance(s, compat_str)
if sys.platform == 'win32' and encoding is None and hasattr(out, 'fileno'): if sys.platform == 'win32' and encoding is None and hasattr(out, 'fileno'):
if _windows_write_string(s, out): if _windows_write_string(s, out):
@ -3456,7 +3458,7 @@ def unsmuggle_url(smug_url, default=None):
def format_bytes(bytes): def format_bytes(bytes):
if bytes is None: if bytes is None:
return 'N/A' return 'N/A'
if type(bytes) is str: if isinstance(bytes, str):
bytes = float(bytes) bytes = float(bytes)
if bytes == 0.0: if bytes == 0.0:
exponent = 0 exponent = 0