Return a dictionary of point/point_properties in preparation for storage in SQL.
973460
def points_properties_df(self):
        
        pprops = {}
        for each in self.points:
            p = each.properties.asdict.copy()
            p.pop("device", None)
            p.pop("network", None)
            p.pop("simulated", None)
            p.pop("overridden", None)
            pprops[each.properties.name] = p

        df = pd.DataFrame(pprops)
        return df
1078374
def to_dict(self):
        
        return {'schema': self.schema, 'table': self.table, 'name': self.name, 'type': self.type}
1011770
def properties(lines):
    
    results = {}
    for i, line in enumerate(lines):
        type_ = line[3:6]
        if type_ not in ["CHG", "RAD", "ISO"]:
            continue  # Other properties are not supported yet
        count = int(line[6:9])
        results[type_] = []
        for j in range(count):
            idx = int(line[10 + j * 8: 13 + j * 8])
            val = int(line[14 + j * 8: 17 + j * 8])
            results[type_].append((idx, val))
    return results
560944
function ( ) {
				return {
					"type" : "Feature",
					"geometry" : {
						"type" : "Point",
						"coordinates" : [ this.getLatLng().lng, this.getLatLng().lat ]
					},	
					"properties" : {
						"text" : this.options.text ? this.options.text : "",
						"address" : this.options.address ? this.options.address : "",
						"phone" : this.options.phone ? this.options.phone : "",
						"url" : this.options.url ? this.options.url : "",
						"categoryId" : this.options.pinCategory.CategoryId ? this.options.pinCategory.CategoryId : "",
						"distance" : this.options.distance ? this.options.distance : 0
					}
				};
			}
619813
def __geometryToDict(self, geom):
        """"""
        if isinstance(geom, dict):
            return geom
        elif isinstance(geom, Point):
            pt = geom.asDictionary
            return {"geometry": {"x" : pt['x'], "y" : pt['y']}}
        elif isinstance(geom, Polygon):
            poly = geom.asDictionary
            return {
                "geometry" : {
                    "rings" : poly['rings'],
                    'spatialReference' : poly['spatialReference']
                }
            }
        elif isinstance(geom, list):
            return [self.__geometryToDict(g) for g in geom]
841147
def get_properties(self, obj):
        """"""
        properties = {}

        for field_name, field in sorted(obj.fields.items()):
            schema = self._get_schema_for_field(obj, field)
            properties[field.name] = schema

        return properties
250549
def serialize(point: Mapping, measurement=None, **extra_tags) -> bytes:
    """"""
    tags = _serialize_tags(point, extra_tags)
    return (
        f'{_serialize_measurement(point, measurement)}'
        f'{"," if tags else ""}{tags} '
        f'{_serialize_fields(point)} '
        f'{_serialize_timestamp(point)}'
    ).encode()
776707
def properties(self):
        """"""
        properties = {'id': self._id}
        if self._name is not None:
            properties['name'] = self._name

        return properties
1045906
def _to_point(dims):
  """"""
  assert dims

  if isinstance(dims, (tuple, list)):
    if len(dims) != 2:
      raise ValueError(
          "A two element tuple or list is expected here, got {}.".format(dims))
    else:
      width = int(dims[0])
      height = int(dims[1])
      if width <= 0 or height <= 0:
        raise ValueError("Must specify +ve dims, got {}.".format(dims))
      else:
        return point.Point(width, height)
  else:
    size = int(dims)
    if size <= 0:
      raise ValueError(
          "Must specify a +ve value for size, got {}.".format(dims))
    else:
      return point.Point(size, size)
715058
def sql_to_dict(self, query, param):
        
        cursor = connection.cursor()
        cursor.execute(query, param)
        fieldnames = [name[0] for name in cursor.description]
        result = []
        for row in cursor.fetchall():
            rowset = []
            for field in zip(fieldnames, row):
                rowset.append(field)
            result.append(dict(rowset))
        return result
1158965
def _get_coordinates_for_dataset_keys(self, dsids):
        """"""
        coordinates = {}
        for dsid in dsids:
            cids = self._get_coordinates_for_dataset_key(dsid)
            coordinates.setdefault(dsid, []).extend(cids)
        return coordinates
941844
def properties(self):
        """"""
        properties = {'id': self._id,
                      'boundary': self._boundary}
        if 'name' in self._root.attrib:
            properties['name'] = self._root.get('name')
        if 'compartment' in self._root.attrib:
            properties['compartment'] = self._root.get('compartment')

        charge = self.charge
        if charge is not None:
            properties['charge'] = charge

        formula = self.formula
        if formula is not None:
            properties['formula'] = formula

        return properties
1294438
def to_dict(self, get_value=None):
        """"""
        self.trim()
        result = {}
        for key, value in iteritems(self.counters):
            if get_value is not None:
                value = getattr(value, get_value)
            r = result
            for _key in key[:-1]:
                r = r.setdefault(_key, {})
            r[key[-1]] = value
        return result
386154
def to_dict(self, short_pred=True, properties=True):
        
        def _lnk(obj): return {'from': obj.cfrom, 'to': obj.cto}
        def _ep(ep, short_pred=True):
            p = ep.pred.short_form() if short_pred else ep.pred.string
            d = dict(label=ep.label, predicate=p, arguments=ep.args)
            if ep.lnk is not None: d['lnk'] = _lnk(ep)
            return d
        def _hcons(hc): return {'relation':hc[1], 'high':hc[0], 'low':hc[2]}
        def _icons(ic): return {'relation':ic[1], 'left':ic[0], 'right':ic[2]}
        def _var(v):
            d = {'type': var_sort(v)}
            if properties and self.properties(v):
                d['properties'] = self.properties(v)
            return d

        d = dict(
            relations=[_ep(ep, short_pred=short_pred) for ep in self.eps()],
            constraints=([_hcons(hc) for hc in self.hcons()] +
                         [_icons(ic) for ic in self.icons()]),
            variables={v: _var(v) for v in self.variables()}
        )
        if self.top is not None: d['top'] = self.top
        if self.index is not None: d['index'] = self.index
        # if self.xarg is not None: d['xarg'] = self.xarg
        # if self.lnk is not None: d['lnk'] = self.lnk
        # if self.surface is not None: d['surface'] = self.surface
        # if self.identifier is not None: d['identifier'] = self.identifier
        return d
1356444
def _get_attrs(self):
        """"""
        attrs = []
        attrs.append(("N Cells", self.GetNumberOfCells(), "{}"))
        attrs.append(("N Points", self.GetNumberOfPoints(), "{}"))
        bds = self.bounds
        attrs.append(("X Bounds", (bds[0], bds[1]), "{:.3e}, {:.3e}"))
        attrs.append(("Y Bounds", (bds[2], bds[3]), "{:.3e}, {:.3e}"))
        attrs.append(("Z Bounds", (bds[4], bds[5]), "{:.3e}, {:.3e}"))
        # if self.n_cells <= vtki.REPR_VOLUME_MAX_CELLS and self.n_cells > 0:
        #     attrs.append(("Volume", (self.volume), "{:.3e}"))
        return attrs
255720
def all_properties(self):
        """"""

        properties = {}
        r = self.requests.get(self.index_url + "/_mapping", headers=HEADER_JSON, verify=False)
        try:
            r.raise_for_status()
            r_json = r.json()

            if 'items' not in r_json[self.index]['mappings']:
                return properties

            if 'properties' not in r_json[self.index]['mappings']['items']:
                return properties

            properties = r_json[self.index]['mappings']['items']['properties']
        except requests.exceptions.HTTPError as ex:
            logger.error("Error all attributes for %s.", self.anonymize_url(self.index_url))
            logger.error(ex)
            return

        return properties
83450
def ips_to_geojson(ipaddresses):
    """"""

    features = []

    for ipaddress in ipaddresses:
        geo = gi.record_by_addr(ipaddress)

        features.append({
            "type": "Feature",
            "properties": {
                "name": ipaddress
            },
            "geometry": {
                "type": "Point",
                "coordinates": [
                    geo["longitude"],
                    geo["latitude"]
                ]
            }
        })

    points = {
        "type": "FeatureCollection",
        "features": features
    }

    return points