repo.or.cz
/
PyX
/
mjg.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
add any() to compatibility module
[PyX/mjg.git]
/
pyx
/
pycompat.py
blob
95d41c491442b3e3c9c1d76a3bc101f19b0b0efa
1
def
popen
(
cmd
,
mode
=
"r"
):
2
try
:
3
import
subprocess
4
return
subprocess
.
Popen
(
cmd
,
shell
=
True
,
bufsize
=
bufsize
,
stdout
=
PIPE
).
stdout
5
except
ImportError
:
6
import
os
7
return
os
.
popen
(
command
,
mode
)
8
9
try
:
10
any
([])
11
except
NameError
:
12
def
any
(
iterable
):
13
for
element
in
iterable
:
14
if
element
:
15
return True
16
return False
17