Every line of 'convert string to path python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
64 def ConvertPath(path): 65 """Makes a path portable.""" 66 if MSWINDOWS and path[1:3] != ':\\': 67 path = '%s\\%s' % (ROOTDRIVE, path) 68 return os.path.normpath(path)
1821 def w_convert_path(space, path): 1822 if not path: 1823 return space.w_None 1824 else: 1825 return space.newbytes(rffi.charp2str(path))
50 def path(base_dir, path_str): 51 return normpath(join(base_dir, *path_str.split('/')))
26 def path_convert( path, pathLibFrom, pathLibTo): 27 parts = path_split( pathLibFrom, path) 28 return path_join(pathLibTo, parts )
55 def to_native(path): 56 """ 57 Return a path using the current OS path separator given a path that may 58 contain posix or windows separators, converting "/" to "\\" on windows 59 and "\\" to "/" on posix OSes. 60 """ 61 return path.replace('\\', os.path.sep).replace('/', os.path.sep)
62 def _convert_env_to_path(env_in_path): 63 s = re.search(r"\${(\w+)}", env_in_path) 64 if not s: 65 s = re.search(r"(\$\w+)", env_in_path) 66 if s: 67 env = s.group(1).replace("$", "") 68 name = os.environ.get(env) 69 if not name: 70 raise ValueError("Can't find value for {}".format(env)) 71 path_list = [ 72 part if "$" not in part else name 73 for part in env_in_path.split("/") 74 ] 75 path = os.path.join(*path_list) 76 else: 77 raise ValueError("Cant find path for {}".format(env_in_path)) 78 return path