#NEWLINE# def CreateEntity( self , values , key_name = None ) : #NEWLINE# #INDENT# " Creates an entity from a list of property values.\n\n    Args:\n      values: list/tuple of str\n      key_name: if provided, the name for the (single) resulting Entity\n\n    Returns:\n      list of datastore.Entity\n\n      The returned entities are populated with the property values from the\n      argument, converted to native types using the properties map given in\n      the constructor, and passed through HandleEntity. They're ready to be\n      inserted.\n\n    Raises:\n      AssertionError if the number of values doesn't match the number\n        of properties in the properties map.\n    " #NEWLINE# Validate ( values , ( list , tuple ) ) #NEWLINE# assert ( len ( values ) == len ( self . __properties ) ) , ( 'Expected %d CSV columns, found %d.' % ( len ( self . __properties ) , len ( values ) ) ) #NEWLINE# entity = datastore . Entity ( self . __kind , name = key_name ) #NEWLINE# for ( ( name , converter ) , val ) in zip ( self . __properties , self ) : #NEWLINE# #INDENT# if ( ( converter is bool ) and ( val . lower ( ) in ( '0' , 'false' , 'no' ) ) ) : #NEWLINE# #INDENT# val = False #NEWLINE# #UNINDENT# entity [ name ] = converter ( val ) #NEWLINE# #UNINDENT# entities = self . HandleEntity ( entity ) #NEWLINE# if ( entities is not None ) : #NEWLINE# #INDENT# if ( not isinstance ( entities , ( list , tuple ) ) ) : #NEWLINE# #INDENT# entities = [ entities ] #NEWLINE# #UNINDENT# for entity in entities : #NEWLINE# #INDENT# if ( not isinstance ( entity , datastore . Entity ) ) : #NEWLINE# #INDENT# raise TypeError ( ( 'Expected a datastore.Entity, received %s (a %s).' % ( entity , entity . __class__ ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return entities