Documentation¶
-
fsc.formatting.
shorten
(obj, length=50, show_number=True)[source]¶ Returns the str representation of an object and shortens it if longer than
length
.Parameters: - obj – Any python object that should be converted to a string.
- length (int) – The maximal length of the resulting string.
- show_number (bool) – Controls whether the number of omitted characters is shown (
<...N...>
) or not (<...>
).
- Returns:
- str. This string is guaranteed to have maximal size
length
.
-
fsc.formatting.
to_box
(iterable, width=70, padding='auto', centering_line='longest')[source]¶ Returns a string where a box is drawn around the given string (or iterable of strings). The length of each line should not be longer than the width of the box, otherwise the box might look bad.
Parameters: - width (int) – Width of the box, without the box itself.
- padding (int) – Space on the left side of the string. Per default (
padding='auto'
), the padding is such that thecentering_line
is centered. - centering_line (str) – Determines which line should be centered. Valid arguments are ‘first’ and ‘longest’.