pynetdicom.utils.pretty_bytes

pynetdicom.utils.pretty_bytes(bytestream: bytes | BytesIO, prefix: str = '  ', delimiter: str = '  ', items_per_line: int = 16, max_size: int | None = 512, suffix: str = '') List[str][source]

Turn the bytestring bytestream into a list of nicely formatted str.

Parameters:
  • bytestream (bytes or io.BytesIO) – The bytes to convert to a nicely formatted string list

  • prefix (str) – Insert prefix at the start of every item in the output string list

  • delimiter (str) – Delimit each of the bytes in bytestream using delimiter

  • items_per_line (int) – The number of bytes in each item of the output string list.

  • max_size (int or None) – The maximum number of bytes to add to the output string list. A value of None indicates that all of bytestream should be output.

  • suffix (str) – Append suffix to the end of every item in the output string list

Returns:

The output string list

Return type:

list of str