lbry-android-sdk/p4a/pythonforandroid/recipes/sympy/fix_pretty_print.patch

224 lines
8.9 KiB
Diff
Raw Normal View History

2022-11-29 21:35:24 +01:00
diff --git a/sympy/printing/pretty/pretty.py b/sympy/printing/pretty/pretty.py
index 604e97c..ddd3eb2 100644
--- a/sympy/printing/pretty/pretty.py
+++ b/sympy/printing/pretty/pretty.py
@@ -166,14 +166,14 @@ class PrettyPrinter(Printer):
arg = e.args[0]
pform = self._print(arg)
if isinstance(arg, Equivalent):
- return self._print_Equivalent(arg, altchar=u"\N{NOT IDENTICAL TO}")
+ return self._print_Equivalent(arg, altchar=u"NOT IDENTICAL TO")
if isinstance(arg, Implies):
- return self._print_Implies(arg, altchar=u"\N{RIGHTWARDS ARROW WITH STROKE}")
+ return self._print_Implies(arg, altchar=u"RIGHTWARDS ARROW WITH STROKE")
if arg.is_Boolean and not arg.is_Not:
pform = prettyForm(*pform.parens())
- return prettyForm(*pform.left(u"\N{NOT SIGN}"))
+ return prettyForm(*pform.left(u"NOT SIGN"))
else:
return self._print_Function(e)
@@ -200,43 +200,43 @@ class PrettyPrinter(Printer):
def _print_And(self, e):
if self._use_unicode:
- return self.__print_Boolean(e, u"\N{LOGICAL AND}")
+ return self.__print_Boolean(e, u"LOGICAL AND")
else:
return self._print_Function(e, sort=True)
def _print_Or(self, e):
if self._use_unicode:
- return self.__print_Boolean(e, u"\N{LOGICAL OR}")
+ return self.__print_Boolean(e, u"LOGICAL OR")
else:
return self._print_Function(e, sort=True)
def _print_Xor(self, e):
if self._use_unicode:
- return self.__print_Boolean(e, u"\N{XOR}")
+ return self.__print_Boolean(e, u"XOR")
else:
return self._print_Function(e, sort=True)
def _print_Nand(self, e):
if self._use_unicode:
- return self.__print_Boolean(e, u"\N{NAND}")
+ return self.__print_Boolean(e, u"NAND")
else:
return self._print_Function(e, sort=True)
def _print_Nor(self, e):
if self._use_unicode:
- return self.__print_Boolean(e, u"\N{NOR}")
+ return self.__print_Boolean(e, u"NOR")
else:
return self._print_Function(e, sort=True)
def _print_Implies(self, e, altchar=None):
if self._use_unicode:
- return self.__print_Boolean(e, altchar or u"\N{RIGHTWARDS ARROW}", sort=False)
+ return self.__print_Boolean(e, altchar or u"RIGHTWARDS ARROW", sort=False)
else:
return self._print_Function(e)
def _print_Equivalent(self, e, altchar=None):
if self._use_unicode:
- return self.__print_Boolean(e, altchar or u"\N{IDENTICAL TO}")
+ return self.__print_Boolean(e, altchar or u"IDENTICAL TO")
else:
return self._print_Function(e, sort=True)
@@ -425,7 +425,7 @@ class PrettyPrinter(Printer):
if self._use_unicode:
# use unicode corners
horizontal_chr = xobj('-', 1)
- corner_chr = u'\N{BOX DRAWINGS LIGHT DOWN AND HORIZONTAL}'
+ corner_chr = u'BOX DRAWINGS LIGHT DOWN AND HORIZONTAL'
func_height = pretty_func.height()
@@ -580,7 +580,7 @@ class PrettyPrinter(Printer):
LimArg = self._print(z)
if self._use_unicode:
- LimArg = prettyForm(*LimArg.right(u'\N{BOX DRAWINGS LIGHT HORIZONTAL}\N{RIGHTWARDS ARROW}'))
+ LimArg = prettyForm(*LimArg.right(u'BOX DRAWINGS LIGHT HORIZONTALRIGHTWARDS ARROW'))
else:
LimArg = prettyForm(*LimArg.right('->'))
LimArg = prettyForm(*LimArg.right(self._print(z0)))
@@ -589,7 +589,7 @@ class PrettyPrinter(Printer):
dir = ""
else:
if self._use_unicode:
- dir = u'\N{SUPERSCRIPT PLUS SIGN}' if str(dir) == "+" else u'\N{SUPERSCRIPT MINUS}'
+ dir = u'SUPERSCRIPT PLUS SIGN' if str(dir) == "+" else u'SUPERSCRIPT MINUS'
LimArg = prettyForm(*LimArg.right(self._print(dir)))
@@ -740,7 +740,7 @@ class PrettyPrinter(Printer):
def _print_Adjoint(self, expr):
pform = self._print(expr.arg)
if self._use_unicode:
- dag = prettyForm(u'\N{DAGGER}')
+ dag = prettyForm(u'DAGGER')
else:
dag = prettyForm('+')
from sympy.matrices import MatrixSymbol
@@ -850,8 +850,8 @@ class PrettyPrinter(Printer):
if '\n' in partstr:
tempstr = partstr
tempstr = tempstr.replace(vectstrs[i], '')
- tempstr = tempstr.replace(u'\N{RIGHT PARENTHESIS UPPER HOOK}',
- u'\N{RIGHT PARENTHESIS UPPER HOOK}'
+ tempstr = tempstr.replace(u'RIGHT PARENTHESIS UPPER HOOK',
+ u'RIGHT PARENTHESIS UPPER HOOK'
+ ' ' + vectstrs[i])
o1[i] = tempstr
o1 = [x.split('\n') for x in o1]
@@ -1153,7 +1153,7 @@ class PrettyPrinter(Printer):
def _print_Lambda(self, e):
vars, expr = e.args
if self._use_unicode:
- arrow = u" \N{RIGHTWARDS ARROW FROM BAR} "
+ arrow = u" RIGHTWARDS ARROW FROM BAR "
else:
arrow = " -> "
if len(vars) == 1:
@@ -1173,7 +1173,7 @@ class PrettyPrinter(Printer):
elif len(expr.variables):
pform = prettyForm(*pform.right(self._print(expr.variables[0])))
if self._use_unicode:
- pform = prettyForm(*pform.right(u" \N{RIGHTWARDS ARROW} "))
+ pform = prettyForm(*pform.right(u" RIGHTWARDS ARROW "))
else:
pform = prettyForm(*pform.right(" -> "))
if len(expr.point) > 1:
@@ -1462,7 +1462,7 @@ class PrettyPrinter(Printer):
and expt is S.Half and bpretty.height() == 1
and (bpretty.width() == 1
or (base.is_Integer and base.is_nonnegative))):
- return prettyForm(*bpretty.left(u'\N{SQUARE ROOT}'))
+ return prettyForm(*bpretty.left(u'SQUARE ROOT'))
# Construct root sign, start with the \/ shape
_zZ = xobj('/', 1)
@@ -1558,7 +1558,7 @@ class PrettyPrinter(Printer):
from sympy import Pow
return self._print(Pow(p.sets[0], len(p.sets), evaluate=False))
else:
- prod_char = u"\N{MULTIPLICATION SIGN}" if self._use_unicode else 'x'
+ prod_char = u"MULTIPLICATION SIGN" if self._use_unicode else 'x'
return self._print_seq(p.sets, None, None, ' %s ' % prod_char,
parenthesize=lambda set: set.is_Union or
set.is_Intersection or set.is_ProductSet)
@@ -1570,7 +1570,7 @@ class PrettyPrinter(Printer):
def _print_Range(self, s):
if self._use_unicode:
- dots = u"\N{HORIZONTAL ELLIPSIS}"
+ dots = u"HORIZONTAL ELLIPSIS"
else:
dots = '...'
@@ -1641,7 +1641,7 @@ class PrettyPrinter(Printer):
def _print_ImageSet(self, ts):
if self._use_unicode:
- inn = u"\N{SMALL ELEMENT OF}"
+ inn = u"SMALL ELEMENT OF"
else:
inn = 'in'
variables = self._print_seq(ts.lamda.variables)
@@ -1653,10 +1653,10 @@ class PrettyPrinter(Printer):
def _print_ConditionSet(self, ts):
if self._use_unicode:
- inn = u"\N{SMALL ELEMENT OF}"
+ inn = u"SMALL ELEMENT OF"
# using _and because and is a keyword and it is bad practice to
# overwrite them
- _and = u"\N{LOGICAL AND}"
+ _and = u"LOGICAL AND"
else:
inn = 'in'
_and = 'and'
@@ -1677,7 +1677,7 @@ class PrettyPrinter(Printer):
def _print_ComplexRegion(self, ts):
if self._use_unicode:
- inn = u"\N{SMALL ELEMENT OF}"
+ inn = u"SMALL ELEMENT OF"
else:
inn = 'in'
variables = self._print_seq(ts.variables)
@@ -1690,7 +1690,7 @@ class PrettyPrinter(Printer):
def _print_Contains(self, e):
var, set = e.args
if self._use_unicode:
- el = u" \N{ELEMENT OF} "
+ el = u" ELEMENT OF "
return prettyForm(*stringPict.next(self._print(var),
el, self._print(set)), binding=8)
else:
@@ -1698,7 +1698,7 @@ class PrettyPrinter(Printer):
def _print_FourierSeries(self, s):
if self._use_unicode:
- dots = u"\N{HORIZONTAL ELLIPSIS}"
+ dots = u"HORIZONTAL ELLIPSIS"
else:
dots = '...'
return self._print_Add(s.truncate()) + self._print(dots)
@@ -1708,7 +1708,7 @@ class PrettyPrinter(Printer):
def _print_SeqFormula(self, s):
if self._use_unicode:
- dots = u"\N{HORIZONTAL ELLIPSIS}"
+ dots = u"HORIZONTAL ELLIPSIS"
else:
dots = '...'