MCPcopy Index your code
hub / github.com/tensorflow/tfjs / PathSplitToList

Function PathSplitToList

tfjs-backend-wasm/tools/cpplint.py:1784–1807  ·  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

1782 return 0
1783
1784def PathSplitToList(path):
1785 """Returns the path split into a list by the separator.
1786
1787 Args:
1788 path: An absolute or relative path (e.g. '/a/b/c/' or '../a')
1789
1790 Returns:
1791 A list of path components (e.g. ['a', 'b', 'c]).
1792 """
1793 lst = []
1794 while True:
1795 (head, tail) = os.path.split(path)
1796 if head == path: # absolute paths end
1797 lst.append(head)
1798 break
1799 if tail == path: # relative paths end
1800 lst.append(tail)
1801 break
1802
1803 path = head
1804 lst.append(tail)
1805
1806 lst.reverse()
1807 return lst
1808
1809def GetHeaderGuardCPPVariable(filename):
1810 """Returns the CPP variable that should be used as a header guard.

Callers 1

FixupPathFromRootFunction · 0.85

Calls 3

appendMethod · 0.80
reverseMethod · 0.80
splitMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…