Filter the annotation attributes to keep only items between the
        desired sample values
328098
def apply_range(self, sampfrom=0, sampto=None):
        
        sampto = sampto or self.sample[-1]

        kept_inds = np.intersect1d(np.where(self.sample>=sampfrom),
                                   np.where(self.sample<=sampto))


        for field in ['sample', 'label_store', 'subtype', 'chan', 'num']:
            setattr(self, field, getattr(self, field)[kept_inds])

        self.aux_note = [self.aux_note[i] for i in kept_inds]

        self.ann_len = len(self.sample)
250467
public static List<String> extractAsStringArray(ModelMethod method, ModelAnnotation annotationClass, AnnotationAttributeType attribute) {
		final Elements elementUtils=BaseProcessor.elementUtils;
		final One<List<String>> result = new One<List<String>>();
		extractAttributeValue(elementUtils, method.getElement(), annotationClass.getName(), attribute, new OnAttributeFoundListener() {

			@Override
			public void onFound(String value) {
				result.value0 = AnnotationUtility.extractAsArrayOfString(value);
			}
		});

		return result.value0;
	}
769697
def filterCollapsedItems(data):
  """"""
  return ((key, value)\
          for key, value in six.iteritems(data) \
          if not (isinstance(value, StatContainer) and value.isCollapsed()))
446523
def ignore_samples(self, data):
        
        try:
            if isinstance(data, OrderedDict):
                newdata = OrderedDict()
            elif isinstance(data, dict):
                newdata = dict()
            else:
                return data
            for k,v in data.items():
                # Match ignore glob patterns
                glob_match = any( fnmatch.fnmatch(k, sn) for sn in config.sample_names_ignore )
                re_match = any( re.match(sn, k) for sn in config.sample_names_ignore_re )
                if not glob_match and not re_match:
                    newdata[k] = v
            return newdata
        except (TypeError, AttributeError):
            return data
1053215
private function filterAttributes(AnnotationMetadata $metadata, $attributes)
    {
        foreach ($attributes as $name => $value) {
            if (!is_string($name)) {
                unset($attributes[ $name ]);
                $attributes[ $metadata->defaultAttribute ] = $value;
            }
        }
        $unsetRequiredAttributes = $metadata->attributes;
        foreach ($attributes as $name => $value) {
            if (!isset($metadata->attributes[ $name ])) {
                throw new AnnotationException("Unknown attribute: {$name}");
            }
            unset($unsetRequiredAttributes[ $name ]);
            $attribute = $metadata->attributes[ $name ];
            if (!($value === null && $attribute->nullable)) {
                Attribute::checkType($name, $value, $attribute->type);
            }
        }

        //Filter for required attributes
        $unsetRequiredAttributes = array_filter($unsetRequiredAttributes, function (Attribute $attribute) {
            return $attribute->required;
        });

        if (empty($unsetRequiredAttributes)) {
            return $attributes;
        }

        //get attribute names
        $unsetRequiredAttributeNames = array_map(function (Attribute $attribute) {
            return $attribute->name;
        }, $unsetRequiredAttributes);

        if (count($unsetRequiredAttributes) === 1) {
            throw new AnnotationException("Required parameter {$unsetRequiredAttributeNames[0]} is not set");
        } else {
            $joined = implode(', ', $unsetRequiredAttributeNames);
            throw new AnnotationException("Required parameters {$joined} are not set");
        }
    }
969702
def filterAcceptsRow(self, source_row, source_parent):
        """"""
        model = self.sourceModel()
        item = model.items[source_row]

        key = getattr(item, "filter", None)
        if key is not None:
            regex = self.filterRegExp()
            if regex.pattern():
                match = regex.indexIn(key)
                return False if match == -1 else True

        for role, values in self.includes.items():
            data = getattr(item, role, None)
            if data not in values:
                return False

        for role, values in self.excludes.items():
            data = getattr(item, role, None)
            if data in values:
                return False

        return super(ProxyModel, self).filterAcceptsRow(
            source_row, source_parent)
919364
private static Map<String, String> attributeCriterionToFilters(AttributeCriterion criterion) {
		Map<String, String> filters = new LinkedHashMap<String, String>();
		String filter = criterion.getAttributeName() + " " + criterion.getOperator() + " ";
		if (criterion.getValue() != null
				&& ((criterion.getValue().contains("\"") || criterion.getValue().contains(" ") || !criterion.getValue()
						.matches("(\\.|\\-|[0-9])*")) || "LIKE".equalsIgnoreCase(criterion.getOperator()))
				&& ((!"DURING".equals(criterion.getOperator().toUpperCase())
						&& !"BEFORE".equals(criterion.getOperator().toUpperCase()) && !"AFTER".equals(criterion
						.getOperator().toUpperCase())))) {
			filter += "\'" + criterion.getValue().replaceAll("\\*", "%") + "\'";
		} else {
			filter += criterion.getValue();
		}
		filters.put(criterion.getServerLayerId(), filter);
		return filters;
	}
342791
def filter_model_items(index_instance, model_items, model_name, start_date, end_date):
    ''' '''
    if index_instance.updated_field is None:
        logger.warning("No updated date field found for {} - not restricting with start and end date".format(model_name))
    else:
        if start_date:
            model_items = model_items.filter(**{'{}__gte'.format(index_instance.updated_field): __str_to_tzdate__(start_date)})
        if end_date:
            model_items = model_items.filter(**{'{}__lte'.format(index_instance.updated_field): __str_to_tzdate__(end_date)})

    return model_items
557599
def data_x_range(self):
        
        try:
            lower = min([min(self._filter_none(s))
                         for type, s in self.annotated_data()
                         if type == 'x'])
            upper = max([max(self._filter_none(s))
                         for type, s in self.annotated_data()
                         if type == 'x'])
            return (lower, upper)
        except ValueError:
            return None
997359
private void filterBranches(final Element root) {
        final QName[][] props = getExtProps(root.getAttribute(ATTRIBUTE_NAME_DOMAINS));
        filterBranches(root, Collections.emptyList(), props);
    }
642692
def _filter(self, text):
        """"""

        self.markdown.reset()
        return self.markdown.convert(text)
732757
private void extractAttributes(final String attributes)
	{
		String s = attributes.trim();
		if (s.length() > 0 && s.charAt(s.length() - 1) == '/')
			emptyTag = true;

		while (s.length() != 0) {
			final int equal = s.indexOf('=');
			if (equal == -1 || equal == s.length() - 1)
				break;
			// cut off attribute name
			final String att = s.substring(0, equal).trim();
			s = s.substring(equal + 1).trim();
			if (s.length() == 0)
				break;
			final boolean quote = s.charAt(0) == '\'' || s.charAt(0) == '\"';
			if (att.length() > 0 && quote) {
				String value = s.substring(1);
				final int end = value.indexOf(s.charAt(0));
				if (end >= 0)
					value = value.substring(0, end);
				attributeName.add(att);
				attributeValue.add(References.replace(value, false));
			}
			final int i = s.indexOf(quote ? s.charAt(0) : ' ', 1);
			s = i == -1 ? "" : s.substring(i + 1);
		}
	}
945438
def strip_annotations(graph):
    
    for u, v, k in graph.edges(keys=True):
        if ANNOTATIONS in graph[u][v][k]:
            del graph[u][v][k][ANNOTATIONS]
348666
protected static <P extends ParaObject> Map<String, AttributeValue> toRow(P so, Class<? extends Annotation> filter) {
		HashMap<String, AttributeValue> row = new HashMap<>();
		if (so == null) {
			return row;
		}
		for (Map.Entry<String, Object> entry : ParaObjectUtils.getAnnotatedFields(so, filter).entrySet()) {
			Object value = entry.getValue();
			if (value != null && !StringUtils.isBlank(value.toString())) {
				row.put(entry.getKey(), new AttributeValue(value.toString()));
			}
		}
		if (so.getVersion() != null && so.getVersion() > 0) {
			row.put(Config._VERSION, new AttributeValue().withN(so.getVersion().toString()));
		} else {
			row.remove(Config._VERSION);
		}
		return row;
	}
1029413
def filter(self, table, mappings, filter_string):
        """"""
        q = filter_string.lower()
        return [mapping for mapping in mappings
                if q in mapping.ud.lower()]
519000
public static String filterHtmlAttributes(SoyValue value) {
    value = normalizeNull(value);
    if (isSanitizedContentOfKind(value, SanitizedContent.ContentKind.ATTRIBUTES)) {
      // We're guaranteed to be in a case where key=value pairs are expected. However, if it would
      // cause issues to directly abut this with more attributes, add a space. For example:
      // {$a}{$b} where $a is foo=bar and $b is boo=baz requires a space in between to be parsed
      // correctly, but not in the case where $a is foo="bar".
      // TODO: We should be able to get rid of this if the compiler can guarantee spaces between
      // adjacent print statements in attribute context at compile time.
      String content = value.coerceToString();
      if (content.length() > 0) {
        if (shouldAppendSpace(content.charAt(content.length() - 1))) {
          content += ' ';
        }
      }
      return content;
    }
    return filterHtmlAttributes(value.coerceToString());
  }
58910
def _get_sample_select(samples, keep):
    """"""
    k = np.ones_like(samples, dtype=bool)
    if keep is not None:
        k = np.array([s in keep for s in samples], dtype=bool)
        if np.sum(k) == 0:
            logger.warning("No samples matched the keep list")
    return k