<s> from arcpy import ListFields , Describe , SetProgressorLabel , SetProgressorPosition , GetCount_management , SetProgressor , AddMessage <EOL> from os . path import splitext <EOL> def listFields ( featureClass ) : <EOL> fields = ListFields ( featureClass ) <EOL> out = dict ( ) <EOL> for fld in fields : <EOL> if ( fld . name . lower ( ) not in ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) and fld . name . find ( "<STR_LIT:.>" ) == - <NUM_LIT:1> ) : <EOL> out [ fld . name ] = fld . type <EOL> return out <EOL> def getShp ( shp ) : <EOL> desc = Describe ( shp ) <EOL> return [ desc . ShapeFieldName , desc . shapeType . lower ( ) ] <EOL> def getOID ( fields ) : <EOL> for key , value in fields . items ( ) : <EOL> if value == u'<STR_LIT>' : <EOL> return key <EOL> class statusMessage : <EOL> def __init__ ( self , featureClass ) : <EOL> self . featureCount = int ( GetCount_management ( featureClass ) . getOutput ( <NUM_LIT:0> ) ) <EOL> SetProgressor ( "<STR_LIT>" , "<STR_LIT>" . format ( str ( self . featureCount ) ) , <NUM_LIT:0> , <NUM_LIT:100> , <NUM_LIT:1> ) <EOL> AddMessage ( "<STR_LIT>" + str ( self . featureCount ) + "<STR_LIT>" ) <EOL> self . percent = <NUM_LIT:0> <EOL> self . current = <NUM_LIT:0> <EOL> def update ( self ) : <EOL> self . current += <NUM_LIT:1> <EOL> newPercent = int ( ( self . current * <NUM_LIT:100> ) / self . featureCount ) <EOL> if newPercent != self . percent : <EOL> self . percent = newPercent <EOL> SetProgressorLabel ( "<STR_LIT>" . format ( str ( self . percent ) ) ) <EOL> SetProgressorPosition ( self . percent ) <EOL> def parseProp ( row , fields , shp ) : <EOL> out = dict ( ) <EOL> for field in fields : <EOL> if ( fields [ field ] != u'<STR_LIT>' ) and field . lower ( ) not in ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , shp . lower ( ) ) and row . getValue ( field ) is not None : <EOL> if fields [ field ] == "<STR_LIT>" : <EOL> value = str ( row . getValue ( field ) . date ( ) ) <EOL> elif fields [ field ] == "<STR_LIT>" : <EOL> value = row . getValue ( field ) . strip ( ) <EOL> else : <EOL> value = row . getValue ( field ) <EOL> if value != "<STR_LIT>" : <EOL> out [ field ] = value <EOL> return out <EOL> def getExt ( fileName ) : <EOL> split = splitext ( fileName ) <EOL> if split [ <NUM_LIT:1> ] : <EOL> return split [ <NUM_LIT:1> ] [ <NUM_LIT:1> : ] . lower ( ) <EOL> else : <EOL> return False <EOL> def parseFieldType ( name , esriType ) : <EOL> if esriType . lower ( ) in ( "<STR_LIT:text>" , "<STR_LIT:string>" , "<STR_LIT:date>" ) : <EOL> return name + "<STR_LIT>" <EOL> elif esriType . lower ( ) in ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) : <EOL> return name + "<STR_LIT>" <EOL> elif esriType . lower ( ) in ( "<STR_LIT:float>" , "<STR_LIT>" , "<STR_LIT>" ) : <EOL> return name + "<STR_LIT>" <EOL> else : <EOL> return name + "<STR_LIT>" <EOL> def zm ( shp ) : <EOL> desc = Describe ( shp ) <EOL> return [ desc . hasZ , desc . hasM ] <EOL> def makeInter ( n ) : <EOL> out = [ ] <EOL> i = <NUM_LIT:0> <EOL> while i < n : <EOL> i += <NUM_LIT:1> <EOL> out . append ( "<STR_LIT:?>" ) <EOL> return "<STR_LIT:U+002C>" . join ( out ) </s>
