Operation registry

Thread-safe operation registry.

class pychef.registry.Operation(name, function, category='')

Bases: object

Metadata and implementation for a registered operation.

Parameters:
  • name (str)

  • function (Callable[[str | bytes, Sequence[Any]], str | bytes])

  • category (str)

name: str
function: Callable[[str | bytes, Sequence[Any]], str | bytes]
category: str
run(value, args=())
Parameters:
  • value (str | bytes)

  • args (Sequence[Any])

Return type:

str | bytes

class pychef.registry.OperationRegistry

Bases: object

Case-sensitive registry matching CyberChef’s public operation names.

register(operation)
Parameters:

operation (Operation)

Return type:

None

get(name)
Parameters:

name (str)

Return type:

Operation

names()
Return type:

tuple[str, …]

pychef.registry.operation(name, *, category='')

Register a function under an exact CyberChef operation name.

Parameters:
  • name (str)

  • category (str)

Return type:

Callable[[Callable[[str | bytes, Sequence[Any]], str | bytes]], Callable[[str | bytes, Sequence[Any]], str | bytes]]

pychef.registry.implementation(name, *, category='')

Annotate a shared implementation without registering it directly.

Built-in operations are registered by their dedicated modules under pychef.operations.by_operation. Keeping this lightweight decorator on shared implementations retains readable operation metadata next to the algorithm while ensuring that every public operation has exactly one file.

Parameters:
  • name (str)

  • category (str)

Return type:

Callable[[Callable[[str | bytes, Sequence[Any]], str | bytes]], Callable[[str | bytes, Sequence[Any]], str | bytes]]