Template Functions

class wishbone.function.template.choice.Choice(values)[source]

Returns a random element from the provided values.

A Wishbone template function which returns a random element from the provided values.

Parameters:values – An list of elements to choose from
get()[source]

The function mapped to the template function.

Parameters:None
Returns:An element of the provided values.
Return type:obj
class wishbone.function.template.cycle.Cycle(values)[source]

Cycles through the provided array returning the next element.

A Wishbone template function which returns the next value of an array.

This function rotates through the elements in the provided array always returning the next element. The order is fixed and when the end is reached the first element is returned again.

Parameters:values – A list of elements to cycle through.
get()[source]

The function mapped to the template function.

Parameters:None
Returns:An element of the provided array.
Return type:obj
class wishbone.function.template.environment.Environment[source]

Returns environment variables

A Wishbone template function wich return environment variables.

Parameters:None
get(variable)[source]

The function mapped to the template function.

Parameters:variable – The environment variable
Returns:The environment value
Return type:str
class wishbone.function.template.epoch.Epoch[source]

Returns epoch with sub second accuracy as a float.

A Wishbone template function which returns the PID of the current process.

Parameters:None
get()[source]

The function mapped to the template function.

Parameters:None
Returns:The epoch time.
Return type:float
class wishbone.function.template.pid.PID[source]

Returns the PID of the current process.

A Wishbone template function which returns the PID of the current process.

Parameters:None
get()[source]

The function mapped to the template function.

Parameters:None
Returns:The current PID.
Return type:int
class wishbone.function.template.random_bool.RandomBool[source]

Randomly returns True or False.

A Wishbone template function which returns a random bool.

Parameters:None
get()[source]

The function mapped to the template function.

Parameters:None
Returns:A random number.
Return type:int
class wishbone.function.template.random_integer.RandomInteger(minimum=0, maximum=0)[source]

Returns a random integer.

A Wishbone template function which returns a random integer between <min> and <max>.

Parameters:
  • minimum – The minimum of the range.
  • maximum – The maximum of the range.
get()[source]

The function mapped to the template function.

Parameters:None
Returns:A random number.
Return type:int
class wishbone.function.template.random_uuid.RandomUUID[source]

Returns a UUID value.

A Wishbone template function which returns a UUID.

Parameters:None
get()[source]

The function mapped to the template function.

Parameters:None
Returns:A UUID
Return type:str
class wishbone.function.template.random_word.RandomWord(filename=None, encoding='latin-1')[source]

Returns a random word.

A Wishbone template function which returns a randomly selected word from a word list.

Parameters:
  • filename – When None, a built-in word list is used otherwise the referenced file is loaded.
  • encoding – The encoding used to read the file.
get()[source]

The function mapped to the template function.

Parameters:None
Returns:A random word
Return type:str
class wishbone.function.template.regex.Regex[source]

Regex matching on a string.

A wishbone template function to do regex matching on strings. Useful for conditional statements.

Parameters:None
get(pattern, string)[source]

The function mapped to the template function.

Parameters:
  • pattern – The regex to apply.
  • string – The data to evaluate.
Returns:

True if regex matches if not False

Return type:

Bool

class wishbone.function.template.strftime.STRFTime[source]

Returns a formatted version of an epoch timestamp.

A Wishbone template function to return a formatted version of an epoch timestamp.

Parameters:None
get(epoch, template)[source]

The function mapped to the template function.

Parameters:
  • epoch – The epoch value
  • template – The Arrow template to generate the time string.
Returns:

A timestamp

Return type:

str