MCPcopy Index your code
hub / github.com/pyload/pyload / relpath

Function relpath

module/web/filters.py:12–23  ·  view source on GitHub ↗

Return a relative version of a path

(path, start=curdir)

Source from the content-addressed store, hash-verified

10except:
11 from posixpath import curdir, sep, pardir
12 def relpath(path, start=curdir):
13 """Return a relative version of a path"""
14 if not path:
15 raise ValueError("no path specified")
16 start_list = abspath(start).split(sep)
17 path_list = abspath(path).split(sep)
18 # Work out how much of the filepath is shared by start and path.
19 i = len(commonprefix([start_list, path_list]))
20 rel_list = [pardir] * (len(start_list)-i) + path_list[i:]
21 if not rel_list:
22 return curdir
23 return join(*rel_list)
24
25def quotepath(path):
26 try:

Callers 2

choose_pathFunction · 0.90
path_make_relativeFunction · 0.85

Calls 1

splitMethod · 0.80

Tested by

no test coverage detected