Parse annotations for a class
497768
public function parse($className) {


        try {
            $class = new \ReflectionClass($className);
        } catch (\ReflectionException $e) {
            return new ClassAnnotations($className, array(), array(), array());
        }


        // get the master annotations
        $classComment = $class->getDocComment();
        $classAnnotations = $this->getCommentAnnotations($classComment);
        $classAnnotations["comment"] = array(new Annotation("comment", $this->cleanComment($classComment)));


        $fieldAnnotations = array();
        $properties = $class->getProperties();

        foreach ($properties as $property) {

            if ($property->isStatic())
                continue;


            $fieldComment = $this->getCommentAnnotations($property->getDocComment());
            $fieldAnnotations[$property->getName()] = $fieldComment;

            $fieldAnnotations[$property->getName()]["comment"] = array(new Annotation("comment", $this->cleanComment($property->getDocComment())));

        }


        $methodAnnotations = array();
        $methods = $class->getMethods();

        foreach ($methods as $method) {

            if ($method->isStatic() || $method->isPrivate() || $method->isProtected())
                continue;
            $methodComment = $this->getCommentAnnotations($method->getDocComment());
            $methodAnnotations[$method->getName()] = $methodComment;

            if ($method->getDeclaringClass()->getName() != $className) {
                $methodAnnotations[$method->getName()]["inherited"] = 1;
            }

            $methodAnnotations[$method->getName()]["comment"] = array(new Annotation("comment", $this->cleanComment($method->getDocComment())));


        }


        return new ClassAnnotations($className, $classAnnotations, $fieldAnnotations, $methodAnnotations);

    }
638740
function _get_annotations_by_key(key){
    var anchor = this;

    var ret = [];
    each(anchor._annotations, function(ann){
	if( ann.key() === key ){
	    ret.push(ann);
	}
    });

    return ret;
}
708479
def ParseObjs(self, objs, type_names):
    """"""
    for obj in objs:
      for type_name in self._RDFTypes(type_names):
        if isinstance(obj, self._GetClass(type_name)):
          yield obj
1338145
def _clean_annotations(annotations_dict: AnnotationsHint) -> AnnotationsDict:
    """"""
    return {
        key: (
            values if isinstance(values, dict) else
            {v: True for v in values} if isinstance(values, set) else
            {values: True}
        )
        for key, values in annotations_dict.items()
    }
624973
def get_annotations(element):
    
    from labels import get_annotation
    annotations = {}
    for label in element.getchildren():
        if get_xsi_type(label) == 'saltCore:SAnnotation':
            annotations.update([get_annotation(label)])
    return annotations
292233
function parseClassProps(text) {
  const result = {};
  const classes = text.split(' ');
  classes.forEach(className => {
    result[className] = true
  });
  return result;
}
314881
private function parseClassAnnotations(string $className, array $annotation, array $classAnnotations)
    {
        foreach ($classAnnotations as $classAnnotation) {
            $annotationClassName = get_class($classAnnotation);
            $classNameTmp        = str_replace('\\', '/', $annotationClassName);
            $classFileName       = basename($classNameTmp);
            $beanNamespaceTmp    = dirname($classNameTmp, 2);
            $beanNamespace       = str_replace('/', '\\', $beanNamespaceTmp);

            $annotationWrapperClassName = "{$beanNamespace}\\Wrapper\\{$classFileName}Wrapper";

            if (!class_exists($annotationWrapperClassName)) {
                continue;
            }

            /* @var WrapperInterface $wrapper */
            $wrapper = new $annotationWrapperClassName($this);

            // wrapper extend
            foreach ($this->componentNamespaces as $componentNamespace) {
                $annotationWrapperExtendClassName = "{$componentNamespace}\\Bean\\Wrapper\\Extend\\{$classFileName}Extend";
                if (!class_exists($annotationWrapperExtendClassName)) {
                    continue;
                }
                $extend = new $annotationWrapperExtendClassName();
                $wrapper->addExtends($extend);
            }

            $objectDefinitionAry = $wrapper->doWrapper($className, $annotation);
            if ($objectDefinitionAry != null) {
                list($beanName, $objectDefinition) = $objectDefinitionAry;
                $this->definitions[$beanName] = $objectDefinition;
            }
        }
    }
840502
@SuppressWarnings("unchecked")
    public <T> List<T> getAnnotations(final Class<? extends Annotation> clazz) {
        return (List<T>) foundAnnotations.get(clazz);
    }
1014972
def parse_annotation(obj: dict) -> BioCAnnotation:
    """"""
    ann = BioCAnnotation()
    ann.id = obj['id']
    ann.infons = obj['infons']
    ann.text = obj['text']
    for loc in obj['locations']:
        ann.add_location(BioCLocation(loc['offset'], loc['length']))
    return ann
899815
public static List<Field> getAnnotatedFields(final Class<?> cls, final Class<? extends Annotation> annotationClass) {

        final List<Field> fieldList = new ArrayList<>();

        for (final Field f : cls.getDeclaredFields()) {
            if (f.getAnnotation(annotationClass) != null) {
                fieldList.add(f);
            }
        }

        // Add super class methods
        if (cls.getSuperclass() != null) {
            fieldList.addAll(getAnnotatedFields(cls.getSuperclass(), annotationClass));
        }

        return fieldList;
    }
1054292
def parse_annotations(annots, fmt, annot_tables, trans_table):
    
    annotations = {} # annotations[contig] = [features]
    # gbk format
    if fmt is False:
        for contig, feature in parse_gbk(annots):
            if contig not in annotations:
                annotations[contig] = []
            annotations[contig].append(feature)
    # fasta format
    else:
        for contig, feature in parse_fasta_annotations(annots, annot_tables, trans_table):
            if contig not in annotations:
                annotations[contig] = []
            annotations[contig].append(feature)
    return annotations
132969
def _get_annotations(cls):
    
    anns = getattr(cls, "__annotations__", None)
    if anns is None:
        return {}

    # Verify that the annotations aren't merely inherited.
    for base_cls in cls.__mro__[1:]:
        if anns is getattr(base_cls, "__annotations__", None):
            return {}

    return anns
598870
private Group[] parseMethods(Class clazz) {
        List<Group> groups = new ArrayList();
        Group unknownGroup = new Group();
        groups.add(unknownGroup);
        String[] groupsOrder = new String[0];

        for (Method method : clazz.getMethods()) {
            Property prop = new Property();

            prop.deprecated = method.isAnnotationPresent(Deprecated.class);

            if (method.isAnnotationPresent(Key.class)) {
                Key val = method.getAnnotation(Key.class);
                prop.name = val.value();
            } else {
                prop.name = method.getName();
            }

            if (method.isAnnotationPresent(DefaultValue.class)) {
                DefaultValue val = method.getAnnotation(DefaultValue.class);
                prop.defaultValue = val.value();
            }

            unknownGroup.properties.add(prop);
        }

        return orderGroup(groups, groupsOrder);
    }
1153723
def get_annotations(self, obj):
        
        annotations = ScoreAnnotation.objects.filter(score_id=obj.id)
        return [
            ScoreAnnotationSerializer(instance=annotation).data
            for annotation in annotations
        ]
898693
private static List<Method> getMethodsWithAnnotation(Class<?> clazz, Class<? extends Annotation> annotation, Logger log) {
    List<Method> annotatedMethods = new ArrayList<Method>();
    Method classMethods[] = clazz.getDeclaredMethods();
    for(Method classMethod : classMethods) {
      if(classMethod.isAnnotationPresent(annotation) && classMethod.getParameterTypes().length == 0) {
        if(!containsMethod(classMethod, annotatedMethods)) {
          annotatedMethods.add(classMethod);
        }
      }
    }
    Collections.sort(annotatedMethods, new Comparator<Method> () {

      @Override
      public int compare(Method method1, Method method2) {
        return method1.getName().compareTo(method2.getName());
      }
    });
    return annotatedMethods;
  }
577635
private <T extends Annotation> T findAnnotation(Class<?> cls, Class<T> annotationClass, String name) {
    Class<?> curr = cls;
    T ann = null;
    while (ann == null && curr != null && !curr.equals(Object.class)) {
      ann = findAnnotationLocal(curr, annotationClass, name);
      curr = curr.getSuperclass();
    }
    return ann;
  }
565094
private String getAnnotations(Annotate annotator, String stringFromClient)
      throws JDOMException, IOException {
    // get a breader from the string coming from the client
    BufferedReader clientReader = new BufferedReader(
        new StringReader(stringFromClient));
    KAFDocument kaf = KAFDocument.createFromStream(clientReader);
    KAFDocument.LinguisticProcessor newLp = kaf.addLinguisticProcessor(
        "entities", "ixa-pipe-nerc-" + Files.getNameWithoutExtension(model),
        version + "-" + commit);
    newLp.setBeginTimestamp();
    annotator.annotateNEsToKAF(kaf);
    // get outputFormat
    String kafToString = null;
    if (outputFormat.equalsIgnoreCase("conll03")) {
      kafToString = annotator.annotateNEsToCoNLL2003(kaf);
    } else if (outputFormat.equalsIgnoreCase("conll02")) {
      kafToString = annotator.annotateNEsToCoNLL2002(kaf);
    } else {
      newLp.setEndTimestamp();
      kafToString = kaf.toString();
    }
    return kafToString;
  }