MCPcopy Create free account
hub / github.com/ipython/ipython / full_path

Function full_path

IPython/testing/tools.py:47–80  ·  view source on GitHub ↗

Make full paths for all the listed files, based on startPath. Only the base part of startPath is kept, since this routine is typically used with a script's ``__file__`` variable as startPath. The base of startPath is then prepended to all the listed files, forming the output list.

(startPath,files)

Source from the content-addressed store, hash-verified

45
46@doctest_deco
47def full_path(startPath,files):
48 """Make full paths for all the listed files, based on startPath.
49
50 Only the base part of startPath is kept, since this routine is typically
51 used with a script's ``__file__`` variable as startPath. The base of startPath
52 is then prepended to all the listed files, forming the output list.
53
54 Parameters
55 ----------
56 startPath : string
57 Initial path to use as the base for the results. This path is split
58 using os.path.split() and only its first component is kept.
59
60 files : string or list
61 One or more files.
62
63 Examples
64 --------
65
66 >>> full_path('/foo/bar.py',['a.txt','b.txt'])
67 ['/foo/a.txt', '/foo/b.txt']
68
69 >>> full_path('/foo',['a.txt','b.txt'])
70 ['/a.txt', '/b.txt']
71
72 If a single file is given, the output is still a list::
73
74 >>> full_path('/foo','a.txt')
75 ['/a.txt']
76 """
77
78 files = list_strings(files)
79 base = os.path.split(startPath)[0]
80 return [ os.path.join(base,f) for f in files ]
81
82
83def parse_test_output(txt):

Callers

nothing calls this directly

Calls 1

list_stringsFunction · 0.90

Tested by

no test coverage detected