def dataprovider_factory(name, settings=None):
 def parse_query_string_settings(query_kwargs):
  return _parse_query_string_settings(query_kwargs, settings)
 def named_dataprovider_factory(func):
  setattr(func, _DATAPROVIDER_METHOD_NAME_KEY, name)
  setattr(func, 'parse_query_string_settings', parse_query_string_settings)
  setattr(func, 'settings', settings)
  @wraps(func)
  def wrapped_dataprovider_factory(self, *args, **kwargs):
   return func(self, *args, **kwargs)
  return wrapped_dataprovider_factory
 return named_dataprovider_factory

def dataprovider_factory ( name , settings = None ) : def parse_query_string_settings ( query_kwargs ) : return _parse_query_string_settings ( query_kwargs , settings ) def named_dataprovider_factory ( func ) : setattr ( func , _DATAPROVIDER_METHOD_NAME_KEY , name ) setattr ( func , 'parse_query_string_settings' , parse_query_string_settings ) setattr ( func , 'settings' , settings ) @ wraps ( func ) def wrapped_dataprovider_factory ( self , * args , ** kwargs ) : return func ( self , * args , ** kwargs ) return wrapped_dataprovider_factory return named_dataprovider_factory
wraps a class method and marks it as a dataprovider factory and creates a function to parse query strings to __init__ arguments as the parse_query_string_settings attribute of the factory function .