Decode a single argument from the file-system
433452
def decode(arg, delimiter=None, encodeseq=None):
    ''''''
    arg = coerce_unicode(arg, _c.FSQ_CHARSET)
    new_arg = sep = u''
    delimiter, encodeseq = delimiter_encodeseq(
        _c.FSQ_DELIMITER if delimiter is None else delimiter,
        _c.FSQ_ENCODE if encodeseq is None else encodeseq,
        _c.FSQ_CHARSET)

    # char-wise decode walk -- minimally stateful
    encoding_trg = sep
    for c in arg:
        if len(encoding_trg):
            encoding_trg = sep.join([encoding_trg, c])
            if 4 !=  len(encoding_trg):
                continue
            try:
                c = chr(int(encoding_trg, 16))
            except ValueError:
                raise FSQEncodeError(errno.EINVAL, u'invalid decode'\
                                     u' target: {0}'.format(encoding_trg))
            c = coerce_unicode(c, _c.FSQ_CHARSET)
            encoding_trg = sep
        elif c == encodeseq:
            encoding_trg = u'0x'
            continue

        new_arg = sep.join([new_arg, c])

    # edge case, incomplete encoding at end of string
    if len(encoding_trg):
        raise FSQEncodeError(errno.EINVAL, u'truncated encoding at end of'
                             u' argument: {0}'.format(encoding_trg))

    return new_arg
651385
def get_single_outfilename(args):
    """"""
    for arg in args['query']:
        if arg in args['files']:
            return ('.'.join(arg.split('.')[:-1])).lower()
        for url in args['urls']:
            if arg.strip('/') in url:
                domain = get_domain(url)
                return get_outfilename(url, domain)
    sys.stderr.write('Failed to construct a single out filename.\n')
    return ''
48162
function decode(buf) {
  let off = 0;
  var i;

  // unpack meta
  const meta = buf[(off += 1)];
  // const VERSION = meta >> 4;
  const argv = meta & 0xf;
  const args = new Array(argv);

  // unpack args
  for (i = 0; i < argv; i += 1) {
    const len = buf.readUInt32BE(off);
    off += 4;

    args[i] = buf.slice(off, (off += len));
  }

  return args;
}
780145
def getArguments(parser):
    ""
    args = parser.parse_args()
    # parse volume and adapt to zero-indexing
    try:
        def _to_int_or_none(string):
            if 0 == len(string): return None
            return int(string)
        def _to_int_or_none_double (string):
            if 0 == len(string): return [None, None]
            return list(map(_to_int_or_none, string.split(':')))        
        args.volume = list(map(_to_int_or_none_double, args.volume.split(',')))
        args.volume = [(x[0], x[1]) for x in args.volume]
    except (ValueError, IndexError) as e:
        raise ArgumentError('Maleformed volume parameter "{}", see description with -h flag.'.format(args.volume), e)

    return args
13615
def parse_path(f1, f2):

    """"""

    import glob

    # if second argument is missing or is a wild card, point it
    # to the current directory
    f2 = f2.strip()
    if f2 == '' or f2 == '*':
        f2 = './'

    # if the first argument is a directory, use all GEIS files
    if os.path.isdir(f1):
        f1 = os.path.join(f1, '*.??h')
    list1 = glob.glob(f1)
    list1 = [name for name in list1 if name[-1] == 'h' and name[-4] == '.']

    # if the second argument is a directory, use file names in the
    # first argument to construct file names, i.e.
    # abc.xyh will be converted to abc_xyf.fits
    if os.path.isdir(f2):
        list2 = []
        for file in list1:
            name = os.path.split(file)[-1]
            fitsname = name[:-4] + '_' + name[-3:-1] + 'f.fits'
            list2.append(os.path.join(f2, fitsname))
    else:
        list2 = [s.strip() for s in f2.split(",")]

    if list1 == [] or list2 == []:
        err_msg = ""
        if list1 == []:
            err_msg += "Input files `{:s}` not usable/available. ".format(f1)

        if list2 == []:
            err_msg += "Input files `{:s}` not usable/available. ".format(f2)

        raise IOError(err_msg)

    else:
        return list1, list2
154779
def _decode_fname(self):
        """"""
        self.fname = self.fname[:self.fname.find('\0')]
        self.fname = self.fname.replace('\\', '/')
12824
def decode_file_name(aFilename)
      prefix,date,ext = aFilename.scan(/(.*?)\-(.*?)\.(.*)/).flatten
      return Time.from_date_numeric(date)
    end
618089
def fs_decode(path):
    

    path = _get_path(path)
    if path is None:
        raise TypeError("expected a valid path to decode")
    if isinstance(path, six.binary_type):
        path = path.decode(_fs_encoding, _fs_decode_errors)
    return path
775837
def filesys_decode(path):
    

    if isinstance(path, six.text_type):
        return path

    fs_enc = sys.getfilesystemencoding() or 'utf-8'
    candidates = fs_enc, 'utf-8'

    for enc in candidates:
        try:
            return path.decode(enc)
        except UnicodeDecodeError:
            continue
871803
def str_from_file(path):
    
    with open(path) as f:
        s = f.read().strip()
    return s
497668
def base64_decodefile(instr, outfile):
    
    '''
    encoded_f = StringIO(instr)

    with salt.utils.files.fopen(outfile, 'wb') as f:
        base64.decode(encoded_f, f)

    return True
505092
def _encode_filename_to_filesystem(f):
    ''''''
    log.debug('_encode_filename_to_filesystem(%s)', repr(f))
    if isinstance(f, str):
        return f
    try:
        return f.encode(sys.getfilesystemencoding())
    except UnicodeEncodeError:
        raise
38534
function (s) {
      var ary = s.split(':')
      if(ary.length < 2) return null
      if('unix' !== ary.shift()) return null
      return {
        name: '',
        path: ary.shift()
      }
    }
1236126
static String[] decode(String filename) {
        int i = filename.indexOf("+");
        if (i == -1) return new String[] { decodePart(filename), null, null };
        int j = filename.lastIndexOf("+");
        return new String[] { decodePart(filename.substring(0, i)),
                decodePart(filename.substring(i + 1, j)),
                decodePart(filename.substring(j + 1)) };
    }
935567
def read(*args):
    """"""
    return io.open(os.path.join(HERE, *args), encoding="utf-8").read()
19488
def read(path, encoding="UTF-8"):
    """"""
    with OPEN_FUNC(path, 'rb') as _file:
        cont = _file.read()
        return cont.decode(encoding)
326375
def read_from(value):
    """"""
    path = normalized_path(value)
    if not os.path.exists(path):
        raise argparse.ArgumentTypeError("%s is not a valid path." % path)
    LOG.debug("%s exists.", path)
    with open(path, 'r') as reader:
        read = reader.read()
    return read