-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathfix_pretty_print.patch
More file actions
223 lines (198 loc) · 8.93 KB
/
fix_pretty_print.patch
File metadata and controls
223 lines (198 loc) · 8.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
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 = '...'