<s> from __future__ import absolute_import , unicode_literals <EOL> from . base import BaseDataset <EOL> class SimpleDataset ( BaseDataset ) : <EOL> def __init__ ( self , queryset , headers = None , encoding = '<STR_LIT:utf-8>' ) : <EOL> self . queryset = queryset <EOL> self . encoding = encoding <EOL> if headers is None : <EOL> v_qs = queryset . values ( ) <EOL> headers = [ ] <EOL> headers . extend ( v_qs . query . extra_select ) <EOL> try : <EOL> field_names = v_qs . query . values_select <EOL> except AttributeError : <EOL> field_names = v_qs . field_names <EOL> headers . extend ( field_names ) <EOL> headers . extend ( v_qs . query . aggregate_select ) <EOL> self . header_list = headers <EOL> self . attr_list = headers <EOL> elif isinstance ( headers , dict ) : <EOL> self . header_dict = headers <EOL> self . header_list = self . header_dict . keys ( ) <EOL> self . attr_list = self . header_dict . values ( ) <EOL> elif isinstance ( headers , ( tuple , list ) ) : <EOL> self . header_list = headers <EOL> self . attr_list = headers <EOL> super ( SimpleDataset , self ) . __init__ ( ) </s>
