<s> from django . contrib . gis . geos . geometry import GEOSGeometry , wkt_regex , hex_regex <EOL> def fromfile ( file_h ) : <EOL> """<STR_LIT>""" <EOL> if isinstance ( file_h , basestring ) : <EOL> file_h = open ( file_h , '<STR_LIT:rb>' ) <EOL> buf = file_h . read ( ) <EOL> if wkt_regex . match ( buf ) or hex_regex . match ( buf ) : <EOL> return GEOSGeometry ( buf ) <EOL> else : <EOL> return GEOSGeometry ( buffer ( buf ) ) <EOL> def fromstr ( string , ** kwargs ) : <EOL> "<STR_LIT>" <EOL> return GEOSGeometry ( string , ** kwargs ) </s>
