Creates a SanitizedContent object with default direction.
161542
static SanitizedContent create(String content, ContentKind kind) {
    checkArgument(
        kind != ContentKind.TEXT, "Use UnsanitizedString for SanitizedContent with a kind of TEXT");
    if (Flags.stringIsNotSanitizedContent()) {
      return new SanitizedContent(content, kind, kind.getDefaultDir());
    }
    return SanitizedCompatString.create(content, kind, kind.getDefaultDir());
  }
648764
public static SanitizedContent fromTrustedResourceUrl(TrustedResourceUrl url) {
    return SanitizedContent.create(
        url.getTrustedResourceUrlString(), ContentKind.TRUSTED_RESOURCE_URI);
  }
71688
public static Expression sanitizedContentOrdainerFunctionForInternalBlocks(
      SanitizedContentKind kind) {
    return symbolWithNamespace(
        NodeContentKinds.getJsImportForOrdainersFunctions(kind),
        NodeContentKinds.toJsSanitizedContentOrdainerForInternalBlocks(kind));
  }
559465
public static SanitizedContent filterSipUri(SoyValue value) {
    value = normalizeNull(value);
    return filterSipUri(value.coerceToString());
  }
1081050
def p_casecontent_statement_default(self, p):
        ''
        p[0] = Case(None, p[3], lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
494628
@Override
  protected Expression maybeWrapContent(
      CodeChunk.Generator generator, CallParamContentNode node, Expression content) {
    SanitizedContentKind kind = node.getContentKind();
    if (kind == SanitizedContentKind.HTML || kind == SanitizedContentKind.ATTRIBUTES) {
    return content;
  }
    return super.maybeWrapContent(generator, node, content);
  }
828597
private String buildContentUrl( String methodPath, CPath path )
    {
        return CONTENT_END_POINT + '/' + methodPath + '/' + scope + path.getUrlEncoded();
    }
307625
public static SanitizedContent serializeObject(Gson gson, Object obj) {
    return ordainJson(gson.toJson(obj));
  }
8874
public static SanitizedContent fromSafeScript(SafeScript script) {
    return SanitizedContent.create(script.getSafeScriptString(), ContentKind.JS);
  }
779496
public static SanitizedContent concatHtml(SanitizedContent... contents) {
    for (SanitizedContent content : contents) {
      checkArgument(content.getContentKind() == ContentKind.HTML, "Can only concat HTML");
    }

    StringBuilder combined = new StringBuilder();
    Dir dir = Dir.NEUTRAL; // Empty string is neutral.
    for (SanitizedContent content : contents) {
      combined.append(content.getContent());
      if (dir == Dir.NEUTRAL) {
        // neutral + x -> x
        dir = content.getContentDirection();
      } else if (content.getContentDirection() == dir
          || content.getContentDirection() == Dir.NEUTRAL) {
        // x + x|neutral -> x, so leave dir unchanged.
      } else {
        // LTR|unknown + RTL|unknown -> unknown
        // RTL|unknown + LTR|unknown -> unknown
        dir = null;
      }
    }
    return SanitizedContent.create(combined.toString(), ContentKind.HTML, dir);
  }
1282426
protected String sanitizeContentTypes(String contentType) {
        if (StringUtils.isNullOrEmpty(contentType)) {
            return null;
        }

        StringBuilder sb = new StringBuilder();
        String[] types = contentType.split(",");
        for (String type : types) {
            if (type.contains(";")) {
                // drop ;q=0.8 quality scores
                type = type.substring(0, type.indexOf(';'));
            }

            sb.append(type).append(',');
        }

        // trim trailing comma
        sb.setLength(sb.length() - 1);

        return sb.toString();
    }
1018241
def sanitize(self):
        '''
        
        '''
        super(EncapsulatedControlMessage, self).sanitize()

        # S: This is the Security bit.  When set to 1 the following
        # authentication information will be appended to the end of the Map-
        # Reply.  The detailed format of the Authentication Data Content is
        # for further study.
        if not isinstance(self.security, bool):
            raise ValueError('Security flag must be a boolean')

        if self.security:
            raise NotImplementedError('Handling security data is not ' +
                                      'implemented yet')

        # "D" is the "DDT-originated" flag and is set by a DDT client to
        # indicate that the receiver can and should return Map-Referral
        # messages as appropriate.
        if not isinstance(self.ddt_originated, bool):
            raise ValueError('DDT originated flag must be a boolean')

        # The 6th bit in the ECM LISP header is allocated as the "R"
        # bit.  The R bit indicates that the encapsulated Map-Register is
        # to be processed by an RTR.
        if not isinstance(self.for_rtr, bool):
            raise ValueError('For-RTR flag must be a boolean')

        # The 7th bit in the ECM header is allocated as the "N" bit.  The
        # N bit indicates that this Map-Register is being relayed by an
        # RTR.  When an RTR relays the ECM-ed Map-Register to a Map-Server,
        # the N bit must be set to 1.
        if not isinstance(self.relayed_by_rtr, bool):
            raise ValueError('Relayed-by-RTR flag must be a boolean')
333517
public SafeScript toSafeScript() {
    Preconditions.checkState(
        getContentKind() == ContentKind.JS,
        "toSafeScript() only valid for SanitizedContent of kind JS, is: %s",
        getContentKind());
    return UncheckedConversions.safeScriptFromStringKnownToSatisfyTypeContract(getContent());
  }
1230446
public final LoggingAdvisingAppendable setSanitizedContentDirectionality(@Nullable Dir contentDir)
      throws IOException {
    if (!contentDirSet) {
      contentDirSet = true;
      this.contentDir = contentDir;
      notifyContentDirectionality(contentDir);
    }
    return this;
  }
356890
public static SanitizedContent jsIdentifier(String identifier) {
    checkArgument(
        VALID_JS_IDENTIFIER_PATTERN.matcher(identifier).matches(),
        "JS identifier '%s' should match the pattern '%s'",
        identifier,
        VALID_JS_IDENTIFIER_PATTERN.pattern());
    checkArgument(
        !INVALID_JS_IDENTIFIERS.contains(identifier),
        "JS identifier '%s' should not be a reserved word or match a literal",
        identifier);
    return UnsafeSanitizedContentOrdainer.ordainAsSafe(identifier, ContentKind.JS);
  }
885959
public SafeStyle toSafeStyle() {
    Preconditions.checkState(
        getContentKind() == ContentKind.CSS,
        "toSafeStyle() only valid for SanitizedContent of kind CSS, is: %s",
        getContentKind());

    // Sanity check: Try to prevent accidental misuse when this is a full stylesheet rather than a
    // declaration list.
    // The error may trigger incorrectly if the content contains curly brackets inside comments or
    // quoted strings.
    //
    // This is a best-effort attempt to preserve SafeStyle's semantical guarantees.
    Preconditions.checkState(
        !getContent().contains("{"),
        "Calling toSafeStyle() with content that doesn't look like CSS declarations. "
            + "Consider using toSafeStyleSheet().");

    return UncheckedConversions.safeStyleFromStringKnownToSatisfyTypeContract(getContent());
  }
188652
def createDocument_(self, initDict = None) :
        ""
        if initDict is None :
            initV = {}
        else :
            initV = initDict

        return self.documentClass(self, initV)