本文整理汇总了Python中expect.Expect.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Expect.__init__方法的具体用法?Python Expect.__init__怎么用?Python Expect.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类expect.Expect
的用法示例。
在下文中一共展示了Expect.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from expect import Expect [as 别名]
# 或者: from expect.Expect import __init__ [as 别名]
def __init__(self, maxread=None, script_subdirectory=None, server=None,
server_tmpdir=None, logfile=None, ulimit=None):
"""
Create an instance of the Maple interpreter.
EXAMPLES::
sage: maple == loads(dumps(maple))
True
"""
__maple_iface_opts = [
'screenwidth=infinity',
'errorcursor=false',]
__maple_command = 'maple -t -c "interface({})"'.format(
','.join(__maple_iface_opts))
#errorcursor=false avoids maple command line interface to dump
#into the editor when an error occurs. Thus pexpect interface
#is not messed up if a maple error occurs.
#screenwidth=infinity prevents maple command interface from cutting
#your input lines. By doing this, file interface also works in the
#event that sage_user_home + sage_tmp_file_stuff exceeds the
#length of 79 characters.
Expect.__init__(self,
name = 'maple',
prompt = '#-->',
command = __maple_command,
server = server,
server_tmpdir = server_tmpdir,
ulimit = ulimit,
script_subdirectory = script_subdirectory,
restart_on_ctrlc = False,
verbose_start = False,
logfile = logfile,
eval_using_file_cutoff=2048) # 2048 is
示例2: __init__
# 需要导入模块: from expect import Expect [as 别名]
# 或者: from expect.Expect import __init__ [as 别名]
def __init__(self, stacksize=10000000, # 10MB
maxread=100000, script_subdirectory=None,
logfile=None,
server=None,
server_tmpdir=None,
init_list_length=1024):
"""
EXAMPLES::
sage: gp == loads(dumps(gp))
True
"""
Expect.__init__(self,
name = 'pari',
prompt = '\\? ',
command = "gp --emacs --fast --quiet --stacksize %s"%stacksize,
maxread = maxread,
server=server,
server_tmpdir=server_tmpdir,
script_subdirectory = script_subdirectory,
restart_on_ctrlc = False,
verbose_start = False,
logfile=logfile,
eval_using_file_cutoff=50)
self.__seq = 0
self.__var_store_len = 0
self.__init_list_length = init_list_length
示例3: __init__
# 需要导入模块: from expect import Expect [as 别名]
# 或者: from expect.Expect import __init__ [as 别名]
def __init__(self, name='axiom', command='axiom -nox -noclef',
script_subdirectory=None, logfile=None,
server=None, server_tmpdir=None,
init_code=[')lisp (si::readline-off)']):
"""
Create an instance of the Axiom interpreter.
TESTS::
sage: axiom == loads(dumps(axiom))
True
"""
eval_using_file_cutoff = 200
self.__eval_using_file_cutoff = eval_using_file_cutoff
self._COMMANDS_CACHE = '%s/%s_commandlist_cache.sobj'%(DOT_SAGE, name)
Expect.__init__(self,
name = name,
prompt = '\([0-9]+\) -> ',
command = command,
maxread = 10,
script_subdirectory = script_subdirectory,
server=server,
server_tmpdir=server_tmpdir,
restart_on_ctrlc = False,
verbose_start = False,
init_code = init_code,
logfile = logfile,
eval_using_file_cutoff=eval_using_file_cutoff)
self._prompt_wait = self._prompt
示例4: __init__
# 需要导入模块: from expect import Expect [as 别名]
# 或者: from expect.Expect import __init__ [as 别名]
def __init__(self, maxread=100, script_subdirectory=None,
logfile=None, server=None,server_tmpdir=None,
seed=None):
"""
Initializes the Scilab class.
EXAMPLES::
sage: from sage.interfaces.scilab import Scilab
sage: sci_obj = Scilab()
sage: del sci_obj
"""
Expect.__init__(self,
name = 'scilab',
prompt = '-->',
command = "scilab -nw",
maxread = maxread,
server = server,
server_tmpdir = server_tmpdir,
script_subdirectory = script_subdirectory,
restart_on_ctrlc = False,
verbose_start = False,
logfile = logfile,
eval_using_file_cutoff=100)
self._seed = seed
示例5: __init__
# 需要导入模块: from expect import Expect [as 别名]
# 或者: from expect.Expect import __init__ [as 别名]
def __init__(self, server=None, server_tmpdir=None, logfile=None):
Expect.__init__(self,
name = 'genus2reduction',
prompt = 'enter',
command = 'genus2reduction',
server = server,
server_tmpdir = server_tmpdir,
maxread = 10000,
restart_on_ctrlc = True,
logfile = logfile,
verbose_start = False)
示例6: __init__
# 需要导入模块: from expect import Expect [as 别名]
# 或者: from expect.Expect import __init__ [as 别名]
def __init__(self, maxread=100, script_subdirectory="", logfile=None, server=None, server_tmpdir=None):
Expect.__init__(self,
name = 'mathematica',
prompt = 'In[[0-9]+]:=',
command = "math",
maxread = maxread,
server = server,
server_tmpdir = server_tmpdir,
script_subdirectory = script_subdirectory,
verbose_start = False,
logfile=logfile,
eval_using_file_cutoff=50)
示例7: __init__
# 需要导入模块: from expect import Expect [as 别名]
# 或者: from expect.Expect import __init__ [as 别名]
def __init__(self, maxread=None, script_subdirectory=None,
logfile=None, server=None,server_tmpdir=None):
Expect.__init__(self,
name = 'matlab',
prompt = '>> ',
command = "sage-native-execute matlab -nodisplay",
server = server,
server_tmpdir = server_tmpdir,
script_subdirectory = script_subdirectory,
restart_on_ctrlc = False,
verbose_start = False,
logfile = logfile,
eval_using_file_cutoff=100)
示例8: __init__
# 需要导入模块: from expect import Expect [as 别名]
# 或者: from expect.Expect import __init__ [as 别名]
def __init__(self, options="", server=None,server_tmpdir=None):
"""
INPUT:
- ``options`` - string; passed when starting mwrank.
The format is::
-h help prints this info and quits
-q quiet turns OFF banner display and prompt
-v n verbosity sets verbosity to n (default=1)
-o PARI/GP output turns ON extra PARI/GP short output (default is OFF)
-p n precision sets precision to n decimals (default=15)
-b n quartic bound bound on quartic point search (default=10)
-x n n aux number of aux primes used for sieving (default=6)
-l list turns ON listing of points (default ON unless v=0)
-s selmer_only if set, computes Selmer rank only (default: not set)
-d skip_2nd_descent if set, skips the second descent for curves with 2-torsion (default: not set)
-S n sat_bd upper bound on saturation primes (default=100, -1 for automatic)
.. warning:
Do not use the option "-q" which turns off the prompt.
.. note::
Normally instances of this class would be created by
calling the global function :meth:`Mwrank`.
EXAMPLES::
sage: from sage.interfaces.mwrank import Mwrank_class
sage: M = Mwrank_class('-v 0 -l')
sage: M('0 -1 1 0 0')
'Curve [0,-1,1,0,0] :...Rank = 0...Regulator = 1...'
sage: from sage.interfaces.mwrank import Mwrank_class
sage: TestSuite(Mwrank_class).run()
"""
Expect.__init__(self,
name = 'mwrank',
prompt = 'Enter curve: ',
command = "mwrank %s"%options,
server = server,
server_tmpdir = server_tmpdir,
maxread = 10000,
restart_on_ctrlc = True,
verbose_start = False)
示例9: __init__
# 需要导入模块: from expect import Expect [as 别名]
# 或者: from expect.Expect import __init__ [as 别名]
def __init__(self,
maxread=100000, script_subdirectory=None,
logfile=None,
server=None):
"""
EXAMPLES::
sage: lie == loads(dumps(lie))
True
"""
Expect.__init__(self,
# The capitalized version of this is used for printing.
name = 'LiE',
# This is regexp of the input prompt. If you can change
# it to be very obfuscated that would be better. Even
# better is to use sequence numbers.
prompt = '> ',
# This is the command that starts up your program
command = "bash "+ SAGE_LOCAL + "/bin/lie",
maxread = maxread,
server=server,
script_subdirectory = script_subdirectory,
# If this is true, then whenever the user presses Control-C to
# interrupt a calculation, the whole interface is restarted.
restart_on_ctrlc = False,
# If true, print out a message when starting
# up the command when you first send a command
# to this interface.
verbose_start = False,
logfile=logfile,
# If an input is longer than this number of characters, then
# try to switch to outputting to a file.
eval_using_file_cutoff=1024)
self._seq = 0
self._trait_names_dict = None
self._trait_names_list = None
self._help_dict = None
示例10: __init__
# 需要导入模块: from expect import Expect [as 别名]
# 或者: from expect.Expect import __init__ [as 别名]
def __init__(
self,
stacksize=10000000, # 10MB
maxread=100000,
script_subdirectory=None,
logfile=None,
server=None,
server_tmpdir=None,
init_list_length=1024,
):
"""
Initialization of this PARI gp interpreter.
INPUT:
- ``stacksize`` (int, default 10000000) -- the initial PARI
stacksize in bytes (default 10MB)
- ``maxread`` (int, default 100000) -- ??
- ``script_subdirectory`` (string, default None) -- name of the subdirectory of SAGE_EXTCODE/pari from which to read scripts
- ``logfile`` (string, default None) -- log file for the pexpect interface
- ``server`` -- name of remote server
- ``server_tmpdir`` -- name of temporary directory on remote server
- ``init_list_length`` (int, default 1024) -- length of initial list of local variables.
EXAMPLES::
sage: gp == loads(dumps(gp))
True
"""
Expect.__init__(
self,
name="pari",
prompt="\\? ",
command="gp --emacs --quiet --stacksize %s" % stacksize,
maxread=maxread,
server=server,
server_tmpdir=server_tmpdir,
script_subdirectory=script_subdirectory,
restart_on_ctrlc=False,
verbose_start=False,
logfile=logfile,
eval_using_file_cutoff=1024,
)
self.__seq = 0
self.__var_store_len = 0
self.__init_list_length = init_list_length
示例11: __init__
# 需要导入模块: from expect import Expect [as 别名]
# 或者: from expect.Expect import __init__ [as 别名]
def __init__(self, logfile = None,
preparse = True,
python = False,
init_code = None,
server = None,
server_tmpdir = None,
remote_cleaner = True,
**kwds):
"""
EXAMPLES::
sage: sage0 == loads(dumps(sage0))
True
"""
from sage.misc.misc import SAGE_ROOT
if python:
if server:
command = "femhub -python -u"
else:
command = SAGE_ROOT + "/femhub -python -u"
prompt = ">>>"
if init_code is None:
init_code = ['from sage.all import *', 'import cPickle']
else:
if server:
command = "femhub"
else:
command = SAGE_ROOT + "/femhub"
prompt = "sage: "
if init_code is None:
init_code = ['import cPickle', '%colors NoColor']
Expect.__init__(self,
name = 'sage',
prompt = prompt,
command = command,
restart_on_ctrlc = False,
logfile = logfile,
init_code = init_code,
server = server,
server_tmpdir = server_tmpdir,
remote_cleaner = remote_cleaner,
**kwds
)
self._preparse = preparse
示例12: __init__
# 需要导入模块: from expect import Expect [as 别名]
# 或者: from expect.Expect import __init__ [as 别名]
def __init__(self, options="", server=None,server_tmpdir=None):
"""
INPUT:
- ``options`` - string; passed when starting mwrank.
The format is q pprecision vverbosity bhlim_q xnaux chlim_c l t o
s d]
"""
Expect.__init__(self,
name = 'mwrank',
prompt = 'Enter curve: ',
command = "mwrank %s"%options,
server = server,
server_tmpdir = server_tmpdir,
maxread = 10000,
restart_on_ctrlc = True,
verbose_start = False)
示例13: __init__
# 需要导入模块: from expect import Expect [as 别名]
# 或者: from expect.Expect import __init__ [as 别名]
def __init__(self, maxread=10000, script_subdirectory="",
logfile=None, server=None,server_tmpdir=None):
"""
TESTS:
sage: macaulay2 == loads(dumps(macaulay2))
True
"""
Expect.__init__(self,
name = 'macaulay2',
prompt = 'i[0-9]* : ',
command = "M2 --no-debug --no-readline --silent ",
maxread = maxread,
server = server,
server_tmpdir = server_tmpdir,
script_subdirectory = script_subdirectory,
verbose_start = False,
logfile = logfile,
eval_using_file_cutoff=500)
示例14: __init__
# 需要导入模块: from expect import Expect [as 别名]
# 或者: from expect.Expect import __init__ [as 别名]
def __init__(
self,
logfile=None,
preparse=True,
python=False,
init_code=None,
server=None,
server_tmpdir=None,
remote_cleaner=True,
**kwds
):
"""
EXAMPLES::
sage: sage0 == loads(dumps(sage0))
True
"""
if python:
command = "python -u"
prompt = ">>>"
if init_code is None:
init_code = ["from sage.all import *", "import cPickle"]
else:
# Disable the IPython history (implemented as SQLite database)
# to avoid problems with locking.
command = "sage-ipython --HistoryManager.hist_file=:memory: --colors=NoColor"
prompt = "sage: "
if init_code is None:
init_code = ["import cPickle"]
Expect.__init__(
self,
name="sage",
prompt=prompt,
command=command,
restart_on_ctrlc=False,
logfile=logfile,
init_code=init_code,
server=server,
server_tmpdir=server_tmpdir,
remote_cleaner=remote_cleaner,
**kwds
)
self._preparse = preparse
示例15: __init__
# 需要导入模块: from expect import Expect [as 别名]
# 或者: from expect.Expect import __init__ [as 别名]
def __init__(self, maxread=10000, script_subdirectory="", logfile=None, server=None, server_tmpdir=None):
"""
Initialize a Macaulay2 interface instance.
We replace the standard input prompt with a strange one, so that
we do not catch input prompts inside the documentation.
We replace the standard input continuation prompt, which is
just a bunch of spaces and cannot be automatically detected in a
reliable way. This is necessary for allowing commands that occupy
several strings.
We also change the starting line number to make all the output
labels to be of the same length. This allows correct stripping of
the output of several commands.
TESTS:
sage: macaulay2 == loads(dumps(macaulay2))
True
"""
init_str = (
# Prompt changing commands
"""ZZ#{Standard,Core#"private dictionary"#"InputPrompt"} = lineno -> "%s";""" % PROMPT
+ """ZZ#{Standard,Core#"private dictionary"#"InputContinuationPrompt"} = lineno -> "%s";""" % PROMPT
+
# Also prevent line wrapping in Macaulay2
"printWidth = 0;"
+
# And make all output labels to be of the same width
"lineNumber = 10^9;"
)
Expect.__init__(
self,
name="macaulay2",
prompt=PROMPT,
command="M2 --no-debug --no-readline --silent -e '%s'" % init_str,
maxread=maxread,
server=server,
server_tmpdir=server_tmpdir,
script_subdirectory=script_subdirectory,
verbose_start=False,
logfile=logfile,
eval_using_file_cutoff=500,
)