<s> import logging <EOL> from polaris_health import Error <EOL> __all__ = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> LOG = logging . getLogger ( __name__ ) <EOL> LOG . addHandler ( logging . NullHandler ( ) ) <EOL> MIN_INTERVAL = <NUM_LIT:1> <EOL> MAX_INTERVAL = <NUM_LIT> <EOL> MIN_TIMEOUT = <NUM_LIT:0.1> <EOL> MAX_TIMEOUT = <NUM_LIT:5> <EOL> MIN_RETRIES = <NUM_LIT:0> <EOL> MAX_RETRIES = <NUM_LIT:5> <EOL> class BaseMonitor : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , interval , timeout , retries ) : <EOL> if ( not isinstance ( interval , ( int , float ) ) <EOL> or interval < MIN_INTERVAL <EOL> or interval > MAX_INTERVAL ) : <EOL> log_msg = ( '<STR_LIT>' . <EOL> format ( interval , MIN_INTERVAL , MAX_INTERVAL ) ) <EOL> raise Error ( log_msg ) <EOL> else : <EOL> self . interval = interval <EOL> if ( not isinstance ( timeout , ( int , float ) ) <EOL> or timeout < MIN_TIMEOUT <EOL> or timeout > MAX_TIMEOUT ) : <EOL> log_msg = ( '<STR_LIT>' . <EOL> format ( timeout , MIN_TIMEOUT , MAX_TIMEOUT ) ) <EOL> raise Error ( log_msg ) <EOL> else : <EOL> self . timeout = timeout <EOL> if ( not isinstance ( retries , int ) <EOL> or retries < MIN_RETRIES <EOL> or retries > MAX_RETRIES ) : <EOL> log_msg = ( '<STR_LIT>' . <EOL> format ( retries , MIN_RETRIES , MAX_RETRIES ) ) <EOL> raise Error ( log_msg ) <EOL> else : <EOL> self . retries = retries <EOL> def run ( self , dst_ip ) : <EOL> raise NotImplementedError <EOL> from . http import HTTP <EOL> from . tcp import TCP <EOL> registered = { <EOL> '<STR_LIT:http>' : HTTP , <EOL> '<STR_LIT>' : TCP , <EOL> } </s>
