task_script_utils.random module#

Utility to generate a random UUID

exception NoPreviouslyCreatedInstanceError[source]#

Bases: Exception

No previously created instance error

class CacheLast[source]#

Bases: type

Metaclass that caches the last created instance

get_last_created() T[source]#

Get the last created instance

class TSRandom(*seed: Hashable)[source]#

Bases: object

Generate random values that are not available from Python 3.7’s random module.

seed(*content: Hashable) None[source]#

Seed the random number generator.

randbytes(n_bytes: int) bytes[source]#

Generate n random bytes.

uuid() UUID[source]#

Create a pseudo random UUID

class TaskScriptUUIDGenerator(*args, **kwargs)[source]#

Bases: TSRandom

UUID generator for use in Task Scripts

classmethod from_task_script_identifier_parts(namespace: str, slug: str, version: str, file_identifier: Hashable) T[source]#

A convenience method that takes the parts of a task script identifier (namespace, slug, and version) and an identifier for the file (e.g. file location, file contents), then returns an instance of the generator class.