Reduce annotations to ones used to identify enrichment (normally exclude ND and NOT).
186399
def reduce_annotations(self, annotations, options):
        """"""
        getfnc_qual_ev = options.getfnc_qual_ev()
        return [nt for nt in annotations if getfnc_qual_ev(nt.Qualifier, nt.Evidence_Code)]
730884
function annotate(fn) {
  var matched = /function +[^\(]*\(([^\)]*)\).*/.exec(fn.toString());
  var names = _.reject(matched[1].split(',') || [], _.isEmpty);

  return _.map(names, function(name) {
    return name.replace(/\s+/g, '');
  });
}
807576
public void accumulateAnnotations(List<String> annotations, AnnotationsAttribute annatt)
    {
        if (null == annatt)
        {
            return;
        }
        for (Annotation ann : annatt.getAnnotations())
        {
            annotations.add(ann.getTypeName());
        }
    }
86133
def selections(self):
        """
        for sel in self._selections:
            if sel.annotation.axes is None:
                raise RuntimeError("Annotation unexpectedly removed; "
                                   "use 'cursor.remove_selection' instead")
        return tuple(self._selections)
752167
def unalias(self, annotationtype, alias):
        """"""
        if inspect.isclass(annotationtype): annotationtype = annotationtype.ANNOTATIONTYPE
        return self.alias_set[annotationtype][alias]
429368
def get_memory_annotations(cls, exclude=None):
        

        result = set()

        # get global dictionary
        annotations_in_memory = Annotation.__ANNOTATIONS_IN_MEMORY__

        exclude = () if exclude is None else exclude

        # iterate on annotation classes
        for annotation_cls in annotations_in_memory:

            # if annotation class is excluded, continue
            if issubclass(annotation_cls, exclude):
                continue

            # if annotation class inherits from self, add it in the result
            if issubclass(annotation_cls, cls):
                result |= annotations_in_memory[annotation_cls]

        return result
862014
def free_memory(cls, exclude=None):
        """"""

        annotations_in_memory = Annotation.__ANNOTATIONS_IN_MEMORY__

        exclude = () if exclude is None else exclude

        for annotation_cls in list(annotations_in_memory.keys()):

            if issubclass(annotation_cls, exclude):
                continue

            if issubclass(annotation_cls, cls):
                del annotations_in_memory[annotation_cls]
1083050
def remove_optional(annotation: type):
    
    origin = getattr(annotation, '__origin__', None)
    args = getattr(annotation, '__args__', ())
    if origin == Union and len(args) == 2 and args[1] == type(None):
        return args[0]
    else:
        return annotation
669266
def _remove_non_methods():
  """"""
  cur_module = sys.modules[__name__]
  my_globals = dict(globals())
  # Import here so that it doesn't get added to the global namespace or deleted.
  # pylint: disable=g-import-not-at-top
  from prettytensor.pretty_tensor_class import PrettyTensor
  for name, _ in six.iteritems(my_globals):
    if not hasattr(PrettyTensor, name):
      delattr(cur_module, name)
  # Remove a couple of special ones....
  if hasattr(cur_module, 'bookkeeper'):
    delattr(cur_module, 'bookkeeper')
755298
private void removeDeadMethods(String clazz, List<BodyDeclaration> declarations) {
    Iterator<BodyDeclaration> declarationsIter = declarations.iterator();
    while (declarationsIter.hasNext()) {
      BodyDeclaration declaration = declarationsIter.next();
      if (declaration instanceof MethodDeclaration) {
        MethodDeclaration method = (MethodDeclaration) declaration;
        ExecutableElement elem = method.getExecutableElement();
        String name = typeUtil.getReferenceName(elem);
        String signature = typeUtil.getReferenceSignature(elem);
        if (deadCodeMap.containsMethod(clazz, name, signature)) {
          if (method.isConstructor()) {
            deadCodeMap.addConstructorRemovedClass(clazz);
          }
          if (Modifier.isNative(method.getModifiers())) {
            removeMethodOCNI(method);
          }
          declarationsIter.remove();
        }
      }
    }
  }
516840
function setAnnotationSets(sets) {
  annotationSets = sets.map(function(s) {
    var r = '\\b(' + s.terms.join('|') + ')\\b';
    s.re = new RegExp(r, 'mi');
    return s;
  });
}
668693
private Set<TypeMirror> getExcludedAnnotationTypes(Element element) {
    Optional<AnnotationMirror> maybeAnnotation =
        getAnnotationMirror(element, COPY_ANNOTATIONS_NAME);
    if (!maybeAnnotation.isPresent()) {
      return ImmutableSet.of();
    }

    @SuppressWarnings("unchecked")
    List<AnnotationValue> excludedClasses =
        (List<AnnotationValue>) getAnnotationValue(maybeAnnotation.get(), "exclude").getValue();
    return excludedClasses
        .stream()
        .map(annotationValue -> (DeclaredType) annotationValue.getValue())
        .collect(toCollection(TypeMirrorSet::new));
  }
436902
def clear_data(self):
        
        self.clear_annotation_data()
        self.terms = {}
        self._alt_id = {}
        self._syn2id = {}
        self._name2id = {}
        self._flattened = False
639569
def filter_annotations_by_ptype(function, ptype):
    ''''''
    ret = {}
    for k, v in function.__annotations__.items():
        if k == 'return':
            continue
        pt, _ = v
        if pt == ptype:
            ret[k] = v
    return ret
634497
def _ConvertAnnotations(self, annotations):
      
      flags = 0
      if annotations:
         for annotation in annotations:
            flags |= self._mapFlags.get(annotation.name, 0)
      return flags
1328446
def annotation(self, type, set=None):
        """"""
        l = self.count(type,set,True,default_ignore_annotations)
        if len(l) >= 1:
            return l[0]
        else:
            raise NoSuchAnnotation()
1103540
def exclude_specs(full, to_be_excluded)
      full.clone.delete_if { |s| to_be_excluded.find { |d| s.name == d.name } }
    end