Annotate String values at the root Tracy frame
774618
public static void annotateRoot(String... keyValueSequence) {
        TracyThreadContext ctx = threadContext.get();
        if (isValidContext(ctx)) {
            ctx.annotateRoot(keyValueSequence);
        }
    }
744049
def writePlistToString(rootObject):
    ''''''
    plistData, error = (
        NSPropertyListSerialization.
        dataFromPropertyList_format_errorDescription_(
            rootObject, NSPropertyListXMLFormat_v1_0, None))
    if plistData is None:
        if error:
            error = error.encode('ascii', 'ignore')
        else:
            error = "Unknown error"
        raise NSPropertyListSerializationException(error)
    else:
        return str(plistData)
446475
private void executeDropIndex(Tree statement) throws TException, SchemaDisagreementException, InvalidRequestException, NotFoundException
    {
        if (!CliMain.isConnected() || !hasKeySpace())
            return;

        // getColumnFamily will check if CF exists for us
        String columnFamily = CliCompiler.getColumnFamily(statement, currentCfDefs());
        String rawColumName = CliUtils.unescapeSQLString(statement.getChild(1).getText());

        CfDef cfDef = getCfDef(columnFamily);

        ByteBuffer columnName = columnNameAsBytes(rawColumName, cfDef);

        boolean foundColumn = false;

        for (ColumnDef column : cfDef.getColumn_metadata())
        {
            if (column.name.equals(columnName))
            {
                foundColumn = true;

                if (column.getIndex_type() == null)
                    throw new RuntimeException(String.format("Column '%s' does not have an index.", rawColumName));

                column.setIndex_name(null);
                column.setIndex_type(null);
            }
        }

        if (!foundColumn)
            throw new RuntimeException(String.format("Column '%s' definition was not found in ColumnFamily '%s'.",
                                                     rawColumName,
                                                     columnFamily));

        String mySchemaVersion = thriftClient.system_update_column_family(cfDef);
        sessionState.out.println(mySchemaVersion);
        keyspacesMap.put(keySpace, thriftClient.describe_keyspace(keySpace));
    }
1230087
def tostring(self, root=None, doctype=None, pretty_print=True):
        """"""
        if root is None:
            root = self.root
        return etree.tounicode(
            root, doctype=doctype or self.info.doctype, pretty_print=pretty_print
        )
370020
def _prtstr(self, obj, dashes):
        """"""
        self.prt.write('{DASHES:{N}}'.format(
            DASHES=self.fmt_dashes.format(DASHES=dashes, ID=obj.item_id),
            N=self.dash_len))
        self.prt.write("{INFO}\n".format(INFO=str(obj)))
508689
private Description checkAnnotations(
      Tree tree,
      int treePos,
      List<? extends AnnotationTree> annotations,
      Comment danglingJavadoc,
      int firstModifierPos,
      int lastModifierPos,
      VisitorState state) {
    SuggestedFix.Builder builder = SuggestedFix.builder();
    List<AnnotationTree> moveBefore = new ArrayList<>();
    List<AnnotationTree> moveAfter = new ArrayList<>();

    boolean annotationProblem = false;
    for (AnnotationTree annotation : annotations) {
      int annotationPos = ((JCTree) annotation).getStartPosition();
      if (annotationPos <= firstModifierPos) {
        continue;
      }
      AnnotationType annotationType =
          ASTHelpers.getAnnotationType(annotation, getSymbol(tree), state);
      if (annotationPos >= lastModifierPos) {
        if (tree instanceof ClassTree || annotationType == AnnotationType.DECLARATION) {
          annotationProblem = true;
          moveBefore.add(annotation);
        }
      } else {
        annotationProblem = true;
        if (tree instanceof ClassTree
            || annotationType == AnnotationType.DECLARATION
            || annotationType == null) {
          moveBefore.add(annotation);
        } else {
          moveAfter.add(annotation);
        }
      }
    }
    if (annotationProblem) {
      for (AnnotationTree annotation : moveBefore) {
        builder.delete(annotation);
      }
      for (AnnotationTree annotation : moveAfter) {
        builder.delete(annotation);
      }
      String javadoc =
          danglingJavadoc == null ? "" : removeJavadoc(state, treePos, danglingJavadoc, builder);
      builder
          .replace(
              firstModifierPos,
              firstModifierPos,
              String.format("%s%s ", javadoc, joinSource(state, moveBefore)))
          .replace(
              lastModifierPos, lastModifierPos, String.format("%s ", joinSource(state, moveAfter)));
      ImmutableList<String> names =
          annotations.stream()
              .map(ASTHelpers::getSymbol)
              .filter(Objects::nonNull)
              .map(Symbol::getSimpleName)
              .map(a -> "@" + a)
              .collect(toImmutableList());
      String flattened = names.stream().collect(joining(", "));
      String isAre = names.size() > 1 ? "are not type annotations" : "is not a type annotation";
      String message =
          String.format(
              "%s %s, so should appear before any modifiers and after Javadocs.", flattened, isAre);
      return buildDescription(tree).setMessage(message).addFix(builder.build()).build();
    }
    return NO_MATCH;
  }
1320151
function Text( annotations ) {

	// INSTANCE ATTRIBUTES //

	this._parent = annotations;
	this._root = undefined;
	this._children = {};
	this._config = {
		'width': 200,
		'height': 20,
		'position': {
			'left': 0,
			'top': 0
		},
		'text': ''
	};

	// REGISTER //
	if ( annotations._config.hasOwnProperty( 'text' )  ) {
		annotations._config.text.push( this._config );
	} else {
		annotations._config.text = [ this._config ];
	}
	if ( annotations._children.hasOwnProperty( 'text' ) ) {
		annotations._children.text.push( this );
	} else {
		annotations._children.text = [ this ];
	}

	return this;
}
1147173
@Override
    public void visitAnnotation(Annotations arg0) {
        for (AnnotationEntry ae : arg0.getAnnotationEntries()) {
            boolean runtimeVisible = ae.isRuntimeVisible();
            String name = ClassName.fromFieldSignature(ae.getAnnotationType());
            if (name == null) {
                continue;
            }
            name = ClassName.toDottedClassName(name);
            Map<String, ElementValue> map = new HashMap<>();
            for (ElementValuePair ev : ae.getElementValuePairs()) {
                map.put(ev.getNameString(), ev.getValue());
            }
            visitAnnotation(name, map, runtimeVisible);

        }

    }
1330615
public void toStringRep(String indent, Map<String, String> nss, 
            XNAppender out, Consumer<? super XRepresentationRecord> callback) {
        
        Map<String, String> nss0 = new HashMap<>(nss);
        
        out.append(indent);
        
        if (callback != null) {
            callback.accept(new XRepresentationRecord(XRepresentationState.START_ELEMENT, this, 
                    out.length()));
        }
        out.append("<");
        
        Pair<String, String> pf = createPrefix(nss0, namespace, prefix);
        
        String prefix = pf.first;
        if (prefix != null && prefix.length() > 0) {
            out.append(prefix).append(":");
        }
        out.append(name);

        if (pf.second != null) {
            out.append(pf.second);
        }
        
        if (attributes.size() > 0) {
            for (XAttributeName an : attributes.keySet()) {
                Pair<String, String> pfa = createPrefix(nss0, an.namespace, an.prefix);
                out.append(" ");
                if (pfa.first != null && pfa.first.length() > 0) {
                    out.append(pfa.first).append(":");
                }
                out.append(an.name).append("='").append(sanitize(attributes.get(an))).append("'");
                
                if (pfa.second != null) {
                    out.append(pfa.second);
                }
                
            }
        }
        
        if (children.size() == 0) {
            if (content == null || content.isEmpty()) {
                out.append("/>");
            } else {
                out.append(">");
                if (callback != null) {
                    callback.accept(new XRepresentationRecord(XRepresentationState.START_TEXT, this, out.length()));
                }
                String s = sanitize(content);
                out.append(s);
                if (callback != null) {
                    callback.accept(new XRepresentationRecord(XRepresentationState.END_TEXT, this, out.length()));
                }
                if (s.endsWith("\n")) {
                    out.append(indent);
                }
                out.append("</");
                if (prefix != null && prefix.length() > 0) {
                    out.append(prefix).append(":");
                }
                out.append(name);
                out.append(">");
            }
        } else {
            if (content == null || content.isEmpty()) {
                out.append(String.format(">%n"));
            } else {
                out.append(">");
                if (callback != null) {
                    callback.accept(new XRepresentationRecord(XRepresentationState.START_TEXT, this, out.length()));
                }
                out.append(sanitize(content));
                if (callback != null) {
                    callback.accept(new XRepresentationRecord(XRepresentationState.END_TEXT, this, out.length()));
                }

                out.append(String.format("%n"));
            }
            for (XNElement e : children) {
                e.toStringRep(indent + "  ", nss0, out, callback);
            }
            out.append(indent).append("</");
            if (prefix != null && prefix.length() > 0) {
                out.append(prefix).append(":");
            }
            out.append(name);
            out.append(">");
        }
        if (callback != null) {
            callback.accept(new XRepresentationRecord(XRepresentationState.END_ELEMENT, this, out.length()));
        }
        out.append(String.format("%n"));
    }
633559
public AnnotationValueBuilder<T> value(@Nullable String str) {
        return member(AnnotationMetadata.VALUE_MEMBER, str);
    }
1330679
def append_value_continuation(self, linenum, indent, continuation):
        
        frame = self.current_frame()
        assert isinstance(frame,FieldFrame) or isinstance(frame,ValueContinuationFrame)
        if isinstance(frame, FieldFrame):
            assert frame.indent < indent and frame.container.contains(ROOT_PATH, frame.field_name)
        if isinstance(frame, ValueContinuationFrame):
            assert frame.indent == indent and frame.container.contains(ROOT_PATH, frame.field_name)
            self.pop_frame()
        field_value = frame.field_value + '\n' + continuation
        frame.container.put_field(ROOT_PATH, frame.field_name, field_value)
        frame = ValueContinuationFrame(linenum, indent, frame.path, frame.container, frame.field_name, field_value)
        self.push_frame(frame)
640223
private void readJSR303Annotations(UIComponent component) {
		coreExpression = ELTools.getCoreValueExpression(component);
//		Annotation[] annotations = ELTools.readAnnotations(component);
//		if (null != annotations) {
//			for (Annotation a : annotations) {
//				if (a instanceof Max) {
//					long maximum = ((Max) a).value();
//					max = maximum;
//					hasMax = true;
//				} else if (a instanceof Min) {
//					long minimum = ((Min) a).value();
//					hasMin = true;
//					min = minimum;
//				} else if (a instanceof Size) {
//					maxSize = ((Size) a).max();
//					hasMaxSize = maxSize > 0;
//					minSize = ((Size) a).min();
//					hasMinSize = minSize > 0;
//				} else if (a instanceof NotNull) {
//					isRequired = true;
//				} else if (a.annotationType().getSimpleName().equals("NotEmpty")) {
//					isRequired = true;
//				}
//			}
//		}

		clazz = ELTools.getType(component);
		if ((clazz == Integer.class) || (clazz == int.class)
				|| (clazz == Byte.class) || (clazz == byte.class)
				|| (clazz == Short.class) || (clazz == short.class)
				|| (clazz == Long.class) || (clazz == long.class)) {
			isInteger = true;
			isNumeric = true;
		} else if ((clazz == Double.class) || (clazz == double.class)
				|| (clazz == Float.class) || (clazz == float.class)) {
			isFloat = true;
			isNumeric = true;
		} else if ((clazz==Date.class) || (clazz==java.util.Date.class)) {
			isDate=true;
		}
		else if ((clazz==Boolean.class) || (clazz==boolean.class)) {
			isBoolean=true;
		}
	}
1036756
private void parseAnnotatableText(String text, Element parent) {
	  AnnotationNode annotation = null;
	  Matcher matcher = AnnotationParser.WIDGET_ANNOTATION_REGEX.matcher(text);

	  int previousEnd = 0;
	  while (matcher.find()){
		  int start = matcher.start();

		  // build a new text node for what is between last index and current annotation
		  if (start > previousEnd)	{
			  String segment = text.substring(previousEnd, start);
			  // ignore empty white space
			  if (segment.trim().length() > 0){
				  addTextNodeToParent (segment, parent, annotation);
				  annotation = null;
			  }
		  }

		  // parse the annotation
		  String annotationText = matcher.group().trim();
		  if (null != annotationText) {
		      annotation = new AnnotationNode(annotationText);
		      lines(annotation, annotationText);
		  }
		  previousEnd = matcher.end();
	  }
	  
	  // handle leftover text if we parsed some segment
	  if (previousEnd > 0 && previousEnd < text.length()){
		  String segment = text.substring(previousEnd);
		  if (segment.trim().length() > 0){
			  addTextNodeToParent (segment, parent, annotation);
			  annotation = null;
		  }
	  }
	  
	  // store the remaining annotation for use by whatever is parsed next
	  if (annotation != null)
		  add(annotation);
	  
	  // handle no annotations being found
	  if (previousEnd == 0){
		  Node dataNode;
		  if (parent.tagName().equals(titleTag) || parent.tagName().equals(textareaTag))
	        dataNode = TextNode.createFromEncoded(text, baseUri);
	      else // data not encoded but raw (for " in script)
	        dataNode = new DataNode(text, baseUri);
	      lines(dataNode, text);
	      
	      if (pendingAnnotation != null)
	          pendingAnnotation.apply(dataNode);
	      
		  // put the text node on the parent
		  parent.appendChild(dataNode);
	  }
  }
245192
def process_annotation(self, ann):
        """"""
        tmpl = self.xsl_template("@" + self.qname(ann))
        ET.SubElement(tmpl, "param", name="level", select="0")
        ct = self.xsl_calltemplate("leaf", tmpl)
        ET.SubElement(ct, "with-param", name="level", select="$level")
        self.xsl_withparam("nsid", ann.i_module.i_modulename + ":", ct)
        self.type_param(ann, ct)
582139
def parse_root(raw):
    ""
    if sys.version < '3':
        fp = StringIO(raw)
    else:
        fp = BytesIO(raw.encode('UTF-8'))
    for event, element in etree.iterparse(fp, events=('start',)):
        return (element.tag, element.attrib)
424227
protected final void addDefaultAnnotationValues(String annotation, Map<CharSequence, Object> values) {
        if (annotation != null) {
            Map<String, Map<CharSequence, Object>> annotationDefaults = this.annotationDefaultValues;
            if (annotationDefaults == null) {
                this.annotationDefaultValues = new HashMap<>();
                annotationDefaults = this.annotationDefaultValues;
            }

            putValues(annotation, values, annotationDefaults);
        }
    }
383606
private static ImmutableList<ErrorProneToken> annotationTokens(
      Tree tree, VisitorState state, int annotationEnd) {
    int endPos;
    if (tree instanceof JCMethodDecl) {
      JCMethodDecl methodTree = (JCMethodDecl) tree;
      endPos =
          methodTree.getBody() == null
              ? state.getEndPosition(methodTree)
              : methodTree.getBody().getStartPosition();
    } else if (tree instanceof JCVariableDecl) {
      endPos = ((JCVariableDecl) tree).getType().getStartPosition();
    } else if (tree instanceof JCClassDecl) {
      JCClassDecl classTree = (JCClassDecl) tree;
      endPos =
          classTree.getMembers().isEmpty()
              ? state.getEndPosition(classTree)
              : classTree.getMembers().get(0).getStartPosition();
    } else {
      throw new AssertionError();
    }
    return ErrorProneTokens.getTokens(
        state.getSourceCode().subSequence(annotationEnd, endPos).toString(), state.context);
  }