MCPcopy Create free account
hub / github.com/4paradigm/OpenMLDB / PathSplitToList

Function PathSplitToList

steps/cpplint.py:2276–2299  ·  view source on GitHub ↗

Returns the path split into a list by the separator. Args: path: An absolute or relative path (e.g. '/a/b/c/' or '../a') Returns: A list of path components (e.g. ['a', 'b', 'c]).

(path)

Source from the content-addressed store, hash-verified

2274 return 0
2275
2276def PathSplitToList(path):
2277 """Returns the path split into a list by the separator.
2278
2279 Args:
2280 path: An absolute or relative path (e.g. '/a/b/c/' or '../a')
2281
2282 Returns:
2283 A list of path components (e.g. ['a', 'b', 'c]).
2284 """
2285 lst = []
2286 while True:
2287 (head, tail) = os.path.split(path)
2288 if head == path: # absolute paths end
2289 lst.append(head)
2290 break
2291 if tail == path: # relative paths end
2292 lst.append(tail)
2293 break
2294
2295 path = head
2296 lst.append(tail)
2297
2298 lst.reverse()
2299 return lst
2300
2301def GetHeaderGuardCPPVariable(filename):
2302 """Returns the CPP variable that should be used as a header guard.

Callers 1

FixupPathFromRootFunction · 0.85

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected