cryptoolz package

Subpackages

Submodules

cryptoolz.base module

class cryptoolz.base.AdHoc[source]

Bases: object

static ListMorph(index) Callable[[...], Any][source]
class cryptoolz.base.Super[source]

Bases: object

static PreCall(func)[source]

cryptoolz.factory module

class cryptoolz.factory.Factory(constructor: Callable[..., FactoryItem], exception_handler: Callable[[Exception], None] = None, defaults: Optional[dict[str, Any]] = None, maxsize=0)[source]

Bases: Queue, Generic[FactoryItem]

constructor: Callable[..., FactoryItem]
create(store: bool = False) FactoryItem[source]
defaults: Optional[dict[str, Any]] = None
put(*args, **kwargs) Any

Put an item into the queue.

If optional args ‘block’ is true and ‘timeout’ is None (the default), block if necessary until a free slot is available. If ‘timeout’ is a non-negative number, it blocks at most ‘timeout’ seconds and raises the Full exception if no free slot was available within that time. Otherwise (‘block’ is false), put an item on the queue if a free slot is immediately available, else raise the Full exception (‘timeout’ is ignored in that case).

stored: List[FactoryItem] = []
stream(some: int = 0) Generator[FactoryItem, None, None][source]

cryptoolz.printer module

class cryptoolz.printer.Base64Writer[source]

Bases: Writer

character_encoding: str = 'ascii'
decode(data: str) bytes[source]
encode(data: bytes) str[source]
write(data: AnyStr, *args, **kwargs) None[source]
class cryptoolz.printer.FormatWriter[source]

Bases: Writer

character_encoding: str = 'ascii'
abstract decode(data: Any, *args, **kwargs) Any[source]
decode_template_pattern: str
abstract encode(data: Any, *args, **kwargs) Any[source]
format_template: str = None
format_template_base: str
abstract set_format(inserts: List[str]) str[source]
write(data: AnyStr, *args, **kwargs) None[source]
class cryptoolz.printer.HexWriter[source]

Bases: Writer

decode(data: str) bytes[source]
encode(data: bytes) str[source]
write(data: AnyStr, *args, **kwargs) None[source]
class cryptoolz.printer.PEMWriter[source]

Bases: FormatWriter

decode(*args, **kwargs)
decode_template_pattern: str = '-+(BEGIN|END) [ A-Z]+-+'
encode(*args, **kwargs)
format_template_base: str = '-----BEGIN {}-----\n\n{}\n\n-----END {}-----\n'
set_format(inserts: List[str]) None[source]
class cryptoolz.printer.PlainWriter[source]

Bases: Writer

decode(data: Any) Any[source]
encode(data: Any) Any[source]
write(data: AnyStr, *args, **kwargs) None[source]
class cryptoolz.printer.Printer(maxsize=0)[source]

Bases: Queue

print(*args, **kwargs) None[source]
put(*args, **kwargs) Any

Put an item into the queue.

If optional args ‘block’ is true and ‘timeout’ is None (the default), block if necessary until a free slot is available. If ‘timeout’ is a non-negative number, it blocks at most ‘timeout’ seconds and raises the Full exception if no free slot was available within that time. Otherwise (‘block’ is false), put an item on the queue if a free slot is immediately available, else raise the Full exception (‘timeout’ is ignored in that case).

writer: Writer
class cryptoolz.printer.QRCodeWriter[source]

Bases: Base64Writer

decode(data: str, **kwargs) bytes[source]
encode(data: bytes, **kwargs) str[source]
write(data: AnyStr, *args, **kwargs) None[source]
class cryptoolz.printer.Writer[source]

Bases: ABC

Derived classes of this base class should implement logic for essentially writing data to some buffer, preparing that data for writing, and also decoding it when reading it out of some buffer.

Encoding and decoding thus, is not to be taken in the str and bytes sense, of encoding to bytes and decoding from bytes to str, and instead in the sense of encoding arbitrary data in some way, and decoding it back to some format.

We specify that each function has to at least take one data argument. Everything further is laissez faire including narrowing and expanding arguments in derived classes to enforce behaviour.

abstract decode(data: Any, *args, **kwargs) Any[source]
abstract encode(data: Any, *args, **kwargs) Any[source]
abstract write(data: Any, *args, **kwargs) None[source]

cryptoolz.utils module

cryptoolz.utils.get_next_free_po(po: Path) Path[source]
cryptoolz.utils.get_resource(filename: str) Any[source]
cryptoolz.utils.match_value(cases: Dict[str, Any], value: Any) Any[source]
cryptoolz.utils.match_values(cases: Dict[str, Any], *values: List[Any]) Any[source]
cryptoolz.utils.process_naked_b64(b64_lines_block: List[str], context_chunks: List[Union[str, List[str]]]) List[str][source]
cryptoolz.utils.process_pem_file(pem_encoded: List[str], context_chunks: List[Union[str, List[str]]]) List[str][source]

Module contents

Top-level package for cryptoolz.