Utils

Utils is a collection of small utility helper functions

utils

siginfo.utils.left_string(string: str, padding: int) str[source]

Formats a string with padding. Either adds spaces to the end or truncates

Parameters:
  • string (str) – String for printing

  • padding (int) – Width (in columns) for the final format

Return type:

str

If string is longer than padding, it will be trimmed with ellipses

Example

left_string('A very long string', 10)
# => 'A very ...'

left_string('short', 10)
# => 'short     '