MCPcopy Index your code
hub / github.com/SLiCAP/SLiCAP_python / expr

Method expr

SLiCAP/SLiCAPrst.py:611–640  ·  view source on GitHub ↗

Creates in inline expression. :param expr: Expression :type expression: sympy.Expr :param units: Units :type units: str :param name: Name of the variable for RST substitution. :type name: str: :

(self, expr, units="", name=None)

Source from the content-addressed store, hash-verified

609 return Snippet(RST, self.format)
610
611 def expr(self, expr, units="", name=None):
612 """
613 Creates in inline expression.
614
615 :param expr: Expression
616 :type expression: sympy.Expr
617
618 :param units: Units
619 :type units: str
620
621 :param name: Name of the variable for RST substitution.
622 :type name: str:
623
624 :return: SLiCAP Snippet object with save variable append mode
625 :rtype: SLiCAP.SLiCAPprotos.Snippet
626 """
627 if type(name) == str and len(name) > 0:
628 try:
629 units = units2TeX(units)
630 except:
631 pass
632 RST = ':math:`' + sp.latex(roundN(expr))
633 if units != '':
634 RST += '\\, \\left[ \\mathrm{' + units + '} \\right]` '
635 else:
636 RST += '` '
637 RST = '.. |' + name + '| replace:: ' + RST + '\n'
638 else:
639 raise NameError
640 return Snippet(RST, self.format, mode="a")
641
642 def eqnInline(self, LHS, RHS, units="", name=None):
643 """

Callers 1

sphinx_report.pyFile · 0.45

Calls 3

units2TeXFunction · 0.90
roundNFunction · 0.90
SnippetClass · 0.90

Tested by

no test coverage detected