本文整理汇总了Python中subprocess.Popen.append方法的典型用法代码示例。如果您正苦于以下问题:Python Popen.append方法的具体用法?Python Popen.append怎么用?Python Popen.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类subprocess.Popen
的用法示例。
在下文中一共展示了Popen.append方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_language_list
# 需要导入模块: from subprocess import Popen [as 别名]
# 或者: from subprocess.Popen import append [as 别名]
def build_language_list(typemanager):
"""
Build a list of language internal names from the output of
ctags --list-languages
"""
try:
output = Popen(["ctags", "--list-languages"],
stdout=PIPE).communicate()[0]
except OSError as e:
# can't find ctags -> no support :-)
return []
output = output.splitlines()
rv = []
if "C#" in output:
output.append("vala")
for name in output:
clang = typemanager.get_fuzzy(name)
if clang is not None:
rv.append(clang)
return rv
示例2: __call__
# 需要导入模块: from subprocess import Popen [as 别名]
# 或者: from subprocess.Popen import append [as 别名]
def __call__(self, program, complex, subcomplex=None, **kwds):
"""
Call a CHomP program to compute the homology of a chain
complex, simplicial complex, or cubical complex.
See :class:`CHomP` for full documentation.
EXAMPLES::
sage: from sage.interfaces.chomp import CHomP
sage: T = cubical_complexes.Torus()
sage: CHomP()('homcubes', T) # indirect doctest, optional - CHomP
{0: 0, 1: Z x Z, 2: Z}
"""
from sage.misc.temporary_file import tmp_filename
from sage.homology.all import CubicalComplex, cubical_complexes
from sage.homology.all import SimplicialComplex, Simplex
from sage.homology.chain_complex import HomologyGroup
from subprocess import Popen, PIPE
from sage.rings.all import QQ, ZZ
from sage.modules.all import VectorSpace, vector
from sage.combinat.free_module import CombinatorialFreeModule
if not have_chomp(program):
raise OSError("Program %s not found" % program)
verbose = kwds.get('verbose', False)
generators = kwds.get('generators', False)
extra_opts = kwds.get('extra_opts', '')
base_ring = kwds.get('base_ring', ZZ)
if extra_opts:
extra_opts = extra_opts.split()
else:
extra_opts = []
# type of complex:
cubical = False
simplicial = False
chain = False
# CHomP seems to have problems with cubical complexes if the
# first interval in the first cube defining the complex is
# degenerate. So replace the complex X with [0,1] x X.
if isinstance(complex, CubicalComplex):
cubical = True
edge = cubical_complexes.Cube(1)
original_complex = complex
complex = edge.product(complex)
if verbose:
print("Cubical complex")
elif isinstance(complex, SimplicialComplex):
simplicial = True
if verbose:
print("Simplicial complex")
else:
chain = True
base_ring = kwds.get('base_ring', complex.base_ring())
if verbose:
print("Chain complex over %s" % base_ring)
if base_ring == QQ:
raise ValueError("CHomP doesn't compute over the rationals, only over Z or F_p.")
if base_ring.is_prime_field():
p = base_ring.characteristic()
extra_opts.append('-p%s' % p)
mod_p = True
else:
mod_p = False
#
# complex
#
try:
data = complex._chomp_repr_()
except AttributeError:
raise AttributeError("Complex can not be converted to use with CHomP.")
datafile = tmp_filename()
f = open(datafile, 'w')
f.write(data)
f.close()
#
# subcomplex
#
if subcomplex is None:
if cubical:
subcomplex = CubicalComplex([complex.n_cells(0)[0]])
elif simplicial:
m = re.search(r'\(([^,]*),', data)
v = int(m.group(1))
subcomplex = SimplicialComplex([[v]])
else:
# replace subcomplex with [0,1] x subcomplex.
if cubical:
subcomplex = edge.product(subcomplex)
#
# generators
#
if generators:
#.........这里部分代码省略.........