aboutsummaryrefslogtreecommitdiff
path: root/yt_dlp/__init__.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-04-11 20:40:28 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-04-12 05:32:51 +0530
commit86e5f3ed2e6e71eb81ea4c9e26288f16119ffd0c (patch)
tree12558e4c8f24c1a8d16ccb63e2455b26c301285a /yt_dlp/__init__.py
parentf9934b96145af8ac5dfdcbf684827aeaea9912a7 (diff)
[cleanup] Upgrade syntax
Using https://github.com/asottile/pyupgrade 1. `__future__` imports and `coding: utf-8` were removed 2. Files were rewritten with `pyupgrade --py36-plus --keep-percent-format` 3. f-strings were cherry-picked from `pyupgrade --py36-plus` Extractors are left untouched (except removing header) to avoid unnecessary merge conflicts
Diffstat (limited to 'yt_dlp/__init__.py')
-rw-r--r--yt_dlp/__init__.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/yt_dlp/__init__.py b/yt_dlp/__init__.py
index 10dc221b4..91bf5c4ce 100644
--- a/yt_dlp/__init__.py
+++ b/yt_dlp/__init__.py
@@ -1,11 +1,8 @@
#!/usr/bin/env python3
-# coding: utf-8
-
f'You are using an unsupported version of Python. Only Python versions 3.6 and above are supported by yt-dlp' # noqa: F541
__license__ = 'Public Domain'
-import io
import itertools
import os
import random
@@ -67,13 +64,12 @@ def get_urls(urls, batchfile, verbose):
'Ctrl+Z' if compat_os_name == 'nt' else 'Ctrl+D'))
batchfd = sys.stdin
else:
- batchfd = io.open(
- expand_path(batchfile),
- 'r', encoding='utf-8', errors='ignore')
+ batchfd = open(
+ expand_path(batchfile), encoding='utf-8', errors='ignore')
batch_urls = read_batch_urls(batchfd)
if verbose:
write_string('[debug] Batch file urls: ' + repr(batch_urls) + '\n')
- except IOError:
+ except OSError:
sys.exit('ERROR: batch file %s could not be read' % batchfile)
_enc = preferredencoding()
return [