Public types

Shared public types and safe conversion helpers.

pychef.types.to_bytes(value, encoding='utf-8', errors='strict')

Return value as bytes without silently using a locale encoding.

Parameters:
  • value (str | bytes)

  • encoding (str)

  • errors (str)

Return type:

bytes

pychef.types.to_text(value, encoding='utf-8', errors='replace')

Return value as text with CyberChef-like replacement on invalid UTF-8.

Parameters:
  • value (str | bytes)

  • encoding (str)

  • errors (str)

Return type:

str

class pychef.types.RecipeStep(op, args=(), disabled=False, breakpoint=False)

Bases: object

One immutable CyberChef-compatible recipe step.

Parameters:
  • op (str)

  • args (tuple[Any, ...])

  • disabled (bool)

  • breakpoint (bool)

op: str
args: tuple[Any, ...]
disabled: bool
breakpoint: bool
class pychef.types.BakeResult(result, type, progress, duration_ms, error=None)

Bases: object

Detailed result returned by Chef.bake_result().

Parameters:
  • result (str | bytes)

  • type (Literal['string', 'bytes'])

  • progress (int)

  • duration_ms (float)

  • error (Exception | None)

result: str | bytes
type: Literal['string', 'bytes']
progress: int
duration_ms: float
error: Exception | None