Translate localtopdir to jottapath. Returns unicode string
977350
def get_jottapath(localtopdir, dirpath, jottamountpoint):
    """"""
    log.debug("get_jottapath %r %r %r", localtopdir, dirpath, jottamountpoint)
    normpath =  posixpath.normpath(posixpath.join(jottamountpoint, posixpath.basename(localtopdir),
                                   posixpath.relpath(dirpath, localtopdir)))
    return _decode_filename_to_unicode(normpath)
226550
def tmppath(root=TEMPS_DIR, prefix=TEMPS_PREFIX, suffix=TEMPS_SUFFIX):
    '''
    
    '''
    return os.path.join(root, prefix + uuid.uuid4().hex + suffix)
707019
async def convert_local(path, to_type):
    '''
    
    '''
    # Now find path between types
    typed_foreign_res = TypedLocalResource(path)
    original_ts = typed_foreign_res.typestring
    conversion_path = singletons.converter_graph.find_path(
        original_ts, to_type)
    # print('Conversion path: ', conversion_path)

    # Loop through each step in graph path and convert
    for is_first, is_last, path_step in first_last_iterator(conversion_path):
        converter_class, from_ts, to_ts = path_step
        converter = converter_class()
        in_resource = TypedLocalResource(path, from_ts)
        if is_first:  # Ensure first resource is just the source one
            in_resource = typed_foreign_res
        out_resource = TypedLocalResource(path, to_ts)

        if is_last:
            out_resource = TypedPathedLocalResource(path, to_ts)
        await converter.convert(in_resource, out_resource)
139824
def upath(path):
    
    if six.PY2 and not isinstance(path, six.text_type):
        return path.decode(fs_encoding)
    return path
1119980
def LocalPathToCanonicalPath(path):
  """"""
  path_components = path.split("/")
  result = []
  for component in path_components:
    # Devices must maintain their \\ so they do not get broken up.
    m = re.match(r"\\\\.\\", component)

    # The component is not special and can be converted as normal
    if not m:
      component = component.replace("\\", "/")

    result.append(component)

  return utils.JoinPath(*result)
953521
def path_regex(self):
        """"""
        if self.locale_build:
            return self.build_list_regex

        return '%s/' % urljoin(self.build_list_regex, self.builds[self.build_index])
1249725
function readDirectory (srcDir) {
  let srcTree = {}
  const entries = fs.readdirSync(srcDir)

  entries.forEach(function (entry) {
    const filePath = path.join(srcDir, entry)
    if (fs.lstatSync(filePath).isDirectory()) {
      srcTree[entry] = readDirectory(filePath)
    } else {
      srcTree[entry] = fs.readFileSync(filePath, {
        encoding: 'utf8'
      })
    }
  })

  return srcTree
}
957706
function findI18nKeysAndStrings(filePath) {
    const textContentRegEx = /data-i18n="(.*?)".*?>\s*(.*?)\s*</gs;
    const placeholderRegEx = /data-i18n-placeholder="(.*?)"(?:.*?placeholder="(.*?)")?/g;
    const phraseRegEx = /translatePhrase\('(.*?)'\)/g;

    // Get global variable
    const contents = fs.readFileSync(filePath).toString();

    /** @type {object} */
    const dict = {};

    let textMatch;
    while ((textMatch = textContentRegEx.exec(contents)) !== null) { // eslint-disable-line no-cond-assign
        const key = textMatch[1];
        const phrase = textMatch[2];
        dict[key] = phrase;
    }

    let placeholderMatch;
    while ((placeholderMatch = placeholderRegEx.exec(contents)) !== null) { // eslint-disable-line no-cond-assign
        const key = placeholderMatch[1];
        const phrase = placeholderMatch[2] || '- not found -';
        dict[key] = phrase;
    }

    let phraseMatch;
    while ((phraseMatch = phraseRegEx.exec(contents)) !== null) { // eslint-disable-line no-cond-assign
        const key = phraseMatch[1];
        const phrase = false;
        dict[key] = phrase;
    }

    return dict;
}
923754
def getpath(self, encoding='utf-8', errors='strict'):
        """"""
        path = self.__remove_dot_segments(self.path)
        return uridecode(path, encoding, errors)
659693
function local(rootFolder) {
    // Construct name to remote id map
    const remote = path.join(rootFolder, constants.META_DIR, constants.META_REMOTE);
    const remoteSource = fs.readJsonSync(remote, 'utf8');
    const destination = constants.META_LOCAL;
    return pack(rootFolder, destination);
}
756228
function pathStrToPathArr(path) {
	path = path.substr(1).split('/').map(part => {
		// De-tokenize '/' characters in path name
		return part.replace(/~1/g, '/');
	});

	// For some reason, path arrays whose only item is an empty string cause errors.
	// In this case, we replace the path with an empty array, which seems to be fine.
	if (path.length === 1 && path[0] === '') {
		path = [];
	}

	return path;
}
490311
function translate(options, contents, copied, filePath) {
  var processed = {};
  for (var lang in dictionaries) {
    if (!processed[lang] && trueOrMatch(options.whitelist, lang) && !trueOrMatch(options.blacklist, lang)) {
      processed[lang] = '';
    }
  }
  if (!Object.keys(processed).length) {
    throw new Error('No translation dictionaries available to create any files!');
  }
  options.verbose && gutil.log('Starting translation for', processed.length, 'languages');
  if (trueOrMatch(options.ignoreTokens, filePath)) {
    options.verbose && gutil.log('Ignoring file', filePath, 'because of ignoreTokens option');
  } else if(isBinary(contents)) {
    options.verbose && gutil.log('Ignoring file', filePath, 'because file is binary');
  } else {
    contents = contents.toString('utf8');
    var i = contents.indexOf(options.delimiter.prefix);
    while ((i !== -1)) {
      var endMatch, length, token, key;
      var tail = contents.substr(i);
      if (options.delimiter.suffix) {
        endMatch = tail.match(options.delimiter.suffix);
        length = endMatch.index + endMatch[0].length;
        token = tail.substr(0, length);
        key = token.substr(options.delimiter.prefix.length, token.length - options.delimiter.prefix.length - options.delimiter.suffix.length);
      }
      else if (options.delimiter.stopCondition) {
        endMatch = tail.match(options.delimiter.stopCondition);
        length = endMatch == null ? tail.length : length = endMatch.index + endMatch[0].length - 1;
        token = tail.substr(0, length);
        key = token.substr(options.delimiter.prefix.length);
      }
      var next = contents.indexOf(options.delimiter.prefix, i + length + 1);

      for (var lang in processed) {
        processed[lang] += contents.substring(copied, i);
        if (dictionaries[lang][key] !== undefined) {
          if (trueOrMatch(options.encodeEntities, filePath)) {
            processed[lang] += he.encode(dictionaries[lang][key], { useNamedReferences: true });
          } else {
            processed[lang] += dictionaries[lang][key];
          }
        } else if (options.verbose || trueOrMatch(options.warn, filePath)) {
          gutil.log('Missing translation of language', lang, 'for key', key, 'in file', filePath);
        }
        processed[lang] += contents.substring(i + length, next == -1 ? contents.length : next);
      }
      copied = next;
      i = next;
    }
  }
  for (var procLang in processed) {
    if (!processed[procLang].length) {
      options.verbose && gutil.log('Copying original content to target language', procLang, 'because no replacements have happened');
      processed[procLang] = contents;
    }
  }
  return processed;
}
420950
def to_existing_absolute_path(string):
    """"""
    value = os.path.abspath(string)
    if not os.path.exists( value ) or not os.path.isdir( value ):
        msg = '"%r" is not a valid path to a directory.' % string
        raise argparse.ArgumentTypeError(msg)
    return value
1032949
def path_to(self, p):
        """"""
        if os.path.isabs(p):
            return p

        return os.sep.join([self._original_dir, p])
984918
public static String toPath(final IdentifierConverter<Resource, FedoraResource> idTranslator,
                                final String originalPath) {

        final Resource resource = idTranslator.toDomain(originalPath);

        final String path = idTranslator.asString(resource);

        return path.isEmpty() ? "/" : path;
    }
663386
function(){
                  var string = '\t\t\t',
                      path = info.path.replace(baseDir, '').split('/');

                  if(path.length > 1){
                    for(var i=0;i<path.length;i++){
                      string = string + '\t';
                    }
                  }

                  return string;
                }
1328222
function write (to, what, locals) {
  const content = ejs.render(what, _.extend({}, (locals || {}), { S: underscoreString }))
  return mkdirp(path.dirname(to)).then(() => {
    return fs.writeFileAsync(to, content, 'utf8')
  })
}