Transform relative pathnames into absolute pathnames.
557891
def get_absolute_path(*args):
    """"""
    directory = os.path.dirname(os.path.abspath(__file__))
    return os.path.join(directory, *args)
166822
function reformatPaths(paths) {
	let output = {};
	
	if (!paths) {
		return output;
	}
	
	let pathsKeys = Object.keys(paths);
	
	pathsKeys.forEach(function (eachKey) {
		let newKey = eachKey;
		
		if (eachKey.includes("{") && eachKey.includes("}")) {
			// replace : {params} by :params
			newKey = newKey.replace(new RegExp('{', 'g'), ':');
			newKey = newKey.replace(new RegExp('}', 'g'), '');
		}
		
		output[newKey] = paths[eachKey];
	});
	
	return output;
}
201434
def clean_path(p):
    
    p = os.path.expanduser(p)
    p = os.path.expandvars(p)
    p = os.path.abspath(p)
    return p
1124279
def normalize_path(test, path)
      Pathname.new(path).relative_path_from(test.project.path.realpath).to_s
    end
301488
def _absolute_path(path, relative_to=None):
    '''
    
    '''

    if path and os.path.isabs(path):
        return path
    if path and relative_to is not None:
        _abspath = os.path.join(relative_to, path)
        if os.path.isfile(_abspath):
            log.debug(
                'Relative path \'%s\' converted to existing absolute path '
                '\'%s\'', path, _abspath
            )
            return _abspath
    return path
521953
def parse_relative_path(root_path, experiment_config, key):
    ''''''
    if experiment_config.get(key) and not os.path.isabs(experiment_config.get(key)):
        absolute_path = os.path.join(root_path, experiment_config.get(key))
        print_normal('expand %s: %s to %s ' % (key, experiment_config[key], absolute_path))
        experiment_config[key] = absolute_path
1193383
def path_for(self, *args):
        """"""
        if args and args[0].startswith(os.path.sep):
            return os.path.join(*args)
        return os.path.join(self._root_path or os.getcwd(), *args)
812525
def files(self, absolute=False):
        """"""

        _paths = []

        for arg in self.all:
            for path in _expand_path(arg):
                if os.path.exists(path):
                    if absolute:
                        _paths.append(os.path.abspath(path))
                    else:
                        _paths.append(path)

        return _paths
947750
def libname_from_dir(dirname):
    """"""
    parts = []
    for part in dirname.split('-'):
        if part[0].isdigit():
            break
        parts.append(part)
    return '-'.join(parts)
138171
def clean_path(root, path, subdir=False):
    '''
    
    '''
    if not os.path.isabs(root):
        return ''
    if not os.path.isabs(path):
        path = os.path.join(root, path)
    path = os.path.normpath(path)
    if subdir:
        if path.startswith(root):
            return path
    else:
        if os.path.dirname(path) == os.path.normpath(root):
            return path
    return ''
895949
def join_path(fname:PathOrStr, path:PathOrStr='.')->Path:
    ""
    return Path(path)/Path(fname)
534072
def get_abs_path(relative_path):
    
    abs_path = os.path.sep.join(
        os.path.abspath(sys.modules[__name__].__file__).split(os.path.sep)[:-1])
    abs_path = os.path.abspath(abs_path + os.path.sep + relative_path)
    return abs_path
1137092
def normalize_paths(value, parent=os.curdir):
    
    if not value:
        return []
    if isinstance(value, list):
        return value
    paths = []
    for path in value.split(','):
        path = path.strip()
        if '/' in path:
            path = os.path.abspath(os.path.join(parent, path))
        paths.append(path.rstrip('/'))
    return paths
425759
def mkdir_recursive(dirname):
    """"""
    parent = os.path.dirname(dirname)
    if parent != "":
        if not os.path.exists(parent):
            mkdir_recursive(parent)
        if not os.path.exists(dirname):
            os.mkdir(dirname)
    elif not os.path.exists(dirname):
        os.mkdir(dirname)
443483
def pretty_relpath(path, start):
    '''
    
    '''
    relpath = os.path.relpath(path, start)
    if relpath.startswith('..'):
        return path
    return relpath
798604
def abspath(self, path):
        """"""
        return os.path.abspath(os.path.join(os.path.dirname(self.path), path))
788650
def convert_path(path):
    
    if os.path.isabs(path):
        raise Exception("Cannot include file with absolute path {}. Please use relative path instead".format((path)))

    path = os.path.normpath(path)

    return path