ait.core.gds module

AIT Ground Data System

The ait.core.gds module provides utility functions specific to GDS command-line tools.

ait.core.gds.compress(input_filename, output_filename=None, verbose=False) → integer

Uses zlib to compress input_filename and store the result in output_filename. The size of output_filename is returned on success; zero is returned on failure.

The input file is compressed in one fell swoop. The output_filename defaults to input_filename + “.ait-zlib”.

If verbose is True, compress() will use ait.core.log.info() to report compression statistics.

ait.core.gds.hexdump(bytes[, addr[, preamble[, printfunc[, stepsize=16]]]])

Outputs bytes in hexdump format lines similar to the following (here preamble=’Bank1’, stepsize=8, and len(bytes) == 15):

Bank1: 0xFD020000: 7f45  4c46  0102  0100  *.ELF....*
Bank1: 0xFD020008: 0000  0000  0000  00    *....... *

Where stepsize controls the number of bytes per line. If addr is omitted, the address portion of the hexdump will not be output. Lines will be passed to printfunc for output, or Python’s builtin print, if printfunc is omitted.

If a byte is not in the range [32, 127), a period will rendered for the character portion of the output.

ait.core.gds.hexdump_line(_bytes: ByteString, length: Optional[int] = None) → str

Create a hexdump formatted line for supplied bytes.

If length is greater than len(_bytes), the line will be padded with ASCII space characters to indicate no byte data is present.

Arguments:

_bytes: The bytes to format.

length (optional): The optional length of the output line. This should be
greater than the length of bytes if provided.
Returns:
The hexdump formatted line.