vidua.bps module

Validate and apply BPS patches.

vidua.bps.decode_number(bps_patch)

Return the next number in bps_patch.

Parameters:

bps_patch (BinaryIO) – the patch file

Return type:

int

vidua.bps.patch(source, bps_patch)

Return the patched source.

Parameters:
  • source (BinaryIO) – the source file to be patched

  • bps_patch (BinaryIO) – the patch file

Return type:

BinaryIO

vidua.bps.patch_info(bps_patch)

Return a dictionary of information about the patch.

>>> patch_info(bps_patch)
{'target_size': 24,
 'metadata': b'',
 'target_checksum': 2648610592,
 'source_checksum': 3418748557,
 'source_size': 37}
Parameters:

bps_patch (BinaryIO) – the patch file

Return type:

dict

vidua.bps.validate_checksum(source, bps_patch)

Ensure that the source file matches the checksum in the patch.

If the checksum matches, return. Otherwise, raise a ValueError.

Parameters:
  • source (BinaryIO) – the file to be patched

  • bps_patch (BinaryIO) – the patch file

vidua.bps.validate_patch(bps_patch)

Verify that bps_patch is a valid BPS patch.

If the patch is valid, return. If the patch is invalid, raise a ValueError describing the problem.

Parameters:

bps_patch (BinaryIO) – the patch file