mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2025-08-22 22:34:01 -07:00
Run autopep8
This was run with `--aggressive --aggressive` and then false positives were discarded
This commit is contained in:
parent
acc5f02f0a
commit
e95a563ed0
6 changed files with 13 additions and 8 deletions
|
@ -429,5 +429,6 @@ class BuildHTTPRequestHandler(compat_http_server.BaseHTTPRequestHandler):
|
|||
else:
|
||||
self.send_response(500, 'Malformed URL')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -40,8 +40,7 @@ now_iso = now.isoformat() + 'Z'
|
|||
atom_template = atom_template.replace('@TIMESTAMP@', now_iso)
|
||||
|
||||
versions_info = json.load(open('update/versions.json'))
|
||||
versions = list(versions_info['versions'].keys())
|
||||
versions.sort()
|
||||
versions = sorted(versions_info['versions'].keys())
|
||||
|
||||
entries = []
|
||||
for v in versions:
|
||||
|
|
|
@ -25,5 +25,6 @@ def main():
|
|||
with io.open(outfile, 'w', encoding='utf-8') as outf:
|
||||
outf.write(out)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
2
setup.py
2
setup.py
|
@ -83,6 +83,7 @@ else:
|
|||
else:
|
||||
params['scripts'] = ['bin/youtube-dl']
|
||||
|
||||
|
||||
class build_lazy_extractors(Command):
|
||||
description = 'Build the extractor lazy loading module'
|
||||
user_options = []
|
||||
|
@ -99,6 +100,7 @@ class build_lazy_extractors(Command):
|
|||
dry_run=self.dry_run,
|
||||
)
|
||||
|
||||
|
||||
setup(
|
||||
name='youtube_dl',
|
||||
version=__version__,
|
||||
|
|
|
@ -2684,7 +2684,7 @@ except (AssertionError, UnicodeEncodeError):
|
|||
|
||||
|
||||
def compat_ord(c):
|
||||
if type(c) is int:
|
||||
if isinstance(c, int):
|
||||
return c
|
||||
else:
|
||||
return ord(c)
|
||||
|
|
|
@ -2006,6 +2006,7 @@ def get_elements_by_attribute(attribute, value, html, escape_value=True):
|
|||
|
||||
class HTMLAttributeParser(compat_HTMLParser):
|
||||
"""Trivial HTML parser to gather the attributes for a single element"""
|
||||
|
||||
def __init__(self):
|
||||
self.attrs = {}
|
||||
compat_HTMLParser.__init__(self)
|
||||
|
@ -2230,7 +2231,7 @@ def _htmlentity_transform(entity_with_semicolon):
|
|||
def unescapeHTML(s):
|
||||
if s is None:
|
||||
return None
|
||||
assert type(s) == compat_str
|
||||
assert isinstance(s, compat_str)
|
||||
|
||||
return re.sub(
|
||||
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
|
||||
"""
|
||||
|
||||
assert type(s) == compat_str
|
||||
assert isinstance(s, compat_str)
|
||||
|
||||
# Python 3 has a Unicode API
|
||||
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
|
||||
geographic location due to geographic restrictions imposed by a website.
|
||||
"""
|
||||
|
||||
def __init__(self, msg, countries=None):
|
||||
super(GeoRestrictedError, self).__init__(msg, expected=True)
|
||||
self.msg = msg
|
||||
|
@ -3278,7 +3280,7 @@ def _windows_write_string(s, out):
|
|||
def write_string(s, out=None, encoding=None):
|
||||
if out is None:
|
||||
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 _windows_write_string(s, out):
|
||||
|
@ -3456,7 +3458,7 @@ def unsmuggle_url(smug_url, default=None):
|
|||
def format_bytes(bytes):
|
||||
if bytes is None:
|
||||
return 'N/A'
|
||||
if type(bytes) is str:
|
||||
if isinstance(bytes, str):
|
||||
bytes = float(bytes)
|
||||
if bytes == 0.0:
|
||||
exponent = 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue