Get an MD5 for a geometry object

    Parameters
    ------------
    geometry : object

    Returns
    ------------
    MD5 : str
1741
def geometry_hash(geometry):
    
    if hasattr(geometry, 'md5'):
        # for most of our trimesh objects
        md5 = geometry.md5()
    elif hasattr(geometry, 'tostring'):
        # for unwrapped ndarray objects
        md5 = str(hash(geometry.tostring()))

    if hasattr(geometry, 'visual'):
        # if visual properties are defined
        md5 += str(geometry.visual.crc())
    return md5
1203675
def md5sum(data):
    
    if six.PY3:  # pragma: no cover
        return hashlib.md5(data.encode('utf-8')).hexdigest()
    else:  # pragma: no cover
        return hashlib.md5(data).hexdigest()
319488
def parse_geometry(geometry, ratio=None):
    
    if "%" not in geometry:
        # fall back to old parser
        return xy_geometry_parser(geometry, ratio)
    # parse with float so geometry strings like "42.11%" are possible
    return float(geometry.strip("%")) / 100.0
583640
def calculate_md5(filename, length):
    
    assert length >= 0

    # shortcut: MD5 of an empty string is 'd41d8cd98f00b204e9800998ecf8427e',
    # represented here in binary
    if length == 0:
        return '\xd4\x1d\x8c\xd9\x8f\x00\xb2\x04\xe9\x80\t\x98\xec\xf8\x42\x7e'

    md5_summer = hashlib.md5()

    f = open(filename, 'rb')

    try:
        bytes_read = 0

        while bytes_read < length:
            chunk_size = min(MD5_CHUNK_SIZE, length - bytes_read)

            chunk = f.read(chunk_size)

            if not chunk:
                # found EOF: means length was larger than the file size, or
                # file was truncated while reading -- print warning?
                break

            md5_summer.update(chunk)

            bytes_read += len(chunk)

    finally:
        f.close()

    md5 = md5_summer.digest()

    return md5
1352244
def get_md5(path):
    
    with open(path,'rb') as f:
        md5obj = hashlib.md5()
        md5obj.update(f.read())
        return md5obj.hexdigest()
    raise FileNotFoundError("Error when get md5 for %s!"%path)
635094
public static int getGeometryTypeFromGeometry(Geometry geometry) {
        Integer sfsGeomCode = GEOM_TYPE_TO_SFS_CODE.get(geometry.getGeometryType().toLowerCase());
        if(sfsGeomCode == null) {
            return GeometryTypeCodes.GEOMETRY;
        } else {
            return sfsGeomCode;
        }
    }
282871
def geometry(self):
        

        if self.coord is None:
            return None
        ra = self.coord.ra.degree
        dec = self.coord.dec.degree
        ccds = []

        for geo in self._geometry[self.camera]:
            ycen = geo["dec"] + dec
            xcen = geo["ra"] / math.cos(math.radians(ycen)) + ra
            try:
                dy = geo["ddec"]
                dx = geo["dra"] / math.cos(math.radians(ycen))
                ccds.append([xcen - dx / 2.0, ycen - dy / 2.0, xcen + dx / 2.0, ycen + dy / 2.0])
            except:
                rad = geo["rad"]
                ccds.append([xcen, ycen, rad])
        return ccds
444860
def pull_df(self, md5):
        
        try:
            _packed_df = self.workbench.get_dataframe(md5)
            _df = pd.read_msgpack(lz4.loads(_packed_df))
            return _df
        except zerorpc.exceptions.RemoteError as e:
            return repr_to_str_decorator.r_to_s(self._data_not_found)(e)
1068747
def md5(self):
        """"""
        return hashlib.md5('_'.join([self.CHROM, str(self.POS), self.REF,
                                     self.ALT])).hexdigest()
356320
def md5(self):
        
        hasher = hashlib.md5()
        for key in sorted(self.data.keys()):
            hasher.update(self.data[key].md5().encode('utf-8'))
        md5 = hasher.hexdigest()
        return md5
941228
public static byte[] geometryToEsriShape(Geometry geometry) {
		if (geometry == null)
			throw new IllegalArgumentException();
		OperatorExportToESRIShape op = (OperatorExportToESRIShape) factory
				.getOperator(Operator.Type.ExportToESRIShape);
		return op.execute(0, geometry).array();
	}
566021
def read_geom_h5(xdmf_file, snapshot):
    
    header = {}
    xdmf_root = xmlET.parse(str(xdmf_file)).getroot()
    if snapshot is None:
        return None, xdmf_root

    # Domain, Temporal Collection, Snapshot
    # should check that this is indeed the required snapshot
    elt_snap = xdmf_root[0][0][snapshot]
    header['ti_ad'] = float(elt_snap.find('Time').get('Value'))
    header['mo_lambda'] = _maybe_get(elt_snap, 'mo_lambda', 'Value', float)
    header['mo_thick_sol'] = _maybe_get(elt_snap, 'mo_thick_sol', 'Value',
                                        float)
    header['ntb'] = 1
    coord_h5 = []  # all the coordinate files
    coord_shape = []  # shape of meshes
    twod = None
    for elt_subdomain in elt_snap.findall('Grid'):
        if elt_subdomain.get('Name').startswith('meshYang'):
            header['ntb'] = 2
            break  # iterate only through meshYin
        elt_geom = elt_subdomain.find('Geometry')
        if elt_geom.get('Type') == 'X_Y' and twod is None:
            twod = ''
            for data_item in elt_geom.findall('DataItem'):
                coord = data_item.text.strip()[-1]
                if coord in 'XYZ':
                    twod += coord
        data_item = elt_geom.find('DataItem')
        coord_shape.append(_get_dim(data_item))
        coord_h5.append(
            xdmf_file.parent / data_item.text.strip().split(':/', 1)[0])
    _read_coord_h5(coord_h5, coord_shape, header, twod)
    return header, xdmf_root
1066602
def triangles(self):
        
        # use of advanced indexing on our tracked arrays will
        # trigger a change flag which means the MD5 will have to be
        # recomputed. We can escape this check by viewing the array.
        triangles = self.vertices.view(np.ndarray)[self.faces]
        # make triangles (which are derived from faces/vertices) not writeable
        triangles.flags.writeable = False
        return triangles
298184
def md5_string(s):
    
    m = hashlib.md5()
    m.update(s)
    return str(m.hexdigest())
762174
def md5(self):
        
        # first MD5 the points in every entity
        target = '{}{}'.format(
            util.md5_object(bytes().join(e._bytes()
                                         for e in self.entities)),
            self.vertices.md5())

        return target
1209658
def md5(self, raw_output=False):
        
        res = hashlib.md5(str(self.generator.random.random()).encode('utf-8'))
        if raw_output:
            return res.digest()
        return res.hexdigest()
519780
def geometryType(self):
        
        if self._geomType is None:
            if self.geometry is not None:
                self._geomType = self.geometry.type
            else:
                self._geomType = "Table"
        return self._geomType