Skip to content

Commit 582be35

Browse files
committed
Update coding style after pycodestyle 2.1.0
In pycodestyle 2.1.0, E305 was introduced, which requires two blank lines after top level declarations, too. See PyCQA/pycodestyle#400 See also #10689; thanks @stepshal for first mentioning this issue and initial patches
1 parent 073d5bf commit 582be35

27 files changed

+33
-0
lines changed

devscripts/bash-completion.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ def build_completion(opt_parser):
2525
filled_template = template.replace("{{flags}}", " ".join(opts_flag))
2626
f.write(filled_template)
2727

28+
2829
parser = youtube_dl.parseOpts()[0]
2930
build_completion(parser)

devscripts/fish-completion.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@ def build_completion(opt_parser):
4444
with open(FISH_COMPLETION_FILE, 'w') as f:
4545
f.write(filled_template)
4646

47+
4748
parser = youtube_dl.parseOpts()[0]
4849
build_completion(parser)

devscripts/generate_aes_testdata.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def openssl_encode(algo, key, iv):
2323
out, _ = prog.communicate(secret_msg)
2424
return out
2525

26+
2627
iv = key = [0x20, 0x15] + 14 * [0]
2728

2829
r = openssl_encode('aes-128-cbc', key, iv)

devscripts/gh-pages/update-sites.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@ def main():
3232
with open('supportedsites.html', 'w', encoding='utf-8') as sitesf:
3333
sitesf.write(template)
3434

35+
3536
if __name__ == '__main__':
3637
main()

devscripts/make_contributing.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@ def main():
2828
with io.open(outfile, 'w', encoding='utf-8') as outf:
2929
outf.write(out)
3030

31+
3132
if __name__ == '__main__':
3233
main()

devscripts/make_lazy_extractors.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def build_lazy_ie(ie, name):
5959
s += make_valid_template.format(valid_url=ie._make_valid_url())
6060
return s
6161

62+
6263
# find the correct sorting and add the required base classes so that sublcasses
6364
# can be correctly created
6465
classes = _ALL_CLASSES[:-1]

devscripts/make_supportedsites.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,6 @@ def gen_ies_md(ies):
4141
with io.open(outfile, 'w', encoding='utf-8') as outf:
4242
outf.write(out)
4343

44+
4445
if __name__ == '__main__':
4546
main()

devscripts/prepare_manpage.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,6 @@ def filter_options(readme):
7474

7575
return ret
7676

77+
7778
if __name__ == '__main__':
7879
main()

devscripts/zsh-completion.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@ def build_completion(opt_parser):
4444
with open(ZSH_COMPLETION_FILE, "w") as f:
4545
f.write(template)
4646

47+
4748
parser = youtube_dl.parseOpts()[0]
4849
build_completion(parser)

test/test_InfoExtractor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,6 @@ def test_download_json(self):
8484
self.assertRaises(ExtractorError, self.ie._download_json, uri, None)
8585
self.assertEqual(self.ie._download_json(uri, None, fatal=False), None)
8686

87+
8788
if __name__ == '__main__':
8889
unittest.main()

test/test_aes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,6 @@ def test_decrypt_text(self):
5151
decrypted = (aes_decrypt_text(encrypted, password, 32))
5252
self.assertEqual(decrypted, self.secret_msg)
5353

54+
5455
if __name__ == '__main__':
5556
unittest.main()

test/test_download.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def _file_md5(fn):
6060
with open(fn, 'rb') as f:
6161
return hashlib.md5(f.read()).hexdigest()
6262

63+
6364
defs = gettestcases()
6465

6566

@@ -217,6 +218,7 @@ def try_rm_tcs_files(tcs=None):
217218

218219
return test_template
219220

221+
220222
# And add them to TestDownload
221223
for n, test_case in enumerate(defs):
222224
test_method = generator(test_case)

test/test_execution.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,6 @@ def test_cmdline_umlauts(self):
3939
_, stderr = p.communicate()
4040
self.assertFalse(stderr)
4141

42+
4243
if __name__ == '__main__':
4344
unittest.main()

test/test_http.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,5 +169,6 @@ def test_proxy_with_idn(self):
169169
# b'xn--fiq228c' is '中文'.encode('idna')
170170
self.assertEqual(response, 'normal: http://xn--fiq228c.tw/')
171171

172+
172173
if __name__ == '__main__':
173174
unittest.main()

test/test_iqiyi_sdk_interpreter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,6 @@ def test_iqiyi_sdk_interpreter(self):
4343
ie._login()
4444
self.assertTrue('unable to log in:' in logger.messages[0])
4545

46+
4647
if __name__ == '__main__':
4748
unittest.main()

test/test_jsinterp.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,6 @@ def test_call(self):
112112
''')
113113
self.assertEqual(jsi.call_function('z'), 5)
114114

115+
115116
if __name__ == '__main__':
116117
unittest.main()

test/test_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,5 +1075,6 @@ def test_get_element_by_class(self):
10751075
self.assertEqual(get_element_by_class('foo', html), 'nice')
10761076
self.assertEqual(get_element_by_class('no-such-class', html), None)
10771077

1078+
10781079
if __name__ == '__main__':
10791080
unittest.main()

test/test_verbose_output.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,6 @@ def test_private_info_shortarg_eq(self):
6666
self.assertTrue(b'-p' in serr)
6767
self.assertTrue(b'secret' not in serr)
6868

69+
6970
if __name__ == '__main__':
7071
unittest.main()

test/test_write_annotations.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def __init__(self, *args, **kwargs):
2424
super(YoutubeDL, self).__init__(*args, **kwargs)
2525
self.to_stderr = self.to_screen
2626

27+
2728
params = get_params({
2829
'writeannotations': True,
2930
'skip_download': True,
@@ -74,5 +75,6 @@ def test_info_json(self):
7475
def tearDown(self):
7576
try_rm(ANNOTATIONS_FILE)
7677

78+
7779
if __name__ == '__main__':
7880
unittest.main()

test/test_youtube_lists.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,6 @@ def test_youtube_flat_playlist_titles(self):
6666
for entry in result['entries']:
6767
self.assertTrue(entry.get('title'))
6868

69+
6970
if __name__ == '__main__':
7071
unittest.main()

test/test_youtube_signature.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ def test_func(self):
114114
test_func.__name__ = str('test_signature_' + stype + '_' + test_id)
115115
setattr(TestSignature, test_func.__name__, test_func)
116116

117+
117118
for test_spec in _TESTS:
118119
make_tfunc(*test_spec)
119120

youtube_dl/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,4 +449,5 @@ def main(argv=None):
449449
except KeyboardInterrupt:
450450
sys.exit('\nERROR: Interrupted by user')
451451

452+
452453
__all__ = ['main', 'YoutubeDL', 'gen_extractors', 'list_extractors']

youtube_dl/aes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ def next_value(self):
174174

175175
return plaintext
176176

177+
177178
RCON = (0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36)
178179
SBOX = (0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76,
179180
0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0,
@@ -328,4 +329,5 @@ def inc(data):
328329
break
329330
return data
330331

332+
331333
__all__ = ['aes_encrypt', 'key_expansion', 'aes_ctr_decrypt', 'aes_cbc_decrypt', 'aes_decrypt_text']

youtube_dl/compat.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2491,6 +2491,7 @@ class _TreeBuilder(etree.TreeBuilder):
24912491
def doctype(self, name, pubid, system):
24922492
pass
24932493

2494+
24942495
if sys.version_info[0] >= 3:
24952496
def compat_etree_fromstring(text):
24962497
return etree.XML(text, parser=etree.XMLParser(target=_TreeBuilder()))
@@ -2787,6 +2788,7 @@ def _compat_add_option(self, *args, **kwargs):
27872788
return real_add_option(self, *bargs, **bkwargs)
27882789
optparse.OptionGroup.add_option = _compat_add_option
27892790

2791+
27902792
if hasattr(shutil, 'get_terminal_size'): # Python >= 3.3
27912793
compat_get_terminal_size = shutil.get_terminal_size
27922794
else:

youtube_dl/downloader/external.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ def _call_downloader(self, tmpfilename, info_dict):
293293
class AVconvFD(FFmpegFD):
294294
pass
295295

296+
296297
_BY_NAME = dict(
297298
(klass.get_basename(), klass)
298299
for name, klass in globals().items()

youtube_dl/socks.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ class ProxyType(object):
103103
SOCKS4A = 1
104104
SOCKS5 = 2
105105

106+
106107
Proxy = collections.namedtuple('Proxy', (
107108
'type', 'host', 'port', 'username', 'password', 'remote_dns'))
108109

youtube_dl/swfinterp.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ def _u30(reader):
115115
res = _read_int(reader)
116116
assert res & 0xf0000000 == 0
117117
return res
118+
119+
118120
_u32 = _read_int
119121

120122

@@ -176,6 +178,7 @@ def __str__(self):
176178
return 'undefined'
177179
__repr__ = __str__
178180

181+
179182
undefined = _Undefined()
180183

181184

0 commit comments

Comments
 (0)