snakeoil.chksum package

Submodules

Module contents

chksum verification/generation subsystem

class snakeoil.chksum.LazilyHashedPath(path, **initial_values)[source]

Bases: object

Given a pathway, compute chksums on demand via attribute access.

clear()[source]
exception snakeoil.chksum.MissingChksumHandler[source]

Bases: Exception

A requested checksum handler doesn’t exist on the system.

snakeoil.chksum.get_chksums(location, *chksums, **kwds)[source]

run multiple chksumers over a data_source/file path

Note that if you need multiple chksums for a file, you should invoke this with all desired chksums- the implementation will do some internal efficiency tricks (doing the IO once for example).

Parameters:
  • location – either a data_source, or a filepath to generate chksum data for

  • chksums – variable arg, the name of the chksums desired. These need to be valid chksums known in chksum_types

Returns:

a list of chksums, matching the order of requested chksums

snakeoil.chksum.get_handler(requested)[source]

get a chksum handler

Raises:

MissingChksumHandler – if chksum type has no registered handler

Returns:

chksum handler (callable)

snakeoil.chksum.get_handlers(requested=None)[source]

get multiple chksum handlers

Parameters:

requested – None (all handlers), or a sequence of the specific handlers desired.

Raises:

MissingChksumHandler – if requested chksum type has no registered handler

Returns:

dict of chksum_type:chksum handler

snakeoil.chksum.init(additional_handlers=None)[source]

init the chksum subsystem.

Scan dirname(__file__), find what handlers are available, and load them.

Parameters:

additional_handlers – None, or pass in a dict of type:func