Similar to smart_text, except that lazy instances are resolved to
    strings, rather than kept as lazy objects.
773060
def force_unicode(s, encoding='utf-8', errors='strict'):
    
    # Handle the common case first, saves 30-40% when s is an instance of
    # six.text_type. This function gets called often in that setting.
    if isinstance(s, six.text_type):
        return s
    if not isinstance(s, six.string_types):
        if six.PY3:
            if isinstance(s, bytes):
                s = six.text_type(s, encoding, errors)
            else:
                s = six.text_type(s)
        else:
            s = six.text_type(bytes(s), encoding, errors)
    else:
        # Note: We use .decode() here, instead of six.text_type(s,
        # encoding, errors), so that if s is a SafeBytes, it ends up being
        # a SafeText at the end.
        s = s.decode(encoding, errors)
    return s
196831
def string_chain(text, filters):
        
        if filters is None:
            return text

        for filter_function in filters:
            text = filter_function(text)

        return text
263116
function smartquotes(context) {
  if (typeof document !== 'undefined' && typeof context === 'undefined') {
    listen.runOnReady(() => element(document.body));
    return smartquotes;
  } else if (typeof context === 'string') {
    return string(context);
  } else {
    return element(context);
  }
}
610036
function handleStrs(strs, opts) {
  const len = longest(strs)
  const text = strs
    .map(pad(len, opts.justify))
    .map(wrap(opts))
    .join('')
  return {len, text}
}
392480
def smart_unicode(s, encoding='utf-8', strings_only=False, errors='strict'):
    
    # if isinstance(s, Promise):
    #     # The input is the result of a gettext_lazy() call.
    #     return s
    return force_unicode(s, encoding, strings_only, errors)
528198
function(input, null_text) {
      if (input == null || input === undefined) return null_text || '';
      if (input instanceof(Date)) return input.toDateString();
      if (input.toString) return input.toString().replace(/\n/g, '<br />').replace(/''/g, "'");
      return '';
    }
110063
static void replaceHeredocStrings(ASTTemplate tnode,
            List<StringProperty> strings) {

        // Only something to do if there were heredoc strings defined.
        if (strings.size() > 0) {
            processHeredocStrings(tnode, strings);
        }
    }
1211279
public AnalyzedText analyze(String text, boolean lazy){
		AnalyzedText result = new AnalyzedText(this, text);
		if (!lazy){
			analyzeLength(result);
			analyzeWords(result);
			analyzeKeywords(result);
		}
		return result;
	}
475272
function() {
            var
              activeText   = text.active   || $module.data(metadata.storedText),
              inactiveText = text.inactive || $module.data(metadata.storedText)
            ;
            if( module.is.textEnabled() ) {
              if( module.is.active() && activeText) {
                module.verbose('Resetting active text', activeText);
                module.update.text(activeText);
              }
              else if(inactiveText) {
                module.verbose('Resetting inactive text', activeText);
                module.update.text(inactiveText);
              }
            }
          }
1341445
def lazy_gettext(self, singular, plural=None, n=1, locale=None) -> LazyProxy:
        
        return LazyProxy(self.gettext, singular, plural, n, locale)
802413
def astext(data):
    
    if isinstance(data, str):
        return data
    elif isinstance(data, text_type):
        return data.encode("utf-8", "ignore")
    elif isinstance(data, binary_type):
        return data.decode("utf-8", "ignore")
    raise TypeError('{!r} not a string'.format(data))
66661
@Override
  public AnalyzedSentence disambiguate(AnalyzedSentence input) {

    lazyInit();

    AnalyzedTokenReadings[] inputTokens = input.getTokens();
    AnalyzedTokenReadings[] outputTokens = inputTokens;
    
    for (int i = 1; i < inputTokens.length; i++) {
      AnalyzedTokenReadings analyzedToken = inputTokens[i];
      
      String firstToken = analyzedToken.getToken();
      
      List<MultiWordEntry> multiwordItems = tokenToPosTagMap.get(firstToken);
      
      if( multiwordItems == null ) {
        if (allowFirstCapitalized && StringTools.isCapitalizedWord(firstToken) ) {
          multiwordItems = tokenToPosTagMap.get(StringTools.lowercaseFirstChar(firstToken));
        }
        if( multiwordItems == null )
          continue;
      }
      
      MultiWordEntry multiwordEntry = findMultiwordEntry(inputTokens, i, multiwordItems);
      
      if( multiwordEntry == null )
        continue;

      for(int multiwordPos=0, inputTokenPos=i; multiwordPos<multiwordEntry.tokens.size(); inputTokenPos++) {
        AnalyzedTokenReadings currentToken = inputTokens[inputTokenPos];
        
        if( currentToken.isWhitespace() ) {
          continue;
        }
        
        String multiwordTag = formatPosTag(multiwordEntry.tag, multiwordPos, multiwordEntry.tokens.size());

        outputTokens[inputTokenPos] = prepareNewReading(multiwordEntry.getLemma(), currentToken.getToken(), currentToken, multiwordTag);
        ++multiwordPos;
      }
    }
    
    return new AnalyzedSentence(outputTokens);
  }
295525
def lazy_translations(cls):
        """"""
        return {
            cloudfiles.errors.NoSuchContainer: errors.NoContainerException,
            cloudfiles.errors.NoSuchObject: errors.NoObjectException,
        }
278239
def substitute(ctx, text, old_text, new_text, instance_num=-1):
    
    text = conversions.to_string(text, ctx)
    old_text = conversions.to_string(old_text, ctx)
    new_text = conversions.to_string(new_text, ctx)

    if instance_num < 0:
        return text.replace(old_text, new_text)
    else:
        splits = text.split(old_text)
        output = splits[0]
        instance = 1
        for split in splits[1:]:
            sep = new_text if instance == instance_num else old_text
            output += sep + split
            instance += 1
        return output
19699
public static LazyElement parse(String str) throws LazyException{
		int index=0;
		while(index<str.length()){
			char ch=str.charAt(index);
			if(ch=='['){
				return new LazyArray(str);
			}
			if(ch=='{'){
				return new LazyObject(str);
			}
			index++;
		}
		throw new LazyException("The given string is not a JSON object or array");
	}
1042394
def fmt_content(text, width = 0, align = '<', padding = None, padding_left = None, padding_right = None, padding_char = ' '):
        
        if padding_left is None:
            padding_left = padding
        if padding_right is None:
            padding_right = padding
        if padding_left is not None:
            text = '{}{}'.format(str(padding_char)[0] * int(padding_left), text)
        if padding_right is not None:
            text = '{}{}'.format(text, str(padding_char)[0] * int(padding_right))
        if width:
            strptrn = '{:' + ('{}{}{}'.format(str(padding_char)[0], str(TEXT_ALIGNMENT[align]), str(width))) + 's}'
            text = strptrn.format(text)
        return text
900273
def as_text(self, is_pretty=False):
        """"""
        values = {'id': self._id, 'type': self._type}
        if self._owner:
            values['owner'] = self._owner

        if is_pretty:
            return json.dumps(values, indent=4, separators=(',', ': '))

        return json.dumps(values)