Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
fix docbuild problems and improve doc
Browse files Browse the repository at this point in the history
  • Loading branch information
mantepse committed Oct 3, 2016
1 parent 54cc3ef commit 70c3ace
Showing 1 changed file with 48 additions and 23 deletions.
71 changes: 48 additions & 23 deletions src/sage/interfaces/fricas.py
Expand Up @@ -409,7 +409,8 @@ def _read_in_file_command(self, filename):
return ')read %s )quiet'%filename

def _local_tmpfile(self):
"""Return a local tmpfile ending with ".input" used to buffer long
"""
Return a local tmpfile ending with ".input" used to buffer long
command lines sent to FriCAS.
"""
Expand All @@ -420,7 +421,8 @@ def _local_tmpfile(self):
return self.__local_tmpfile

def _remote_tmpfile(self):
"""Return a remote tmpfile ending with ".input" used to buffer long
"""
Return a remote tmpfile ending with ".input" used to buffer long
command lines sent to FriCAS.
"""
Expand Down Expand Up @@ -504,7 +506,8 @@ def _check_errors(self, line, output):
raise RuntimeError("An error occurred when FriCAS evaluated '%s':\n%s" % (line, output))

def set(self, var, value):
"""Set a variable to a value in FriCAS.
"""
Set a variable to a value in FriCAS.
INPUT:
Expand All @@ -525,7 +528,8 @@ def set(self, var, value):
self._check_errors(value, output)

def get(self, var):
r""" Get the string representation of the value (more precisely, the
r"""
Get the string representation of the value (more precisely, the
OutputForm) of a variable or expression in FriCAS.
If FriCAS cannot evaluate `var` an error is raised.
Expand Down Expand Up @@ -557,7 +561,8 @@ def get(self, var):
self._check_errors(var, output)

def get_string(self, var):
"""Return the value of a FriCAS string as a string, without checking
"""
Return the value of a FriCAS string as a string, without checking
that it is a string.
TESTS:
Expand All @@ -578,7 +583,8 @@ def get_string(self, var):
return self.get(str(var)).replace("\r\n", "")[1:-1]

def get_integer(self, var):
"""Return the value of a FriCAS integer as an integer, without
"""
Return the value of a FriCAS integer as an integer, without
checking that it is an integer.
TESTS::
Expand All @@ -590,7 +596,8 @@ def get_integer(self, var):
return int(self.get_unparsed_InputForm(str(var)))

def get_boolean(self, var):
"""Return the value of a FriCAS boolean as a boolean, without checking
"""
Return the value of a FriCAS boolean as a boolean, without checking
that it is a boolean.
TESTS::
Expand All @@ -604,15 +611,16 @@ def get_boolean(self, var):
return self.get(str(var)).replace("\r\n", "") == "true"

def get_unparsed_InputForm(self, var):
"""Return the unparsed InputForm as a string.
"""
Return the unparsed ``InputForm`` as a string.
.. TODO::
- catch errors, especially when InputForm is not available:
-- for example when integration returns "failed"
- for example when integration returns ``"failed"``
-- UnivariatePolynomial
- ``UnivariatePolynomial``
- should we provide workarounds, too?
Expand All @@ -625,7 +633,8 @@ def get_unparsed_InputForm(self, var):
return self.get_string('unparse((%s)::InputForm)' %str(var))

def _assign_symbol(self):
"""Return the symbol used for setting a variable in FriCAS.
"""
Return the symbol used for setting a variable in FriCAS.
EXAMPLES::
Expand All @@ -638,7 +647,8 @@ def _assign_symbol(self):
return ":="

def _equality_symbol(self):
"""Return the equality testing logical symbol in FriCAS.
"""
Return the equality testing logical symbol in FriCAS.
EXAMPLES::
Expand All @@ -656,7 +666,8 @@ def _equality_symbol(self):
return "="

def _true_symbol(self):
"""Return the string used for True in FriCAS.
"""
Return the string used for True in FriCAS.
EXAMPLES::
Expand All @@ -666,7 +677,8 @@ def _true_symbol(self):
return "true"

def _false_symbol(self):
"""Return the string used for False in FriCAS.
"""
Return the string used for False in FriCAS.
EXAMPLES::
Expand All @@ -676,7 +688,8 @@ def _false_symbol(self):
return "false"

def _inequality_symbol(self):
"""Return the string used for False in FriCAS.
"""
Return the string used for False in FriCAS.
EXAMPLES::
Expand Down Expand Up @@ -708,7 +721,8 @@ def __reduce__(self):

def eval(self, code, strip=True, synchronize=False, locals=None, allow_use_file=True,
split_lines="nofile", reformat=True, **kwds):
"""Evaluate ``code`` using FriCAS.
"""
Evaluate ``code`` using FriCAS.
Except ``reformat``, all arguments are passed to
:meth:`sage.interfaces.expect.Expect.eval`.
Expand All @@ -719,7 +733,7 @@ def eval(self, code, strip=True, synchronize=False, locals=None, allow_use_file=
This can also be used to pass system commands to FriCAS.
EXAMPLES:
EXAMPLES::
sage: fricas.set("x", "1783"); fricas("x") # optional - fricas
1783
Expand Down Expand Up @@ -800,7 +814,14 @@ def console(self):
fricas_console()

class FriCASElement(ExpectElement):
"""
Instances of this class represent objects in FriCAS.
Using the method :meth:`sage` we can translate some of them to
SageMath objects:
.. automethod:: _sage_
"""
def __len__(self):
"""
Return the length of a list.
Expand All @@ -816,7 +837,8 @@ def __len__(self):
return l.sage()

def __getitem__(self, n):
"""We implement the sage conventions here, translating to 0-based iterables.
"""
We implement the sage conventions here, translating to 0-based iterables.
We do not check validity, since many objects in FriCAS are
iterable, in particular Streams
Expand Down Expand Up @@ -1007,7 +1029,8 @@ def _get_sage_type(self, domain):
raise NotImplementedError("The translation of FriCAS type %s to sage is not yet implemented." %domain)

def _sage_expression(self, unparsed_InputForm):
"""Convert an expression to an element of the Symbolic Ring.
"""
Convert an expression to an element of the Symbolic Ring.
This does not depend on `self`. Instead, for practical
reasons of the implementation of `self._sage_`, it takes the
Expand Down Expand Up @@ -1051,7 +1074,7 @@ def _sage_(self):
"""
Convert self to a Sage object.
TESTS:
EXAMPLES:
Floats::
Expand Down Expand Up @@ -1131,7 +1154,7 @@ def _sage_(self):
- Converting matrices and lists takes much too long.
Matrices:
Matrices::
sage: fricas("matrix [[x^n/2^m for n in 0..5] for m in 0..3]").sage() # optional - fricas, long time
[ 1 x x^2 x^3 x^4 x^5]
Expand Down Expand Up @@ -1296,7 +1319,8 @@ def _sage_(self):

class FriCASFunctionElement(FunctionElement):
def __init__(self, object, name):
"""Make FriCAS operation names valid python function identifiers.
"""
Make FriCAS operation names valid python function identifiers.
TESTS::
Expand All @@ -1319,7 +1343,8 @@ def __init__(self, object, name):

class FriCASExpectFunction(ExpectFunction):
def __init__(self, parent, name):
"""Translate the pythonized function identifier back to a FriCAS
"""
Translate the pythonized function identifier back to a FriCAS
operation name.
TESTS::
Expand Down

0 comments on commit 70c3ace

Please sign in to comment.