<s> from wq . io import TimeSeriesMapper , XmlParser , BaseIO <EOL> from datetime import datetime <EOL> from climata . base import WebserviceLoader , FilterOpt , DateOpt , ChoiceOpt <EOL> class CocorahsIO ( WebserviceLoader , XmlParser , TimeSeriesMapper , BaseIO ) : <EOL> """<STR_LIT>""" <EOL> start_date = DateOpt ( <EOL> required = True , <EOL> date_only = False , <EOL> url_param = "<STR_LIT>" , <EOL> ) <EOL> end_date = DateOpt ( <EOL> date_only = False , <EOL> url_param = "<STR_LIT>" , <EOL> ) <EOL> state = FilterOpt ( required = True ) <EOL> county = FilterOpt ( ) <EOL> basin = FilterOpt ( ignored = True ) <EOL> station = FilterOpt ( ignored = True ) <EOL> parameter = FilterOpt ( ignored = True ) <EOL> datetype = ChoiceOpt ( <EOL> url_param = "<STR_LIT>" , <EOL> default = "<STR_LIT>" , <EOL> choices = [ "<STR_LIT>" , "<STR_LIT>" ] , <EOL> ) <EOL> reporttype = ChoiceOpt ( <EOL> url_param = "<STR_LIT>" , <EOL> default = "<STR_LIT>" , <EOL> choices = [ "<STR_LIT>" , "<STR_LIT>" ] , <EOL> ) <EOL> url = "<STR_LIT>" <EOL> root_tag = '<STR_LIT>' <EOL> date_formats = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] <EOL> key_fields = [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ] <EOL> default_params = { <EOL> '<STR_LIT>' : "<STR_LIT:1>" , <EOL> '<STR_LIT>' : "<STR_LIT>" , <EOL> '<STR_LIT>' : "<STR_LIT:False>" , <EOL> '<STR_LIT>' : "<STR_LIT:all>" <EOL> } <EOL> @ property <EOL> def item_tag ( self ) : <EOL> if self . getvalue ( '<STR_LIT>' ) == "<STR_LIT>" : <EOL> return '<STR_LIT>' <EOL> else : <EOL> return '<STR_LIT>' <EOL> def serialize_params ( self , params , complex ) : <EOL> params = super ( CocorahsIO , self ) . serialize_params ( params , complex ) <EOL> fmt = '<STR_LIT>' <EOL> if '<STR_LIT>' in params : <EOL> params [ '<STR_LIT>' ] = self . getvalue ( '<STR_LIT>' ) . strftime ( fmt ) <EOL> params [ '<STR_LIT>' ] = self . getvalue ( '<STR_LIT>' ) . strftime ( fmt ) <EOL> else : <EOL> params [ '<STR_LIT>' ] = self . getvalue ( <EOL> '<STR_LIT>' <EOL> ) . strftime ( fmt + "<STR_LIT>" ) <EOL> del params [ '<STR_LIT>' ] <EOL> return params <EOL> def map_value ( self , field , value ) : <EOL> value = super ( CocorahsIO , self ) . map_value ( field , value ) <EOL> if isinstance ( value , datetime ) and value . year == <NUM_LIT:1> : <EOL> return None <EOL> return value </s>
