mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-10-31 22:55:18 +00:00 
			
		
		
		
	[cleanup] Mark some compat variables for removal (#2173)
Authored by fstirlitz, pukkandan
This commit is contained in:
		| @@ -26,24 +26,20 @@ import tokenize | ||||
| import traceback | ||||
| import random | ||||
| import unicodedata | ||||
| import urllib.request | ||||
| 
 | ||||
| from enum import Enum | ||||
| from string import ascii_letters | ||||
| 
 | ||||
| from .compat import ( | ||||
|     compat_basestring, | ||||
|     compat_brotli, | ||||
|     compat_get_terminal_size, | ||||
|     compat_kwargs, | ||||
|     compat_numeric_types, | ||||
|     compat_os_name, | ||||
|     compat_pycrypto_AES, | ||||
|     compat_shlex_quote, | ||||
|     compat_str, | ||||
|     compat_tokenize_tokenize, | ||||
|     compat_urllib_error, | ||||
|     compat_urllib_request, | ||||
|     compat_urllib_request_DataHandler, | ||||
|     windows_enable_vt_mode, | ||||
| ) | ||||
| from .cookies import load_cookies | ||||
| @@ -682,7 +678,7 @@ class YoutubeDL(object): | ||||
|             pp_def = dict(pp_def_raw) | ||||
|             when = pp_def.pop('when', 'post_process') | ||||
|             self.add_post_processor( | ||||
|                 get_postprocessor(pp_def.pop('key'))(self, **compat_kwargs(pp_def)), | ||||
|                 get_postprocessor(pp_def.pop('key'))(self, **pp_def), | ||||
|                 when=when) | ||||
| 
 | ||||
|         self._setup_opener() | ||||
| @@ -2244,7 +2240,7 @@ class YoutubeDL(object): | ||||
| 
 | ||||
|         stream = io.BytesIO(format_spec.encode('utf-8')) | ||||
|         try: | ||||
|             tokens = list(_remove_unused_ops(compat_tokenize_tokenize(stream.readline))) | ||||
|             tokens = list(_remove_unused_ops(tokenize.tokenize(stream.readline))) | ||||
|         except tokenize.TokenError: | ||||
|             raise syntax_error('Missing closing/opening brackets or parenthesis', (0, len(format_spec))) | ||||
| 
 | ||||
| @@ -2406,7 +2402,7 @@ class YoutubeDL(object): | ||||
|         def sanitize_numeric_fields(info): | ||||
|             for numeric_field in self._NUMERIC_FIELDS: | ||||
|                 field = info.get(numeric_field) | ||||
|                 if field is None or isinstance(field, compat_numeric_types): | ||||
|                 if field is None or isinstance(field, (int, float)): | ||||
|                     continue | ||||
|                 report_force_conversion(numeric_field, 'numeric', 'int') | ||||
|                 info[numeric_field] = int_or_none(field) | ||||
| @@ -3589,7 +3585,7 @@ class YoutubeDL(object): | ||||
| 
 | ||||
|     def urlopen(self, req): | ||||
|         """ Start an HTTP download """ | ||||
|         if isinstance(req, compat_basestring): | ||||
|         if isinstance(req, str): | ||||
|             req = sanitized_Request(req) | ||||
|         return self._opener.open(req, timeout=self._socket_timeout) | ||||
| 
 | ||||
| @@ -3739,7 +3735,7 @@ class YoutubeDL(object): | ||||
|         https_handler = make_HTTPS_handler(self.params, debuglevel=debuglevel) | ||||
|         ydlh = YoutubeDLHandler(self.params, debuglevel=debuglevel) | ||||
|         redirect_handler = YoutubeDLRedirectHandler() | ||||
|         data_handler = compat_urllib_request_DataHandler() | ||||
|         data_handler = urllib.request.DataHandler() | ||||
| 
 | ||||
|         # When passing our own FileHandler instance, build_opener won't add the | ||||
|         # default FileHandler and allows us to disable the file protocol, which | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 pukkandan
					pukkandan