Get an instance of the `PolygonFilter` using a unique id
963012
def get_instance_from_id(unique_id):
        """"""
        for instance in PolygonFilter.instances:
            if instance.unique_id == unique_id:
                return instance
        # if this does not work:
        raise KeyError("PolygonFilter with unique_id {} not found.".
                       format(unique_id))
1191882
def getmakeidfobject(idf, key, name):
    """"""
    idfobject = idf.getobject(key, name)
    if not idfobject:
        return idf.newidfobject(key, Name=name)
    else:
        return idfobject
510510
def where_unique(cls, ip, object_id, location):
        
        return cls.query.filter_by(
            ip=ip,
            object_id=object_id,
            location=location).first()
968569
def AddPoly(self, poly, smart_duplicate_handling=True):
    
    inserted_name = poly.GetName()
    if poly.GetName() in self._name_to_shape:
      if not smart_duplicate_handling:
        raise ShapeError("Duplicate shape found: " + poly.GetName())

      print ("Warning: duplicate shape id being added to collection: " +
             poly.GetName())
      if poly.GreedyPolyMatchDist(self._name_to_shape[poly.GetName()]) < 10:
        print("  (Skipping as it apears to be an exact duplicate)")
      else:
        print("  (Adding new shape variant with uniquified name)")
        inserted_name = "%s-%d" % (inserted_name, len(self._name_to_shape))
    self._name_to_shape[inserted_name] = poly
395347
def _alias_id(self, primary_id, equivalent_id):
        """"""
        pkg_name = primary_id.get_identifier_namespace().split('.')[0]
        obj_name = primary_id.get_identifier_namespace().split('.')[1]
        collection = JSONClientValidated(pkg_name,
                                         collection=obj_name,
                                         runtime=self._runtime)
        collection.find_one({'_id': ObjectId(primary_id.get_identifier())})  # to raise NotFound
        collection = JSONClientValidated('id',
                                         collection=pkg_name + 'Ids',
                                         runtime=self._runtime)
        try:
            result = collection.find_one({'aliasIds': {'$in': [str(equivalent_id)]}})
        except errors.NotFound:
            pass
        else:
            result['aliasIds'].remove(str(equivalent_id))
            collection.save(result)
        try:
            id_map = collection.find_one({'_id': str(primary_id)})
        except errors.NotFound:
            collection.insert_one({'_id': str(primary_id), 'aliasIds': [str(equivalent_id)]})
        else:
            id_map['aliasIds'].append(str(equivalent_id))
            collection.save(id_map)
509721
private Collection<IndexedInstance> getInstancesForVertex(Map<String, AttributeValueMap> map, AtlasVertex foundVertex) {

        //loop through the unique attributes.  For each attribute, check to see if the vertex property that
        //corresponds to that attribute has a value from one or more of the instances that were passed in.

        for(Map.Entry<String, AttributeValueMap> entry : map.entrySet()) {

            String propertyName = entry.getKey();
            AttributeValueMap valueMap = entry.getValue();

            Object vertexValue = foundVertex.getProperty(propertyName, Object.class);

            Collection<IndexedInstance> instances = valueMap.get(vertexValue);
            if(instances != null && instances.size() > 0) {
                //return first match.  Let the underling graph determine if this is a problem
                //(i.e. if the other unique attributes change be changed safely to match what
                //the user requested).
                return instances;
            }
            //try another attribute
        }
        return Collections.emptyList();
    }
865765
public static SingleColumnFilterFactory getOperator(String condition, boolean idPresent, boolean useFilter)
    {
        if (condition.equals("="))
        {
            return SingleColumnFilterFactory.EQUAL;
        }
        else if (condition.equals(">"))
        {
            return SingleColumnFilterFactory.GREATER;
        }
        else if (condition.equals("<"))
        {
            return SingleColumnFilterFactory.LESS;
        }
        else if (condition.equals(">="))
        {
            return SingleColumnFilterFactory.GREATER_OR_EQUAL;
        }
        else if (condition.equals("<="))
        {
            return SingleColumnFilterFactory.LESS_OR_EQUAL;
        }
        else if (condition.equals("<>"))
        {
            return SingleColumnFilterFactory.NOT_EQUAL;
        }
        else if (condition.equals("LIKE"))
        {
            return SingleColumnFilterFactory.LIKE;
        }
        else if (condition.equals("REGEXP"))
        {
            return SingleColumnFilterFactory.REGEXP;
        }
        else if (useFilter)
        {
            if (!idPresent)
            {
                throw new UnsupportedOperationException(" Condition " + condition + " is not suported in  hbase!");
            }
            else
            {
                throw new UnsupportedOperationException(" Condition " + condition
                        + " is not suported for query on row key!");

            }
        }
        return null;
    }
60641
private GetVectorTileRequest createRequest(String filter) {
		GetVectorTileRequest request = new GetVectorTileRequest();
		VectorLayer layer = cache.getLayer();
		MapModel mapModel = layer.getMapModel();
		MapView mapView = mapModel.getMapView();
		request.setCode(code);
		request.setCrs(mapModel.getCrs());
		request.setFilter(filter);
		request.setLayerId(layer.getServerLayerId());
		request.setPaintGeometries(!featureContent.isLoaded());
		request.setPaintLabels(layer.isLabelsShowing() && !labelContent.isLoaded());
		request.setPanOrigin(mapView.getPanOrigin());
		request.setRenderer(Dom.isSvg() ? "SVG" : "VML");
		request.setScale(mapView.getCurrentScale());
		request.setStyleInfo(layer.getLayerInfo().getNamedStyleInfo());
		return request;
	}
23735
def get_id(name=None, tags=None, region=None, key=None,
           keyid=None, profile=None, in_states=None, filters=None):

    '''
    

    '''
    instance_ids = find_instances(name=name, tags=tags, region=region, key=key,
                                  keyid=keyid, profile=profile, in_states=in_states,
                                  filters=filters)
    if instance_ids:
        log.info("Instance ids: %s", " ".join(instance_ids))
        if len(instance_ids) == 1:
            return instance_ids[0]
        else:
            raise CommandExecutionError('Found more than one instance '
                                        'matching the criteria.')
    else:
        log.warning('Could not find instance.')
        return None
397602
def individual(self, ind_id):
        """"""
        ind_obj = self.query(Individual).filter_by(ind_id=ind_id).first()
        if ind_obj is None:
            ind_obj = BaseIndividual(ind_id='unknown')
        return ind_obj
900410
def polygon_filter_rm(self, filt):
        
        if not isinstance(filt, (PolygonFilter, int, float)):
            msg = "`filt` must be a number or instance of PolygonFilter!"
            raise ValueError(msg)

        if isinstance(filt, PolygonFilter):
            uid = filt.unique_id
        else:
            uid = int(filt)
        # remove item
        self.config["filtering"]["polygon filters"].remove(uid)
827680
def by_id(cls, oid):
        """"""
        if oid:
            d = cls.collection.find_one(ObjectId(oid))
            if d:
                return cls(**d)
6675
function idUnique(a) {
  var i,j,l=a.length,p,
      guid=(Math.random()*1E10).toString(32)+(+new Date).toString(32);
  for (i=j=0;i<l;i++) {
    p = a[i];
    if (p==null) continue;
    if (p.hasOwnProperty(guid)) continue;
    Object.defineProperty(p,guid,{
      value:1,enumerable:false
    });
    a[j++]=p;
  }
  i=j;
  while (i--) {//clean guid
    a[i][guid]=undefined;
  }
  a.length=j;
  return a;
}
970726
def _get_distinct_objs(objs):
    
    ids = set()
    res = []
    for obj in objs:
        if not id(obj) in ids:
            ids.add(id(obj))
            res.append(obj)
    return res
1171165
def get_polygon_filter_names():
    """"""
    names = []
    for p in PolygonFilter.instances:
        names.append(p.name)
    return names
141427
function resolveInstanceById(refId){
  var templateId = refId & 0xFFF;
  var instanceId = refId >> 12;
  var templateInfo = templates[templateId];

  return templateInfo && templateInfo.instances[instanceId];
}
329636
function(filter) {
        if (!filter) {
            return;
        }
        if (!this.filters[filter.userId]) {
            this.filters[filter.userId] = {};
        }
        this.filters[filter.userId][filter.filterId] = filter;
    }