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
|
@ -336,7 +336,7 @@ class YoutubeDLBuilder(object):
|
||||||
try:
|
try:
|
||||||
proc = subprocess.Popen([os.path.join(self.pythonPath, 'python.exe'), 'setup.py', 'py2exe'], stdin=subprocess.PIPE, cwd=self.buildPath)
|
proc = subprocess.Popen([os.path.join(self.pythonPath, 'python.exe'), 'setup.py', 'py2exe'], stdin=subprocess.PIPE, cwd=self.buildPath)
|
||||||
proc.wait()
|
proc.wait()
|
||||||
#subprocess.check_output([os.path.join(self.pythonPath, 'python.exe'), 'setup.py', 'py2exe'],
|
# subprocess.check_output([os.path.join(self.pythonPath, 'python.exe'), 'setup.py', 'py2exe'],
|
||||||
# cwd=self.buildPath)
|
# cwd=self.buildPath)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
raise BuildError(e.output)
|
raise BuildError(e.output)
|
||||||
|
@ -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()
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -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()
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -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__,
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue