titus.genpy.unpackElse

titus.genpy.unpackElse(state, scope, bytes, format, thenClause, elseClause)[source]

Helper function for unpack with an else clause as an expression.

Parameters:
  • state (titus.genpy.ExecutionState) – exeuction state
  • scope (titus.util.DynamicScope) – dynamic scope object
  • bytes (string) – byte array to unpack
  • thenClause (callable) – function that is called if there was no titus.genpy.MisalignedPacking exception
  • elseClause (callable) – function that is called if there was an titus.genpy.MisalignedPacking exception
Return type:

result of thenClause or elseClause

Returns:

if there was no titus.genpy.MisalignedPacking exception, returns result of thenClause, otherwise, returns result of elseClause