<s> import datetime <EOL> class Field ( object ) : <EOL> def __call__ ( self , raw ) : <EOL> return raw <EOL> class Boolean ( Field ) : <EOL> def __call__ ( self , raw ) : <EOL> print raw <EOL> return [ '<STR_LIT:false>' , '<STR_LIT:true>' ] [ int ( raw ) ] <EOL> class String ( Field ) : <EOL> pass <EOL> class Number ( Field ) : <EOL> pass <EOL> class Float ( Field ) : <EOL> pass <EOL> class Percentage ( Field ) : <EOL> def __call__ ( self , raw ) : <EOL> return '<STR_LIT>' % ( float ( raw ) , ) <EOL> class State ( Field ) : <EOL> states = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> def __call__ ( self , raw ) : <EOL> return self . states [ int ( raw ) ] <EOL> class Time ( Field ) : <EOL> def __call__ ( self , raw ) : <EOL> value = int ( raw ) <EOL> if value : <EOL> return str ( datetime . datetime . fromtimestamp ( value ) ) <EOL> else : <EOL> return '<STR_LIT>' <EOL> class Type ( Field ) : <EOL> types = [ ] <EOL> def __call__ ( self , raw ) : <EOL> try : <EOL> return self . types [ int ( raw ) ] <EOL> except IndexError : <EOL> return '<STR_LIT>' <EOL> class AcknowledgementType ( Type ) : <EOL> types = [ '<STR_LIT:none>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> class CheckOptionType ( Type ) : <EOL> types = [ '<STR_LIT:none>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> class CheckType ( Type ) : <EOL> types = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> class StateType ( Type ) : <EOL> types = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> class EntryType ( Type ) : <EOL> types = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ] <EOL> FIELDS = dict ( <EOL> acknowledgement_type = AcknowledgementType ( ) , <EOL> active_checks_enabled = Boolean ( ) , <EOL> author = String ( ) , <EOL> check_command = String ( ) , <EOL> check_execution_time = Float ( ) , <EOL> check_interval = Float ( ) , <EOL> check_latency = Float ( ) , <EOL> check_options = CheckOptionType ( ) , <EOL> check_period = String ( ) , <EOL> check_type = CheckType ( ) , <EOL> comment_data = String ( ) , <EOL> comment_id = Number ( ) , <EOL> current_attempt = Number ( ) , <EOL> current_event_id = Number ( ) , <EOL> current_notification_id = Number ( ) , <EOL> current_notification_number = Number ( ) , <EOL> current_problem_id = Number ( ) , <EOL> current_state = State ( ) , <EOL> entry_time = Time ( ) , <EOL> entry_type = EntryType ( ) , <EOL> event_handler = String ( ) , <EOL> event_handler_enabled = Boolean ( ) , <EOL> expire_time = Time ( ) , <EOL> expires = Boolean ( ) , <EOL> failure_prediction_enabled = Boolean ( ) , <EOL> flap_detection_enabled = Boolean ( ) , <EOL> has_been_checked = Boolean ( ) , <EOL> host_name = String ( ) , <EOL> is_flapping = String ( ) , <EOL> last_check = Time ( ) , <EOL> last_event_id = Number ( ) , <EOL> last_hard_state = State ( ) , <EOL> last_hard_state_change = Time ( ) , <EOL> last_notification = Time ( ) , <EOL> last_problem_id = Number ( ) , <EOL> last_state_change = Time ( ) , <EOL> last_time_critical = Time ( ) , <EOL> last_time_down = Time ( ) , <EOL> last_time_ok = Time ( ) , <EOL> last_time_unknown = Time ( ) , <EOL> last_time_unreachable = Time ( ) , <EOL> last_time_up = Time ( ) , <EOL> last_time_warning = Time ( ) , <EOL> last_update = Time ( ) , <EOL> long_plugin_output = String ( ) , <EOL> max_attempts = Number ( ) , <EOL> modified_attributes = Number ( ) , <EOL> next_check = Time ( ) , <EOL> next_notification = Time ( ) , <EOL> no_more_notifications = Boolean ( ) , <EOL> notification_period = String ( ) , <EOL> notifications_enabled = Boolean ( ) , <EOL> obsess_over_host = Boolean ( ) , <EOL> obsess_over_service = Boolean ( ) , <EOL> passive_checks_enabled = Boolean ( ) , <EOL> percent_state_change = Percentage ( ) , <EOL> performance_data = String ( ) , <EOL> persistent = Boolean ( ) , <EOL> plugin_output = String ( ) , <EOL> problem_has_been_acknowledged = Boolean ( ) , <EOL> process_performance_data = Boolean ( ) , <EOL> retry_interval = Float ( ) , <EOL> scheduled_downtime_depth = Number ( ) , <EOL> service_description = String ( ) , <EOL> should_be_scheduled = Boolean ( ) , <EOL> state_type = StateType ( ) , <EOL> ) </s>
