null terminate a string for py3
499589
def null_term(str):
    ''''''
    if sys.version_info.major < 3:
        return str
    if isinstance(str, bytes):
        str = str.decode("utf-8")
    idx = str.find("\0")
    if idx != -1:
        str = str[:idx]
    return str
698966
def json_to_string(value, null_string_repr='[]', trimable=False):
    
    return null_string_repr if is_undefined(value) \
        else obj.jsonify(value, trimable=trimable)
1227501
def get_as_nullable_string(self, key):
        
        value = self.get(key)
        return StringConverter.to_nullable_string(value)
302015
function end (input, value) {
  if (value != null) input.push(String(value))
  input.push(null)
}
605163
function (code, args, done) {
  var pyg = spawn(bin, args.toArray()),
      out = [],
      failed = false;

  pyg.on('error', function() {
    failed = true;
    done.apply(this, arguments);
  })

  pyg.stdout.setEncoding('utf8');
  pyg.stderr.setEncoding('utf8');

  var pusher = function(data) {
    out.push(data.toString());
  }

  pyg.stdout.on('data', pusher);
  pyg.stderr.on('data', pusher);

  pyg.on('exit', function (status) {
    // Return if done already called
    if(failed)
      return

    // pygmentize was successful
    if(status == 0)
      return done(null, out.join(''));

    // pygmentize was unsuccessful (cli error?)
    return done(out.join(''));
  });

  pyg.stdin.write(code);
  pyg.stdin.end();

}
971057
public static void writeString(@Nonnull String str, DataOutputView out) throws IOException {
		checkNotNull(str);
		StringValue.writeString(str, out);
	}
187068
public static String notEmptyIfNotNull(String value, String name, String info) {
        if (value == null) {
            return value;
        }

        if (value.trim().length() == 0) {
            throw new IllegalArgumentException(name + " cannot be empty" + (info == null ? "" : ", " + info));
        }
        return value.trim();
    }
1000970
def _maybe_null_out(result, axis, mask, min_count=1):
    
    if hasattr(axis, '__len__'):  # if tuple or list
        raise ValueError('min_count is not available for reduction '
                         'with more than one dimensions.')

    if axis is not None and getattr(result, 'ndim', False):
        null_mask = (mask.shape[axis] - mask.sum(axis) - min_count) < 0
        if null_mask.any():
            dtype, fill_value = dtypes.maybe_promote(result.dtype)
            result = result.astype(dtype)
            result[null_mask] = fill_value

    elif getattr(result, 'dtype', None) not in dtypes.NAT_TYPES:
        null_mask = mask.size - mask.sum()
        if null_mask < min_count:
            result = np.nan

    return result
256176
def to_nullable_string(value):
        
        if value == None:
            return None
        if type(value) == datetime.date:
            return value.isoformat()
        if type(value) == datetime.datetime:
            if value.tzinfo == None:
                return value.isoformat() + "Z"
            else:
                return value.isoformat()

        if type(value) == list:
            builder = ''
            for element in value:
                if len(builder) > 0:
                    builder = builder + ","
                builder = builder + element
            return builder.__str__()
        return str(value)
660838
def resolve_str(name_or_func, module, default):
    
    assert isinstance(name_or_func, str)
    resolved = resolve(name_or_func, module=module)

    if isinstance(resolved, ModuleType):
        if not hasattr(resolved, default):
            raise ImportError("{}.{}".format(resolved.__name__, default))

        resolved = getattr(resolved, default)

    if not callable(resolved):
        raise TypeError("{!r} is not callable"
                        "".format(resolved))

    return resolved
377744
def null():
    """"""
    import ibis.expr.operations as ops

    global _NULL
    if _NULL is None:
        _NULL = ops.NullLiteral().to_expr()

    return _NULL
245916
public static String emptyToNull(String str) {
        return (str == null || str.length() == 0 ? null : str);
    }
1059698
final public void Null() throws ParseException {
                     /*@bgen(jjtree) Null */
  AstNull jjtn000 = new AstNull(JJTNULL);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      jj_consume_token(NULL);
    } finally {
      if (jjtc000) {
        jjtree.closeNodeScope(jjtn000, true);
      }
    }
  }
1225351
protected static String turnNullString2EmptyString(String str, String NullDefaultStr)
    {
        return (str == null) ? NullDefaultStr : str;
    }
213817
function intArrayFromString(stringy, dontAddNull, length /* optional */) {
  var ret = (new Runtime.UTF8Processor()).processJSString(stringy);
  if (length) {
    ret.length = length;
  }
  if (!dontAddNull) {
    ret.push(0);
  }
  return ret;
}
40192
def nasm_null_safe_mutable_data_finalizer(env, code, data):
    

    if data or env.buffers:
        # Determine length of nullify + shellcode and adjust data pointer
        xor_offsets = []
        masked_data = OrderedDict()

        for datum, (offset, orig_datum) in six.iteritems(data):
            xor_offsets.extend([
                                   offset + i
                                   for i, b in enumerate(six.iterbytes(datum))
                                   if b in (0, 10, 13)
                                   ])

            masked_datum = b''.join([
                                        six.int2byte(b) if b not in (0, 10, 13)
                                        else six.int2byte(b ^ 0xff)
                                        for b in six.iterbytes(datum)
                                        ])
            masked_data[masked_datum] = (offset, orig_datum)

        if xor_offsets:
            # Build code to restore NUL, \r and \n
            temp_reg = env.TEMP_REG[env.target.bits]
            null_code = env.reg_load(env.BL, 255) + \
                        env.reg_load(temp_reg, env.OFFSET_REG)

            last_offset = 0
            for offset in xor_offsets:
                offset -= last_offset
                null_code.extend(
                    env.reg_add(temp_reg, offset) +
                    ['xor [%s], bl' % temp_reg]
                )
                last_offset += offset
            code = ['\t%s' % line for line in null_code] + code
            data = masked_data

        code_len = len(asm('\n'.join(code), target=env.target))
        adjust_ebp = env.reg_add(env.OFFSET_REG, code_len)

        return [
            '\tjmp __getpc1',
            '__getpc0:',
            '\tpop %s' % env.OFFSET_REG,
        ] + [
            '\t%s' % line for line in adjust_ebp
        ] + [
            '\tjmp __realstart',
            '__getpc1:',
            '\tcall __getpc0',
            '__realstart:',
        ] + code + _pack_data(data)
    else:
        return code
672440
function( input, null_text ) {
		if ( input == null || input === undefined ) return null_text || '';
		if ( typeof input === 'object' && Object.prototype.toString.call(input) === '[object Date]' ) return input.toDateString();
		if ( input.toString ) return input.toString().replace(/\n/g, '<br />').replace(/''/g, "'");
		return '';
	}