nornir_shared

Nornir Shared Package

Functions shared across the various Nornir and connectomics packages live in this module.

checksum

nornir_shared.checksum.DataChecksum(data: str | list | bytes | None) → str | None[source]

Removes whitespace from strings before calculating md5 checksum

Parameters:

data (obj) – string, list or object convertible to string

Returns:

md5 checksum

Rtype str:

nornir_shared.checksum.FileChecksum(filename: str) → str | None[source]

Return the md5 hash of a file’s raw bytes.

Parameters:

filename (str) – path to file

Returns:

md5 checksum

Rtype str:

Raises:

FileNotFoundError – If the file does not exist

nornir_shared.checksum.FilesizeChecksum(filename) → str | None[source]

Returns the size of a file in bytes for use as a simple checksum

Parameters:

filename (str) – path to file

Returns:

Size of file as a string

Return type:

str

Raises:

FileNotFoundError – If the file does not exist

emaillib

class nornir_shared.emaillib.EmailArgs(host, username, password, subject, toAddresses, ccAddresses, fromAddress, fromFriendlyAddress, message, files, port)[source]

Bases: NamedTuple

ccAddresses: List[str] | str | None

Alias for field number 5

files: List[str]

Alias for field number 9

fromAddress: str

Alias for field number 6

fromFriendlyAddress: str

Alias for field number 7

host: str

Alias for field number 0

message: str

Alias for field number 8

password: str | None

Alias for field number 2

port: int

Alias for field number 10

subject: str

Alias for field number 3

toAddresses: List[str] | str

Alias for field number 4

username: str | None

Alias for field number 1

nornir_shared.emaillib.SendMail(args: EmailArgs)[source]

Sends an email