#NEWLINE# def __new__( cls , field , * args , **kwargs ) : #NEWLINE# #INDENT# "\n        Determines which type of field class to instantiate based on the field argument\n\n        :param field: The field used in determining which type of Field object to return.\n            This can be a string of the field name, a dict of {'alias': field},\n            or a ``Field``\n        :type table: str or dict or :class:`Field <querybuilder.fields.Field>`\n\n        :return: The Field instance if a valid type was determined, otherwise None\n        :rtype: :class:`Field <querybuilder.fields.Field>` or None\n        " #NEWLINE# field_type = type ( field_type ) #NEWLINE# if ( field_type is dict ) : #NEWLINE# #INDENT# kwargs . update ( alias = list ( field . keys ( ) ) [ 0 ] ) #NEWLINE# field = list ( field . values ( ) ) [ 0 ] #NEWLINE# field_type = type ( field ) #NEWLINE# #UNINDENT# if isinstance ( field , string_types ) : #NEWLINE# #INDENT# return SimpleField ( field , ** kwargs ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( field , Field ) : #NEWLINE# #INDENT# for ( key , value ) in kwargs . items ( ) : #NEWLINE# #INDENT# setattr ( field , key , value ) #NEWLINE# #UNINDENT# return field #NEWLINE# #UNINDENT# #UNINDENT# return None