Force item to be output as a binary literal.
2045
public function forceBinary()
    {
        $this->_filter = $this->_filterParams();
        $this->_filter->binary = true;
        $this->_filter->literal = true;
        $this->_filter->quoted = false;
    }
630845
def _to_string(val):
    """"""
    if isinstance(val, binary_type):
        return val.decode('utf-8')
    assert isinstance(val, text_type)
    return val
1290375
def get_binary_property(value, is_bytes=False):
    """"""

    obj = unidata.ascii_binary if is_bytes else unidata.unicode_binary

    if value.startswith('^'):
        negated = value[1:]
        value = '^' + unidata.unicode_alias['binary'].get(negated, negated)
    else:
        value = unidata.unicode_alias['binary'].get(value, value)

    return obj[value]
85827
def from_binary_string(self, stream):
        """"""
        command, code, identifier = struct.unpack(self.FORMAT, stream)

        if command != self.COMMAND:
            raise ErrorResponseInvalidCommandError()

        if code not in self.CODES:
            raise ErrorResponseInvalidCodeError()

        self.code = code
        self.name = self.CODES[code]
        self.identifier = identifier
25846
function copyBinaryToOutput(next) {
        _log('cp %s %s', nodeCompiler.releasePath, options.output);
        ncp(nodeCompiler.releasePath, options.output, function(err) {
          if (err) {
            _log('error', "Couldn't copy binary.");
            throw err; // dump raw error object
          }
          _log('copied');

          next();
        });
      }
1004205
def _setsie(self, i):
        """"""
        if not i:
            self._setbin_unsafe('1')
        else:
            self._setuie(abs(i))
            self._append(Bits([i < 0]))
770252
def _utf8str(x):
  """"""
  if six.PY3:
    return str(x)
  if isinstance(x, six.binary_type):
    return x
  elif isinstance(x, six.text_type):
    return x.encode('utf-8')
  else:
    return six.binary_type(x)
128091
def force_unicode(value):
    
    if IS_PY3:
        # Python 3.X
        if isinstance(value, bytes):
            value = value.decode('utf-8', errors='replace')
        elif not isinstance(value, str):
            value = str(value)
    else:
        # Python 2.X
        if isinstance(value, str):
            value = value.decode('utf-8', 'replace')
        elif not isinstance(value, basestring):  # NOQA: F821
            value = unicode(value)  # NOQA: F821

    return value
1177349
def _force_text_recursive(data):
    
    if isinstance(data, list):
        ret = [
            _force_text_recursive(item) for item in data
        ]
        if isinstance(data, ReturnList):
            return ReturnList(ret, serializer=data.serializer)
        return data
    elif isinstance(data, dict):
        ret = {
            key: _force_text_recursive(value)
            for key, value in data.items()
        }
        if isinstance(data, ReturnDict):
            return ReturnDict(ret, serializer=data.serializer)
        return data
    return force_text(data)
369313
def _string_put_transform(cls, item, **kwargs):
        '''
        
        '''
        if isinstance(item, six.string_types):
            if item.lower() == 'not defined':
                return None
            else:
                return item
741155
def alt(binary_or_uint)
      case binary_or_uint
      when Integer
        alt_uint(binary_or_uint)
      when String
        alt_binary(binary_or_uint)
      else
        raise BadManipulationError, "Argument shouled be Integer or binary-encoded String."
      end
    end
1028331
def encode(cls, value):
        
        if value not in [True, False]:
            raise InvalidValue('not a boolean')

        return b'1' if value else b''
579120
private byte parseBinaryLiteral(Token input) {
		String text = input.text;
		if (text.length() > 11) {
			// FIXME: this will be deprecated!
			syntaxError("invalid binary literal (too long)", input);
		}
		int val = 0;
		// Start past 0b
		for (int i = 2; i != text.length(); ++i) {
			char c = text.charAt(i);
			// Skip underscore
			if(c == '_') { continue; }
			val = val << 1;
			if (c == '1') {
				val = val | 1;
			} else if (c == '0') {

			} else {
				syntaxError("invalid binary literal (invalid characters)", input);
			}
		}
		return (byte) val;
	}
1242323
def force_string(val=None):
    
    if val is None:
        return ''
    if isinstance(val, list):
        newval = [str(x) for x in val]
        return ';'.join(newval)
    if isinstance(val, str):
        return val
    else:
        return str(val)
1007426
def utf8(item):
    """"""
    if isinstance(item, list):
        return [utf8(i) for i in item]
    if isinstance(item, tuple):
        return tuple([utf8(i) for i in item])
    if isinstance(item, dict):
        return {utf8(k): utf8(v) for k, v in item.items()}
    try:
        return item.decode('utf-8')
    except:  # bare except since this method is supposed to be safe anywhere
        return item
1015445
def accept_lit(char, buf, pos):
    """"""
    if pos >= len(buf) or buf[pos] != char:
        return None, pos
    return char, pos+1
182151
def default(value):
    
    if isinstance(value, Decimal):
        primative = float(value)
        if int(primative) == primative:
            return int(primative)
        else:
            return primative
    elif isinstance(value, set):
        return list(value)
    elif isinstance(value, Binary):
        return b64encode(value.value)
    raise TypeError("Cannot encode %s value %r" % (type(value), value))