Skip to content

Commit

Permalink
[cleanup] Consistent style for file heads
Browse files Browse the repository at this point in the history
  • Loading branch information
pukkandan committed Jun 24, 2022
1 parent ac66811 commit 54007a4
Show file tree
Hide file tree
Showing 55 changed files with 143 additions and 56 deletions.
3 changes: 3 additions & 0 deletions devscripts/bash-completion.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#!/usr/bin/env python3

# Allow direct execution
import os
import sys

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))


import yt_dlp

BASH_COMPLETION_FILE = "completions/bash/yt-dlp"
Expand Down
6 changes: 5 additions & 1 deletion devscripts/fish-completion.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#!/usr/bin/env python3
import optparse

# Allow direct execution
import os
import sys

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))


import optparse

import yt_dlp
from yt_dlp.utils import shell_quote

Expand Down
8 changes: 6 additions & 2 deletions devscripts/generate_aes_testdata.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#!/usr/bin/env python3
import codecs

# Allow direct execution
import os
import subprocess
import sys

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))


import codecs
import subprocess

from yt_dlp.aes import aes_encrypt, key_expansion
from yt_dlp.utils import intlist_to_bytes

Expand Down
1 change: 1 addition & 0 deletions devscripts/make_contributing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3

import optparse
import re

Expand Down
10 changes: 9 additions & 1 deletion devscripts/make_issue_template.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#!/usr/bin/env python3

# Allow direct execution
import os
import sys

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))


import optparse


Expand All @@ -7,7 +15,7 @@ def read(fname):
return f.read()


# Get the version from yt_dlp/version.py without importing the package
# Get the version without importing the package
def read_version(fname):
exec(compile(read(fname), fname, 'exec'))
return locals()['__version__']
Expand Down
7 changes: 5 additions & 2 deletions devscripts/make_lazy_extractors.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#!/usr/bin/env python3
import optparse

# Allow direct execution
import os
import sys
from inspect import getsource

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))


import optparse
from inspect import getsource

NO_ATTR = object()
STATIC_CLASS_PROPERTIES = ['IE_NAME', 'IE_DESC', 'SEARCH_KEY', '_WORKING', '_NETRC_MACHINE', 'age_limit']
CLASS_METHODS = [
Expand Down
8 changes: 6 additions & 2 deletions devscripts/make_readme.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#!/usr/bin/env python3

# yt-dlp --help | make_readme.py
# This must be run in a console of correct width
"""
yt-dlp --help | make_readme.py
This must be run in a console of correct width
"""


import functools
import re
import sys
Expand Down
6 changes: 5 additions & 1 deletion devscripts/make_supportedsites.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#!/usr/bin/env python3
import optparse

# Allow direct execution
import os
import sys

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))


import optparse

from yt_dlp.extractor import list_extractor_classes


Expand Down
3 changes: 2 additions & 1 deletion devscripts/prepare_manpage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3

import optparse
import os.path
import re
Expand All @@ -23,7 +24,7 @@

def main():
parser = optparse.OptionParser(usage='%prog OUTFILE.md')
options, args = parser.parse_args()
_, args = parser.parse_args()
if len(args) != 1:
parser.error('Expected an output filename')

Expand Down
8 changes: 8 additions & 0 deletions devscripts/update-version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#!/usr/bin/env python3

# Allow direct execution
import os
import sys

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))


import subprocess
import sys
from datetime import datetime
Expand Down
3 changes: 3 additions & 0 deletions devscripts/zsh-completion.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#!/usr/bin/env python3

# Allow direct execution
import os
import sys

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))


import yt_dlp

ZSH_COMPLETION_FILE = "completions/zsh/_yt-dlp"
Expand Down
1 change: 1 addition & 0 deletions pyinst.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3

import os
import platform
import sys
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ line_length = 80
reverse_relative = true
ensure_newline_before_comments = true
include_trailing_comma = true
known_first_party =
test
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3

import os.path
import sys
import warnings
Expand Down
1 change: 1 addition & 0 deletions test/test_InfoExtractor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3

# Allow direct execution
import os
import sys
Expand Down
2 changes: 2 additions & 0 deletions test/test_YoutubeDL.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env python3

# Allow direct execution
import os
import sys
import unittest

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))


import copy
import json
import urllib.error
Expand Down
8 changes: 6 additions & 2 deletions test/test_YoutubeDLCookieJar.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#!/usr/bin/env python3

# Allow direct execution
import os
import re
import sys
import tempfile
import unittest

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))


import re
import tempfile

from yt_dlp.utils import YoutubeDLCookieJar


Expand Down
2 changes: 2 additions & 0 deletions test/test_aes.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env python3

# Allow direct execution
import os
import sys
import unittest

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))


import base64

from yt_dlp.aes import (
Expand Down
3 changes: 2 additions & 1 deletion test/test_age_restriction.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/usr/bin/env python3

# Allow direct execution
import os
import sys
import unittest

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from test.helper import is_download_test, try_rm

from test.helper import is_download_test, try_rm
from yt_dlp import YoutubeDL


Expand Down
5 changes: 3 additions & 2 deletions test/test_all_urls.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#!/usr/bin/env python3

# Allow direct execution
import collections
import os
import sys
import unittest

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))


from test.helper import gettestcases
import collections

from test.helper import gettestcases
from yt_dlp.extractor import FacebookIE, YoutubeIE, gen_extractors


Expand Down
5 changes: 3 additions & 2 deletions test/test_cache.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#!/usr/bin/env python3

# Allow direct execution
import os
import shutil
import sys
import unittest

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))


from test.helper import FakeYDL
import shutil

from test.helper import FakeYDL
from yt_dlp.cache import Cache


Expand Down
1 change: 1 addition & 0 deletions test/test_compat.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3

# Allow direct execution
import os
import sys
Expand Down
4 changes: 3 additions & 1 deletion test/test_download.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3

# Allow direct execution
import os
import sys
Expand All @@ -8,10 +9,10 @@


import hashlib
import http.client
import json
import socket
import urllib.error
import http.client

from test.helper import (
assertGreaterEqual,
Expand All @@ -23,6 +24,7 @@
report_warning,
try_rm,
)

import yt_dlp.YoutubeDL # isort: split
from yt_dlp.compat import compat_HTTPError
from yt_dlp.extractor import get_info_extractor
Expand Down
5 changes: 3 additions & 2 deletions test/test_downloader_http.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
#!/usr/bin/env python3

# Allow direct execution
import os
import sys
import unittest
import http.server

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))


import http.server
import re
import threading
from test.helper import http_server_port, try_rm

from test.helper import http_server_port, try_rm
from yt_dlp import YoutubeDL
from yt_dlp.downloader.http import HttpFD
from yt_dlp.utils import encodeFilename
Expand Down
8 changes: 6 additions & 2 deletions test/test_execution.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#!/usr/bin/env python3
import contextlib

# Allow direct execution
import os
import subprocess
import sys
import unittest

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))


import contextlib
import subprocess

from yt_dlp.utils import encodeArgument

rootDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
Expand Down
5 changes: 3 additions & 2 deletions test/test_http.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
#!/usr/bin/env python3

# Allow direct execution
import os
import sys
import unittest
import http.server

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))


import http.server
import ssl
import threading
import urllib.request
from test.helper import http_server_port

from test.helper import http_server_port
from yt_dlp import YoutubeDL

TEST_DIR = os.path.dirname(os.path.abspath(__file__))
Expand Down
3 changes: 2 additions & 1 deletion test/test_iqiyi_sdk_interpreter.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/usr/bin/env python3

# Allow direct execution
import os
import sys
import unittest

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from test.helper import FakeYDL, is_download_test

from test.helper import FakeYDL, is_download_test
from yt_dlp.extractor import IqiyiIE


Expand Down
Loading

0 comments on commit 54007a4

Please sign in to comment.