Skip to content

Commit

Permalink
[Python] Detect width of terminal for SolutionArray.__repr__
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl committed Apr 10, 2023
1 parent 43c37d1 commit 2a02bb3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion interfaces/cython/cantera/solutionbase.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
cimport numpy as np
import numpy as np
from pathlib import PurePath
from os import get_terminal_size
import warnings

from .thermo cimport *
Expand Down Expand Up @@ -519,7 +520,11 @@ cdef class SolutionArrayBase:
return dest

def __repr__(self):
return self.info()
try:
width = get_terminal_size().columns
except:
width = 100
return self.info(width=width)

@property
def size(self):
Expand Down

0 comments on commit 2a02bb3

Please sign in to comment.