<s> from pytesla import Vehicle <EOL> __all__ = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] <EOL> class FieldLists ( object ) : <EOL> """<STR_LIT>""" <EOL> VEHICLE = [ '<STR_LIT:id>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ] <EOL> class ResultSets ( object ) : <EOL> def selector ( self , output ) : <EOL> if isinstance ( output , Vehicle ) : <EOL> return self . parse ( output , FieldLists . VEHICLE ) <EOL> else : <EOL> return output <EOL> def formatter ( self , output ) : <EOL> formatted = [ ] <EOL> if isinstance ( output , list ) : <EOL> for o in output : <EOL> formatted . append ( self . selector ( o ) ) <EOL> else : <EOL> formatted = self . selector ( output ) <EOL> return formatted <EOL> def _getval ( self , obj , field ) : <EOL> return self . selector ( getattr ( obj , field ) ) <EOL> def parse ( self , output , field_list ) : <EOL> instance_data = { field : self . _getval ( output , field ) <EOL> for field in field_list } <EOL> return instance_data </s>
