Convert rcode into text.

    @param value: the rcode
    @type value: int
    @rtype: string
179755
def to_text(value):
    

    text = _by_value.get(value)
    if text is None:
        text = str(value)
    return text
926254
def render_value(value):
    """"""
    if isinstance(value, list):
        return '[' + ', '.join(render_value(v) for v in value) + ']'
    elif isinstance(value, dict):
        return (
            '{' +
            ', '.join('{k!r}: {v}'.format(
                k=k, v=render_value(v)) for k, v in sorted(value.items())) +
            '}')
    else:
        return repr(value)
1344924
def line(self, value):
        

        if value is not None:
            assert type(value) is int, "'{0}' attribute: '{1}' type is not 'int'!".format("line", value)
            assert value > 0, "'{0}' attribute: '{1}' need to be exactly positive!".format("line", value)
        self.__line = value
507476
def value_to_python(self, value):
        
        if not isinstance(value, bytes):
            raise tldap.exceptions.ValidationError("should be bytes")
        if value is None:
            return value
        try:
            return int(value)
        except (TypeError, ValueError):
            raise tldap.exceptions.ValidationError("is invalid integer")
953118
def to_int(value: str) -> int:
    
    if is_0x_prefixed(value):
        if len(value) == 2:
            return 0
        else:
            return int(value, 16)
    else:
        return int(value)
690213
def encode(self, value):
        
        if isinstance(value, Token):
            return b(value.value)        
        if isinstance(value, bytes):
            return value
        elif isinstance(value, (int, long)):
            value = b(str(value))        
        elif isinstance(value, float):
            value = repr(value)
        elif not isinstance(value, basestring):
            value = str(value)
        if isinstance(value, unicode):
            value = value.encode(self.encoding, self.encoding_errors)
        return value
27381
def convert_value_to_text r
        str = []
        fmt = nil
        field = nil
        # we need to loop through chash and get index from it and get that row from r
        each_column {|c,i|
          e = r[c.index]
          w = c.width
          l = e.to_s.length
          # if value is longer than width, then truncate it
          if l > w
            fmt = "%.#{w}s "
          else
            case c.align
            when :right
              fmt = "%#{w}s "
            else
              fmt = "%-#{w}s "
            end
          end
          field = fmt % e
          # if we really want to print a single column with color, we need to print here itself
          # each cell. If we want the user to use tmux formatting in the column itself ...
          # FIXME - this must not be done for headers.
          #if c.color
          #field = "#[fg=#{c.color}]#{field}#[/end]"
          #end
          str << field
        }
        return str
      end
693800
def value_to_db(self, value):
        
        assert isinstance(value, six.integer_types)
        return str(value).encode("utf_8")
431777
def _serialize_value(self, value):
        

        if isinstance(value, datetime.datetime):
            return value.strftime(self.datetime_format)
        elif isinstance(value, datetime.date):
            return value.strftime(self.date_format)
        elif isinstance(value, datetime.time):
            return value.strftime(self.time_format)
        return text_type(value)
228609
def setText(self, value):
        
        if isinstance(value, Text):
            self.text = value
        else:
            self.text = Text(value)
        return self
131376
def _render_value(self, val, context, delimiters=None):
        
        if not is_string(val):
            # In case the template is an integer, for example.
            val = self.to_str(val)
        if type(val) is not unicode:
            val = self.literal(val)
        return self.render(val, context, delimiters)
217597
def _cast_to_type(self, value):
        
        if isinstance(value, str) or value is None:
            return value
        return str(value)
1246185
def set_rcode(self, rcode):
        
        (value, evalue) = dns.rcode.to_flags(rcode)
        self.flags &= 0xFFF0
        self.flags |= value
        self.ednsflags &= 0x00FFFFFFL
        self.ednsflags |= evalue
        if self.ednsflags != 0 and self.edns < 0:
            self.edns = 0
727329
def encode(self, value):
        
        opcode = self.cmddict[value].opcode
        return super(CmdType, self).encode(opcode)
1221119
def append_varint32(self, value):
        
        if not wire_format.INT32_MIN <= value <= wire_format.INT32_MAX:
            raise errors.EncodeError('Value out of range: %d' % value)
        self.append_varint64(value)
1190733
def format_arg(value):
    
    translator = repr if isinstance(value, six.string_types) else six.text_type
    return translator(value)
678299
def _send_int(self,value):
        

        # Coerce to int. This will throw a ValueError if the value can't 
        # actually be converted.
        if type(value) != int:
            new_value = int(value)

            if self.give_warnings:
                w = "Coercing {} into int ({})".format(value,new_value)
                warnings.warn(w,Warning)
                value = new_value

        # Range check
        if value > self.board.int_max or value < self.board.int_min:
            err = "Value {} exceeds the size of the board's int.".format(value)
            raise OverflowError(err)
           
        return struct.pack(self.board.int_type,value)