just returns a ring object, does not return a box
194962
function(cx, cy, r, width) {
  return {type: 'ring', cx: cx, cy: cy, r: r, width: width}
}
174314
def get_box_files(self, box_key):
		'''
		'''
		uri = '/'.join([self.api_uri,
						self.boxes_suffix,
						box_key,
						self.files_suffix
						])

		return self._req('get', uri)
650159
def get(self, objectType, *args, **coolArgs) :
		""""""
		
		ret = []
		for e in self._makeLoadQuery(objectType, *args, **coolArgs).iterRun() :
			if issubclass(objectType, pyGenoRabaObjectWrapper) :
				ret.append(objectType(wrapped_object_and_bag = (e, self.bagKey)))
			else :
				ret.append(e)

		return ret
508902
def getElement(self, node, name, nsuri=None, default=join):
        """"""
        nsmatch = self.nsUriMatch
        ELEMENT_NODE = node.ELEMENT_NODE
        for child in node.childNodes:
            if child.nodeType == ELEMENT_NODE:
                if ((child.localName == name or name is None) and
                    (nsuri is None or nsmatch(child.namespaceURI, nsuri))
                    ):
                    return child
        if default is not join:
            return default
        raise KeyError, name
610427
private static Class<?> box(Class<?> clazz) {
        if (clazz == int.class) {
            return Integer.class;
        } else
            if (clazz == float.class) {
                return Float.class;
            } else
                if (clazz == long.class) {
                    return Long.class;
                } else
                    if (clazz == double.class) {
                        return double.class;
                    } else
                        if (clazz == boolean.class) {
                            return Boolean.class;
                        } else
                            if (clazz == char.class) {
                                return Character.class;
                            } else
                                if (clazz == byte.class) {
                                    return Byte.class;
                                }
        return clazz;
    }
1093841
def get_object(token, url, dest_folder = nil)
      auth_header = {
          'X-Auth-Token' => token
      }
      query = nil
      dest_file = nil

      if dest_folder.nil?
        dest_file = File.join('./', File.basename(url))
      else
        dest_file = File.join(dest_folder, File.basename(url))
      end

      http_client = HTTPClient.new
      http_client.receive_timeout = 60 * 120

      open(dest_file, 'wb') do |file|
        
         http_client.get_content(URI.parse(URI.encode(url)), query, auth_header) do |chunk|
           file.write chunk
         end

      end
      dest_file
    end
214894
def _create_ring(self, nodes):
        
        for node_name, node_conf in nodes:
            for w in range(0, node_conf['vnodes'] * node_conf['weight']):
                self._distribution[node_name] += 1
                self._ring[self.hashi('%s-%s' % (node_name, w))] = node_name
        self._keys = sorted(self._ring.keys())
1100173
def vb_get_box():
    '''
    
    '''
    vb_get_manager()

    try:
        # This works in older versions of the SDK, but does not seem to work anymore.
        vbox = _virtualboxManager.vbox
    except AttributeError:
        vbox = _virtualboxManager.getVirtualBox()

    return vbox
65340
function findObject(c, obj, path, alreadyParsed) {
    if (!path) {
        path = [];
    }

    // Recursive reference : boooh, very wrong
    if (!alreadyParsed) {
        alreadyParsed = [];
    }
    var keys = Object.keys(obj);
    alreadyParsed.push(obj);
    for (var key = 0; key < keys.length; key++) {
        var i = keys[key];
        if (i == "NativeModule" && isElectron) {
            break;
        }
        if (obj[i] === c) {
            path.push(i);
            return path;
        } else if (["object", "function"].indexOf(typeof(obj[i])) >= 0 && alreadyParsed.indexOf(obj[i]) == -1 && obj[i] !== null && obj[i] !== undefined) {
            path.push(i);
            var founded = findObject(c, obj[i], path, alreadyParsed);
            if (founded) {
                return founded;
            } else {
                path.pop();
            }
        }
    };
    return null;
}
970062
function getEsriGeometry(featureData, geometryType, spatialReference) {
  if (defined(featureData.features)) {
    // This is a FeatureCollection.
    return {
      type: "FeatureCollection",
      crs: esriSpatialReferenceToCrs(featureData.spatialReference),
      features: featureData.features.map(function(subFeatureData) {
        return getEsriGeometry(subFeatureData, geometryType);
      })
    };
  }
  var geoJsonFeature = {
    type: "Feature",
    geometry: undefined,
    properties: featureData.attributes
  };
  if (defined(spatialReference)) {
    geoJsonFeature.crs = esriSpatialReferenceToCrs(spatialReference);
  }
  if (geometryType === "esriGeometryPolygon") {
    // There are a bunch of differences between Esri polygons and GeoJSON polygons.
    // For GeoJSON, see https://tools.ietf.org/html/rfc7946#section-3.1.6.
    // For Esri, see http://resources.arcgis.com/en/help/arcgis-rest-api/#/Geometry_objects/02r3000000n1000000/
    // In particular:
    // 1. Esri polygons can actually be multiple polygons by using multiple outer rings.  GeoJSON polygons
    //    can only have one outer ring and we need to use a MultiPolygon to represent multiple outer rings.
    // 2. In Esri which rings are outer rings and which are holes is determined by the winding order of the
    //    rings.  In GeoJSON, the first ring is the outer ring and subsequent rings are holes.
    // 3. In Esri polygons, clockwise rings are exterior, counter-clockwise are interior.  In GeoJSON, the first
    //    (exterior) ring is expected to be counter-clockwise, though lots of implementations probably don't
    //    enforce this.  The spec says, "For backwards compatibility, parsers SHOULD NOT reject
    //    Polygons that do not follow the right-hand rule."

    // Group rings into outer rings and holes/
    const outerRings = [];
    const holes = [];
    featureData.geometry.rings.forEach(function(ring) {
      if (
        computeRingWindingOrder(ring.map(p => new Point(...p))) ===
        WindingOrder.CLOCKWISE
      ) {
        outerRings.push(ring);
      } else {
        holes.push(ring);
      }

      // Reverse the coordinate order along the way due to #3 above.
      ring.reverse();
    });

    if (outerRings.length === 0 && holes.length > 0) {
      // Well, this is pretty weird.  We have holes but not outer ring?
      // Most likely scenario is that someone messed up the winding order.
      // So let's treat all the holes as outer rings instead.
      holes.forEach(hole => {
        hole.reverse();
      });
      outerRings.push(...holes);
      holes.length = 0;
    }

    // If there's only one outer ring, we can use a `Polygon` and things are simple.
    if (outerRings.length === 1) {
      geoJsonFeature.geometry = {
        type: "Polygon",
        coordinates: [outerRings[0], ...holes]
      };
    } else {
      // Multiple (or zero!) outer rings, so we need to use a multipolygon, and we need
      // to figure out which outer ring contains each hole.
      geoJsonFeature.geometry = {
        type: "MultiPolygon",
        coordinates: outerRings.map(ring => [
          ring,
          ...findHolesInRing(ring, holes)
        ])
      };
    }
  } else if (geometryType === "esriGeometryPoint") {
    geoJsonFeature.geometry = {
      type: "Point",
      coordinates: [featureData.geometry.x, featureData.geometry.y]
    };
  } else if (geometryType === "esriGeometryPolyline") {
    geoJsonFeature.geometry = {
      type: "MultiLineString",
      coordinates: featureData.geometry.paths
    };
  } else {
    return undefined;
  }
  return geoJsonFeature;
}
966569
def get_bounding_box(self):
        """"""
        from pyproj import Geod
        geod = Geod(ellps='WGS84')
        dataset_group = DATASET_KEYS[self.datasets[0]]
        idx = 0
        lons_ring = None
        lats_ring = None
        while True:
            path = 'Data_Products/{dataset_group}/{dataset_group}_Gran_{idx}/attr/'
            prefix = path.format(dataset_group=dataset_group, idx=idx)
            try:
                lats = self.file_content[prefix + 'G-Ring_Latitude']
                lons = self.file_content[prefix + 'G-Ring_Longitude']
                if lons_ring is None:
                    lons_ring = lons
                    lats_ring = lats
                else:
                    prev_lon = lons_ring[0]
                    prev_lat = lats_ring[0]
                    dists = list(geod.inv(lon, lat, prev_lon, prev_lat)[2] for lon, lat in zip(lons, lats))
                    first_idx = np.argmin(dists)
                    if first_idx == 2 and len(lons) == 8:
                        lons_ring = np.hstack((lons[:3], lons_ring[:-2], lons[4:]))
                        lats_ring = np.hstack((lats[:3], lats_ring[:-2], lats[4:]))
                    else:
                        raise NotImplementedError("Don't know how to handle G-Rings of length %d" % len(lons))

            except KeyError:
                break
            idx += 1

        return lons_ring, lats_ring
94676
def alltoall_ring(xs, devices, split_axis, concat_axis):
  
  n = len(xs)
  if n == 1:
    return xs
  # set up
  # [target, source]
  parts = [[None] * n for i in xrange(n)]
  def my_split(x, size_splits):
    total_size = tf.shape(x)[split_axis]
    part_size = total_size // sum(size_splits)
    return tf.split(x, [s * part_size for s in size_splits], axis=split_axis)
  forward_message_size = (n - 1) // 2
  backward_message_size = (n - 1) - forward_message_size
  forward_messages = [None] * n
  backward_messages = [None] * n
  for i in xrange(n):
    with tf.device(devices[i]):
      if i >= backward_message_size:
        a, b, c, d = my_split(
            xs[i], [i - backward_message_size,
                    backward_message_size, 1, n - i - 1])
        backward_messages[i] = b
        parts[i][i] = c
        forward_messages[i] = tf.concat([d, a], axis=split_axis)
      else:
        a, b, c, d = my_split(
            xs[i], [i, 1, forward_message_size, backward_message_size - i])
        backward_messages[i] = tf.concat([d, a], axis=split_axis)
        parts[i][i] = b
        forward_messages[i] = c
  for step in xrange(1, max(forward_message_size, backward_message_size) + 1):
    new_forward_messages = [None] * n
    new_backward_messages = [None] * n
    for i in xrange(n):
      with tf.device(devices[i]):
        if forward_message_size > 0:
          parts[i][(i - step) % n], new_forward_messages[i] = my_split(
              forward_messages[(i - 1) % n], [1, forward_message_size - 1])
        if backward_message_size > 0:
          new_backward_messages[i], parts[i][(i + step) % n] = my_split(
              backward_messages[(i + 1) % n], [backward_message_size - 1, 1])
    forward_message_size -= 1
    backward_message_size -= 1
    forward_messages = new_forward_messages
    backward_messages = new_backward_messages
  return mtf.parallel(devices, tf.concat, parts, axis=[concat_axis] * n)
1339361
public ConsistentHashRing getRing(String type) {
		ConsistentHashRing ring = rings.get(type);
		if (ring != null) {
			return ring;
		}
		if (type == null) {
			//If there's no ring without a type, then any type will do
			//Use weighted random among the types, based on how many servers are serving each type
			int selection = rand.nextInt() % totalServers;
			for (ConsistentHashRing candidateRing: rings.values()) {
				if (selection <= 0) {
					return candidateRing;
				} else {
					selection -= candidateRing.size();
				}
			}
			//It's possible there are no rings
			Preconditions.checkState(totalServers == 0, "It shouldn't be possible to get here, " +
					"unless there are no rings");
			return null;
		} else {
			//If there's no server for this type, then pick one without a type
			return rings.get(null);
		}
	}
73712
function getBox (items, i, j) {
	let ilox, iloy, ihix, ihiy, jlox, jloy, jhix, jhiy
	let iitem = items[i], jitem = items[j]

	if (iitem.length > 2) {
		ilox = iitem[0]
		ihix = iitem[2]
		iloy = iitem[1]
		ihiy = iitem[3]
	}
	else if (iitem.length) {
		ilox = iloy = iitem[0]
		ihix = ihiy = iitem[1]
	}
	else {
		ilox = iitem.x
		iloy = iitem.y
		ihix = iitem.x + iitem.width
		ihiy = iitem.y + iitem.height
	}

	if (jitem.length > 2) {
		jlox = jitem[0]
		jhix = jitem[2]
		jloy = jitem[1]
		jhiy = jitem[3]
	}
	else if (jitem.length) {
		jlox = jloy = jitem[0]
		jhix = jhiy = jitem[1]
	}
	else {
		jlox = jitem.x
		jloy = jitem.y
		jhix = jitem.x + jitem.width
		jhiy = jitem.y + jitem.height
	}

	return [ jlox, iloy, jhix, ihiy ]
}
977284
def fromBox(self, name, strings, objects, proto):
        
        objects[name] = getattr(proto, self.attr)
58264
function(node, ring) {
            var nodeList = this.getElementsByTagNameNS(node, this.internalns,
                                                       "coordinates");
            var line = null;
            if(nodeList.length > 0) {
                var coordString = this.getChildValue(nodeList[0]);

                coordString = coordString.replace(this.regExes.trimSpace,
                                                  "");
                coordString = coordString.replace(this.regExes.trimComma,
                                                  ",");
                var pointList = coordString.split(this.regExes.splitSpace);
                var numPoints = pointList.length;
                var points = new Array(numPoints);
                var coords, numCoords;
                for(var i=0; i<numPoints; ++i) {
                    coords = pointList[i].split(",");
                    numCoords = coords.length;
                    if(numCoords > 1) {
                        if(coords.length == 2) {
                            coords[2] = null;
                        }
                        points[i] = new OpenLayers.Geometry.Point(coords[0],
                                                                  coords[1],
                                                                  coords[2]);
                    } else {
                        throw "Bad LineString point coordinates: " +
                              pointList[i];
                    }
                }
                if(numPoints) {
                    if(ring) {
                        line = new OpenLayers.Geometry.LinearRing(points);
                    } else {
                        line = new OpenLayers.Geometry.LineString(points);
                    }
                } else {
                    throw "Bad LineString coordinates: " + coordString;
                }
            }

            return line;
        }
751596
def get_object(objref, data=None, return_fields=None, max_results=None,
               ensure_none_or_one_result=False, **api_opts):
    '''
    
    '''
    if not data:
        data = {}
    infoblox = _get_infoblox(**api_opts)
    return infoblox.get_object(objref, data, return_fields,
                               max_results, ensure_none_or_one_result)