parameters: (geometry_type, json_attrs=None)
return_statement: return lattrs
docstring: Convert a json representation of attributes to a Python representation.
  
      parameters:
  
      json_attrs
      {
        "field_str": "string",
        "field_int": "integer",
        "field_date": "date",
        "field_float": "float"
      }
  
      geometry_type: a string which can be "Point", "LineString" or "Polygon"
  
      Output:
      [
           ['the_geom', u'com.vividsolutions.jts.geom.Polygon', {'nillable': False}],
           ['field_str', 'java.lang.String', {'nillable': True}],
           ['field_int', 'java.lang.Integer', {'nillable': True}],
           ['field_date', 'java.util.Date', {'nillable': True}],
           ['field_float', 'java.lang.Float', {'nillable': True}]
      ]
docstring_summary: Convert a json representation of attributes to a Python representation.
docstring_tokens: Convert a json representation of attributes to a Python representation .
function: def get_attributes(geometry_type, json_attrs=None):
      """
      Convert a json representation of attributes to a Python representation.
  
      parameters:
  
      json_attrs
      {
        "field_str": "string",
        "field_int": "integer",
        "field_date": "date",
        "field_float": "float"
      }
  
      geometry_type: a string which can be "Point", "LineString" or "Polygon"
  
      Output:
      [
           ['the_geom', u'com.vividsolutions.jts.geom.Polygon', {'nillable': False}],
           ['field_str', 'java.lang.String', {'nillable': True}],
           ['field_int', 'java.lang.Integer', {'nillable': True}],
           ['field_date', 'java.util.Date', {'nillable': True}],
           ['field_float', 'java.lang.Float', {'nillable': True}]
      ]
      """
  
      lattrs = []
      gattr = []
      gattr.append('the_geom')
      gattr.append(f'com.vividsolutions.jts.geom.{geometry_type}')
      gattr.append({'nillable': False})
      lattrs.append(gattr)
      if json_attrs:
          jattrs = json.loads(json_attrs)
          for jattr in jattrs.items():
              lattr = []
              attr_name = slugify(jattr[0])
              attr_type = jattr[1].lower()
              if len(attr_name) == 0:
                  msg = f'You must provide an attribute name for attribute of type {attr_type}'
                  logger.error(msg)
                  raise GeoNodeException(msg)
              if attr_type not in ('float', 'date', 'string', 'integer'):
                  msg = f'{attr_type} is not a valid type for attribute {attr_name}'
                  logger.error(msg)
                  raise GeoNodeException(msg)
              if attr_type == 'date':
                  attr_type = f'java.util.{(attr_type[:1].upper() + attr_type[1:])}'
              else:
                  attr_type = f'java.lang.{(attr_type[:1].upper() + attr_type[1:])}'
              lattr.append(attr_name)
              lattr.append(attr_type)
              lattr.append({'nillable': True})
              lattrs.append(lattr)
      return lattrs
function_tokens: def get_attributes ( geometry_type , json_attrs = None ) : lattrs = [ ] gattr = [ ] gattr . append ( 'the_geom' ) gattr . append ( f'com.vividsolutions.jts.geom.{geometry_type}' ) gattr . append ( { 'nillable' : False } ) lattrs . append ( gattr ) if json_attrs : jattrs = json . loads ( json_attrs ) for jattr in jattrs . items ( ) : lattr = [ ] attr_name = slugify ( jattr [ 0 ] ) attr_type = jattr [ 1 ] . lower ( ) if len ( attr_name ) == 0 : msg = f'You must provide an attribute name for attribute of type {attr_type}' logger . error ( msg ) raise GeoNodeException ( msg ) if attr_type not in ( 'float' , 'date' , 'string' , 'integer' ) : msg = f'{attr_type} is not a valid type for attribute {attr_name}' logger . error ( msg ) raise GeoNodeException ( msg ) if attr_type == 'date' : attr_type = f'java.util.{(attr_type[:1].upper() + attr_type[1:])}' else : attr_type = f'java.lang.{(attr_type[:1].upper() + attr_type[1:])}' lattr . append ( attr_name ) lattr . append ( attr_type ) lattr . append ( { 'nillable' : True } ) lattrs . append ( lattr ) return lattrs