<s> from datetime import datetime , time as pytime <EOL> from atom . api import Typed , ForwardTyped , observe <EOL> from enaml . core . declarative import d_ <EOL> from . control import Control , ProxyControl <EOL> class ProxyBoundedTime ( ProxyControl ) : <EOL> """<STR_LIT>""" <EOL> declaration = ForwardTyped ( lambda : BoundedTime ) <EOL> def set_minimum ( self , minimum ) : <EOL> raise NotImplementedError <EOL> def set_maximum ( self , maximum ) : <EOL> raise NotImplementedError <EOL> def set_time ( self , time ) : <EOL> raise NotImplementedError <EOL> class BoundedTime ( Control ) : <EOL> """<STR_LIT>""" <EOL> minimum = d_ ( Typed ( pytime , args = ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) ) ) <EOL> maximum = d_ ( Typed ( pytime , args = ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) ) <EOL> time = d_ ( Typed ( pytime , factory = lambda : datetime . now ( ) . time ( ) ) ) <EOL> proxy = Typed ( ProxyBoundedTime ) <EOL> @ observe ( ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:time>' ) ) <EOL> def _update_proxy ( self , change ) : <EOL> """<STR_LIT>""" <EOL> super ( BoundedTime , self ) . _update_proxy ( change ) <EOL> def _post_setattr_minimum ( self , old , new ) : <EOL> """<STR_LIT>""" <EOL> if new > self . maximum : <EOL> self . maximum = new <EOL> if new > self . time : <EOL> self . time = new <EOL> def _post_setattr_maximum ( self , old , new ) : <EOL> """<STR_LIT>""" <EOL> if new < self . minimum : <EOL> self . minimum = new <EOL> if new < self . time : <EOL> self . time = new <EOL> def _post_validate_time ( self , old , new ) : <EOL> """<STR_LIT>""" <EOL> return max ( self . minimum , min ( new , self . maximum ) ) </s>
