katana.units.esoteric.cow — COW

Unit for Cow esoteric language.

Given target data, this unit will ignore everything that is NOT valid Cow characters and exclude them.

class katana.units.esoteric.cow.Unit(*args, **kwargs)

Bases: katana.unit.Unit

GROUPS = ['esoteric', 'cow']

These are “tags” for a unit. Considering it is a Esoteric unit, “esoteric” is included, as well as the unit name “cow”.

PRIORITY = 50

Priority works with 0 being the highest priority, and 100 being the lowest priority. 50 is the default priorty. This unit has a defualt priority.

RECURSE_SELF = False

There is no reason to recurse into yourself. We shouldn’t get cow out.

evaluate(case: Any) → None

Evaluate the target. Run the target as Cow code and give the standard output results to Katana.

Parameters:case – A case returned by enumerate. For this unit, the enumerate function is not used.
Returns:None. This function should not return any data.
katana.units.esoteric.cow.build_jumpmap(code: bytes) → dict

This is used for the Cow operations. It will match opening and closing braces for use within the Cow program.

Parameters:code – A byte string of the Cow code.
Returns:a jumpmap dictionary
katana.units.esoteric.cow.cleanup(code: bytes) → bytes

This is used for the Cow operations. It will clean the provided code to only find the appropriate Cow operators.

Parameters:code – A byte string of the Cow code.
Returns:Only the bytes of appropriate Cow operators.
katana.units.esoteric.cow.evaluate_cow(code, input_file, timeout=-1)

This function actually runs the provided Cow operations and returns the standard output.

Parameters:
  • code – The code to run as Cow.
  • input_file – A file to for the Cow program to read as standard input. If this is not provided, it will yield a newline.
  • timeout – A timeout value in seconds. After this time has elapsed, the Cow code will stop executing.
Returns:

The standard output for the Cow program,