Skip to content

Commit

Permalink
restoring parens as it was before. Adding parenthesis with the new be…
Browse files Browse the repository at this point in the history
…havior
  • Loading branch information
mmatera committed Nov 14, 2024
1 parent 4dec809 commit 15b7835
Show file tree
Hide file tree
Showing 12 changed files with 139 additions and 119 deletions.
2 changes: 1 addition & 1 deletion sympy/physics/quantum/anticommutator.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def _pretty(self, printer, *args):
pform = printer._print(self.args[0], *args)
pform = pform.right(prettyForm(','))
pform = pform.right(printer._print(self.args[1], *args))
pform = pform.parens(left='{', right='}')
pform = pform.parenthesis(left='{', right='}')
return pform

def _latex(self, printer, *args):
Expand Down
6 changes: 3 additions & 3 deletions sympy/physics/quantum/cg.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def _pretty(self, printer, *args):
for _ in range(vsep):
D = D.below(' ')
D = D.below(D_row)
D = D.parens()
D = D.parenthesis()
return D

def _latex(self, printer, *args):
Expand Down Expand Up @@ -318,7 +318,7 @@ def _pretty(self, printer, *args):
for _ in range(vsep):
D = D.below(' ')
D = D.below(D_row)
D = D.parens(left='{', right='}')
D = D.parenthesis(left='{', right='}')
return D

def _latex(self, printer, *args):
Expand Down Expand Up @@ -422,7 +422,7 @@ def _pretty(self, printer, *args):
for _ in range(vsep):
D = D.below(' ')
D = D.below(D_row)
D = D.parens(left='{', right='}')
D = D.parenthesis(left='{', right='}')
return D

def _latex(self, printer, *args):
Expand Down
2 changes: 1 addition & 1 deletion sympy/physics/quantum/commutator.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def _pretty(self, printer, *args):
pform = printer._print(self.args[0], *args)
pform = pform.right(prettyForm(','))
pform = pform.right(printer._print(self.args[1], *args))
pform = pform.parens(left='[', right=']')
pform = pform.parenthesis(left='[', right=']')
return pform

def _latex(self, printer, *args):
Expand Down
4 changes: 2 additions & 2 deletions sympy/physics/quantum/hilbert.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ def _pretty(self, printer, *args):
next_pform = printer._print(self.args[i], *args)
if isinstance(self.args[i], (DirectSumHilbertSpace,
TensorProductHilbertSpace)):
next_pform = next_pform.parens(left='(', right=')')
next_pform = next_pform.parenthesis(left='(', right=')')
pform = pform.right(next_pform)
if i != length - 1:
if printer._use_unicode:
Expand Down Expand Up @@ -522,7 +522,7 @@ def _pretty(self, printer, *args):
next_pform = printer._print(self.args[i], *args)
if isinstance(self.args[i], (DirectSumHilbertSpace,
TensorProductHilbertSpace)):
next_pform = next_pform.parens(left='(', right=')')
next_pform = next_pform.parenthesis(left='(', right=')')
pform = pform.right(next_pform)
if i != length - 1:
if printer._use_unicode:
Expand Down
4 changes: 2 additions & 2 deletions sympy/physics/quantum/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def _print_contents_pretty(self, printer, *args):
else:
pform = self._print_operator_name_pretty(printer, *args)
label_pform = self._print_label_pretty(printer, *args)
label_pform = label_pform.parens(left='(', right=')')
label_pform = label_pform.parenthesis(left='(', right=')')
pform = pform.right(label_pform)
return pform

Expand Down Expand Up @@ -649,7 +649,7 @@ def _print_pretty(self, printer, *args):
pform = self._print_operator_name_pretty(printer, *args)
label_pform = self._print_label_pretty(printer, *args)
label_pform = prettyForm(
*label_pform.parens(left='(', right=')')
*label_pform.parenthesis(left='(', right=')')
)
pform = pform.right(label_pform)
return pform
2 changes: 1 addition & 1 deletion sympy/physics/quantum/qexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def _print_superscript_pretty(self, a, b):
return a**b

def _print_parens_pretty(self, pform, left='(', right=')'):
return pform.parens(left=left, right=right)
return pform.parenthesis(left=left, right=right)

# Printing of labels (i.e. args)

Expand Down
2 changes: 1 addition & 1 deletion sympy/physics/quantum/spin.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ def _pretty(self, printer, *args):

s = prettyForm('D' + ' '*pad)

args = args.parens()
args = args.parenthesis()
s = s.above(top)
s = s.below(bot)
s = s.right(args)
Expand Down
4 changes: 2 additions & 2 deletions sympy/physics/quantum/tensorproduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def _pretty(self, printer, *args):
next_pform = next_pform.right(', ')

if len(self.args[i].args) > 1:
next_pform = next_pform.parens(left='{', right='}')
next_pform = next_pform.parenthesis(left='{', right='}')
pform = pform.right(next_pform)
if i != length - 1:
pform = pform.right(',' + ' ')
Expand All @@ -195,7 +195,7 @@ def _pretty(self, printer, *args):
for i in range(length):
next_pform = printer._print(self.args[i], *args)
if isinstance(self.args[i], (Add, Mul)):
next_pform = next_pform.parens(left='(', right=')')
next_pform = next_pform.parenthesis(left='(', right=')')
pform = pform.right(next_pform)
if i != length - 1:
if printer._use_unicode:
Expand Down
2 changes: 1 addition & 1 deletion sympy/physics/vector/dyadic.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def render(self, *args, **kwargs):
elif v[0] != 0:
if isinstance(v[0], Add):
arg_str = mpp._print(
v[0]).parens()[0]
v[0]).parenthesis()[0]
else:
arg_str = mpp.doprint(v[0])
if arg_str.startswith("-"):
Expand Down
2 changes: 1 addition & 1 deletion sympy/physics/vector/vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def juxtapose(a, b):
pa = printer._print(a)
pb = printer._print(b)
if a.is_Add:
pa = prettyForm(*pa.parens())
pa = prettyForm(*pa.parenthesis())
return printer._print_seq([pa, pb], delimiter=' ')

for M, N in self.args:
Expand Down
Loading

0 comments on commit 15b7835

Please sign in to comment.