projects
/
youtube-dl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[compat] Add compat_itertools_count
[youtube-dl]
/
youtube_dl
/
compat.py
diff --git
a/youtube_dl/compat.py
b/youtube_dl/compat.py
index f9529210dd955932eca837aa7022696470c557ed..c3783337a5a801cd5230f2ae2f5d82112d4b6cea 100644
(file)
--- a/
youtube_dl/compat.py
+++ b/
youtube_dl/compat.py
@@
-9,6
+9,7
@@
import shutil
import socket
import subprocess
import sys
import socket
import subprocess
import sys
+import itertools
try:
try:
@@
-388,6
+389,15
@@
else:
pass
return _terminal_size(columns, lines)
pass
return _terminal_size(columns, lines)
+try:
+ itertools.count(start=0, step=1)
+ compat_itertools_count = itertools.count
+except TypeError: # Python 2.6
+ def compat_itertools_count(start=0, step=1):
+ n = start
+ while True:
+ yield n
+ n += step
__all__ = [
'compat_HTTPError',
__all__ = [
'compat_HTTPError',
@@
-401,6
+411,7
@@
__all__ = [
'compat_html_entities',
'compat_http_client',
'compat_http_server',
'compat_html_entities',
'compat_http_client',
'compat_http_server',
+ 'compat_itertools_count',
'compat_kwargs',
'compat_ord',
'compat_parse_qs',
'compat_kwargs',
'compat_ord',
'compat_parse_qs',