def _stateMeetsRule(state, rule):
 if rule.HasField('phase'):
  if (rule.phase != state.phase):
   return False
 if rule.HasField('min_level'):
  if (state.level < rule.min_level):
   return False
 if rule.HasField('max_level'):
  if (state.level > rule.max_level):
   return False
 for stage in rule.stage:
  if (stage not in state.stage):
   return False
 for stage in rule.not_stage:
  if (stage in state.stage):
   return False
 return True

def _stateMeetsRule ( state , rule ) : if rule . HasField ( 'phase' ) : if ( rule . phase != state . phase ) : return False if rule . HasField ( 'min_level' ) : if ( state . level < rule . min_level ) : return False if rule . HasField ( 'max_level' ) : if ( state . level > rule . max_level ) : return False for stage in rule . stage : if ( stage not in state . stage ) : return False for stage in rule . not_stage : if ( stage in state . stage ) : return False return True
returns true if the given state meets the given rule logic copied from caffes net::statemeetsrule() .