<s> from django . contrib . gis . gdal . error import OGRException <EOL> class OGRGeomType ( object ) : <EOL> "<STR_LIT>" <EOL> _types = { <NUM_LIT:0> : '<STR_LIT>' , <EOL> <NUM_LIT:1> : '<STR_LIT>' , <EOL> <NUM_LIT:2> : '<STR_LIT>' , <EOL> <NUM_LIT:3> : '<STR_LIT>' , <EOL> <NUM_LIT:4> : '<STR_LIT>' , <EOL> <NUM_LIT:5> : '<STR_LIT>' , <EOL> <NUM_LIT:6> : '<STR_LIT>' , <EOL> <NUM_LIT:7> : '<STR_LIT>' , <EOL> <NUM_LIT:100> : '<STR_LIT:None>' , <EOL> <NUM_LIT> : '<STR_LIT>' , <EOL> } <EOL> _str_types = dict ( [ ( v . lower ( ) , k ) for k , v in _types . items ( ) ] ) <EOL> def __init__ ( self , type_input ) : <EOL> "<STR_LIT>" <EOL> if isinstance ( type_input , OGRGeomType ) : <EOL> num = type_input . num <EOL> elif isinstance ( type_input , basestring ) : <EOL> num = self . _str_types . get ( type_input . lower ( ) , None ) <EOL> if num is None : <EOL> raise OGRException ( '<STR_LIT>' % type_input ) <EOL> elif isinstance ( type_input , int ) : <EOL> if not type_input in self . _types : <EOL> raise OGRException ( '<STR_LIT>' % type_input ) <EOL> num = type_input <EOL> else : <EOL> raise TypeError ( '<STR_LIT>' ) <EOL> self . num = num <EOL> def __str__ ( self ) : <EOL> "<STR_LIT>" <EOL> return self . name <EOL> def __eq__ ( self , other ) : <EOL> """<STR_LIT>""" <EOL> if isinstance ( other , OGRGeomType ) : <EOL> return self . num == other . num <EOL> elif isinstance ( other , basestring ) : <EOL> return self . name . lower ( ) == other . lower ( ) <EOL> elif isinstance ( other , int ) : <EOL> return self . num == other <EOL> else : <EOL> return False <EOL> def __ne__ ( self , other ) : <EOL> return not ( self == other ) <EOL> @ property <EOL> def name ( self ) : <EOL> "<STR_LIT>" <EOL> return self . _types [ self . num ] <EOL> @ property <EOL> def django ( self ) : <EOL> "<STR_LIT>" <EOL> s = self . name <EOL> if s in ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:None>' ) : <EOL> return None <EOL> else : <EOL> return s + '<STR_LIT>' </s>
