Return the PyStringExpr for the render function call, because we know render always return a
string in Python runtime.
974493
PyStringExpr getPyExpr() {
    if (this.msgNode.isPlrselMsg()) {
      return this.msgNode.isPluralMsg() ? pyFuncForPluralMsg() : pyFuncForSelectMsg();
    } else {
      return this.msgNode.isRawTextMsg() ? pyFuncForRawTextMsg() : pyFuncForGeneralMsg();
    }
  }
316610
def get_string(ea):
    
    # We get the item-head because the `GetStringType` function only works on the head of an item.
    string_type = idc.GetStringType(idaapi.get_item_head(ea))

    if string_type is None:
        raise exceptions.SarkNoString("No string at 0x{:08X}".format(ea))

    string = idc.GetString(ea, strtype=string_type)

    if not string:
        raise exceptions.SarkNoString("No string at 0x{:08X}".format(ea))

    return string
1128883
def visitObjectExpr(self, ctx: jsgParser.ObjectExprContext):
        
        if not self._name:
            self._name = self._context.anon_id()
        if ctx.membersDef():
            self.visitChildren(ctx)
        elif ctx.MAPSTO():
            if ctx.LEXER_ID_REF():
                self._map_name_type = as_token(ctx)
            # Any and absent mean the same thing
            self._map_valuetype = JSGValueType(self._context, ctx.valueType())
            if ctx.ebnfSuffix():
                self._map_ebnf = JSGEbnf(self._context, ctx.ebnfSuffix())
116736
function render() {
  return function(...args) {
    return (
      <PseudoContext.Consumer>
        {value => {
          if (!value) {
            return defaultTextRender.apply(this, args);
          }
          return renderText(args, this);
        }}
      </PseudoContext.Consumer>
    );
  };
}
503255
def render_string(template_string, context, format = default_format)
      render_file(proc_template(template_string), context, format)
    end
1044299
def render_to_string(self, template_file, context):
        """"""
        context = context if context else {}
        if self.object:
            context['object'] = self.object
            context[self.object.__class__.__name__.lower()] = self.object
        return render_to_string(template_file, context, self.request)
719231
def template_string(context, template):
    ''
    if not isinstance(context, Context):
        context = Context(context)
    return Template(template).render(context)
519977
function (str) {
    var lit = this.ast_stringify(t.stringLiteral(str));
    var ast = this.ast_buffer(lit);
    return ast;
  }
1279868
def all_to_str(self):
        
        def stringify(x):
            # float --> string,
            # truncating floats like 3.0 --> 3
            if isinstance(x, float):
                if x.is_integer():
                    #print('{} --> {}'.format(x, str(x).rstrip('0').rstrip('.')))
                    return str(x).rstrip('0').rstrip('.')
                return(str(x))
            # keep strings as they are,
            # unless it is a string like "3.0",
            # in which case truncate that too
            if isinstance(x, str):
                try:
                    float(x)
                    if x.endswith('0'):
                        if x.rstrip('0').endswith('.'):
                            #print('{} --> {}'.format(x, x.rstrip('0').rstrip('.')))
                            return x.rstrip('0').rstrip('.')
                except (ValueError, TypeError):
                    pass
            # integer --> string
            if isinstance(x, int):
                return str(x)
            # if it is not int/str/float, just return as is
            return x

        def remove_extra_digits(x, prog):
            """
            Remove extra digits
            x is a string,
            prog is always the following '_sre.SRE_Pattern':
            prog = re.compile("\d*[.]\d*([0]{5,100}|[9]{5,100})\d*\Z").
            However, it is compiled outside of this sub-function
            for performance reasons.
            """
            if not isinstance(x, str):
                return x
            result = prog.match(x)
            if result:
                decimals = result.string.split('.')[1]
                result = result.string
                if decimals[-3] == '0':
                    result = x[:-2].rstrip('0')
                if decimals[-3] == '9':
                    result = x[:-2].rstrip('9')
                    try:
                        last_digit = int(result[-1])
                        result = result[:-1] + str(last_digit + 1)
                    except ValueError:
                        result = float(result[:-1]) + 1
                #if result != x:
                #    print('changing {} to {}'.format(x, result))
                return result
            return x

        for col in self.df.columns:
            self.df[col] = self.df[col].apply(stringify)

        prog = re.compile("\d*[.]\d*([0]{5,100}|[9]{5,100})\d*\Z")
        for col in self.df.columns:
            self.df[col] = self.df[col].apply(lambda x: remove_extra_digits(x, prog))
1211186
def getTypeStr(_type):
  
  """
  if isinstance(_type, CustomType):
    return str(_type)

  if hasattr(_type, '__name__'):
    return _type.__name__

  return ''
549885
public String eval(String expr) {
        String result = "undefined";
        if (expr == null) {
            return result;
        }
        ContextData contextData = currentContextData();
        if (contextData == null || frameIndex >= contextData.frameCount()) {
            return result;
        }
        StackFrame frame = contextData.getFrame(frameIndex);
        if (contextData.eventThreadFlag) {
            Context cx = Context.getCurrentContext();
            result = do_eval(cx, frame, expr);
        } else {
            synchronized (monitor) {
                if (insideInterruptLoop) {
                    evalRequest = expr;
                    evalFrame = frame;
                    monitor.notify();
                    do {
                        try {
                            monitor.wait();
                        } catch (InterruptedException exc) {
                            Thread.currentThread().interrupt();
                            break;
                        }
                    } while (evalRequest != null);
                    result = evalResult;
                }
            }
        }
        return result;
    }
1121530
def render(self, data, accepted_media_type=None, renderer_context=None):
        
        if data is None:
            return ''

        stream = StringIO()

        xml = SimplerXMLGenerator(stream, self.charset)
        xml.startDocument()
        xml.startElement(self.root_tag_name, {})

        self._to_xml(xml, data)

        xml.endElement(self.root_tag_name)
        xml.endDocument()
        return stream.getvalue()
163904
def _render_str(self, string):
        """"""
        if isinstance(string, StrLabel):
            string = string._render(string.expr)
        string = str(string)
        if len(string) == 0:
            return ''
        name, supers, subs = split_super_sub(string)
        return render_unicode_sub_super(
            name, subs, supers, sub_first=True, translate_symbols=True,
            unicode_sub_super=self._settings['unicode_sub_super'])
56288
@Override
  protected PyExpr visitCallBasicNode(CallBasicNode node) {
    String calleeName = node.getCalleeName();

    // Build the Python expr text for the callee.
    String calleeExprText;
    TemplateNode template = getTemplateIfInSameFile(node);
    if (template != null) {
      // If in the same module no namespace is required.
      calleeExprText = getLocalTemplateName(template);
    } else {
      // If in another module, the module name is required along with the function name.
      int secondToLastDotIndex = calleeName.lastIndexOf('.', calleeName.lastIndexOf('.') - 1);
      calleeExprText = calleeName.substring(secondToLastDotIndex + 1);
    }

    String callExprText = calleeExprText + "(" + genObjToPass(node) + ", ijData)";
    return escapeCall(callExprText, node.getEscapingDirectives());
  }
1352772
def get_string(self):
    
    ostr = ''
    ostr += 'BaseError for ['+self._type+'] base: '+self.get_base()+"\n"
    if self._observable.get_error_probability() > 0:
      ostr += '  Homopolymer set:'+"\n"
      ostr += '    '+str(self.get_homopolymer())+"\n"
      ostr += '  Observable:'+"\n"
      ostr += '    type is: '+str(self.get_observable_type())+"\n"
      ostr += '    P(error): '+str(self._observable.get_error_probability())+"\n"
      ostr += '    Elength:  '+str(self._observable.get_attributable_length())+"\n"
    before = self._unobservable.get_before_type()
    after = self._unobservable.get_after_type()
    if before or after:
      ostr += '  Unobservable '
      if self._type == 'query': ostr += 'deletion:'+"\n"
      else: ostr += 'insertion:'+"\n"
      ostr += '    P(error): '+str(self._unobservable.get_error_probability())+"\n"
      ostr += '    Elength:  '+str(self._unobservable.get_attributable_length())+"\n"
      if before:
        ostr += '    before: '+"\n"
        ostr += '      P(error): '+str(self._unobservable.get_before_probability())+"\n"
        ostr += '      '+str(before)+"\n"
      if after:
        ostr += '    after:'+"\n"
        ostr += '      P(error): '+str(self._unobservable.get_after_probability())+"\n"
        ostr += '      '+str(after)+"\n"
    return ostr
599074
def render(self, url, template=None, expiration=0):
        
        template = template or self.default_template
        
        return render_to_string(template, self.get_context(url, expiration))
444354
def process_format(self, kind, context):
		""""""
		
		result = None
		
		while True:
			chunk = yield result
			
			if chunk is None:
				return
			
			# We need to split the expression defining the format string from the values to pass when formatting.
			# We want to allow any Python expression, so we'll need to piggyback on Python's own parser in order
			# to exploit the currently available syntax.  Apologies, this is probably the scariest thing in here.
			split = -1
			line = chunk.line
			
			try:
				ast.parse(line)
			except SyntaxError as e:  # We expect this, and catch it.  It'll have exploded after the first expr.
				split = line.rfind(' ', 0, e.offset)
			
			result = chunk.clone(line='_bless(' + line[:split].rstrip() + ').format(' + line[split:].lstrip() + ')')