Skip to content

Commit

Permalink
trailing spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatera committed Nov 17, 2024
1 parent c30b65b commit 9d83489
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions sympy/printing/pretty/stringpict.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ def next(*args):

# make a list of pictures, with equal height and baseline
new_baseline = max((obj.baseline for obj in objects))
new_height_below_baseline = max(obj.height() - obj.baseline for obj in objects)
new_height_below_baseline = max(
obj.height() - obj.baseline for obj in objects)
new_height = new_baseline + new_height_below_baseline

pictures = []
Expand Down Expand Up @@ -507,23 +508,24 @@ def root(self, index=None):
@property
def s(self):
sympy_deprecation_warning(
("The attribute `s` of `StringPict` is deprecated since Sympy=1.14."
"Use `text` instead."),
deprecated_since_version="1.14",
active_deprecations_target="deprecated-pretty-printing-functions",
)
("The attribute `s` of `StringPict` is deprecated since Sympy=1.14."
"Use `text` instead."),
deprecated_since_version="1.14",
active_deprecations_target="deprecated-pretty-printing-functions",
)
return self.text

@s.setter
def s(self, value):
sympy_deprecation_warning(
("The attribute `s` of `StringPict` is deprecated since Sympy=1.14."
"Use `text` instead."),
active_deprecations_target="deprecated-pretty-printing-functions",
)
"Use `text` instead."),
deprecated_since_version="1.14",
active_deprecations_target="deprecated-pretty-printing-functions",
)
self.text = value
return self.text

def subindex(self, sub_index):
"""Add a `subindex`.
Expand Down Expand Up @@ -605,7 +607,8 @@ def stack(*args, align="c"):
objects.append(arg)

# compute new width
new_width = max(obj.width() for obj in objects if obj is not StringPict.LINE)
new_width = max(obj.width()
for obj in objects if obj is not StringPict.LINE)

line_obj = StringPict(hobj("-", new_width))

Expand Down Expand Up @@ -679,7 +682,8 @@ def v_align(self, *args, align="t"):
for offset, obj, text in zip(offsets, objects, texts)
)
elif align != "t":
raise ValueError(f"'{align}' is not a valid value or the align parameter.")
raise ValueError(
f"'{align}' is not a valid value or the align parameter.")

result = [self.__class__(text, baseline) for text in texts]
return result
Expand Down Expand Up @@ -846,15 +850,17 @@ def __truediv__(self, den, slashed=False):
num = num.right(" ")

return PrettyForm(
binding=PrettyForm.DIV, *StringPict.stack(num, StringPict.LINE, den)
binding=PrettyForm.DIV, *
StringPict.stack(num, StringPict.LINE, den)
)

@staticmethod
def apply(function, *args):
"""Functions of one or more variables."""
if function in PrettyForm.simpleFunctions:
# simple function: use only space if possible
assert len(args) == 1, f"Simple function {function} must have 1 argument"
assert len(
args) == 1, f"Simple function {function} must have 1 argument"
arg = args[0].__pretty__()
if arg.binding <= PrettyForm.DIV:
# optimization: no parentheses necessary
Expand Down

0 comments on commit 9d83489

Please sign in to comment.