MCPcopy
hub / github.com/numpy/numpy / get_submodule_paths

Function get_submodule_paths

tools/get_submodule_paths.py:5–27  ·  view source on GitHub ↗

Get paths to submodules so that we can exclude them from things like check_test_name.py, check_unicode.py, etc.

()

Source from the content-addressed store, hash-verified

3
4
5def get_submodule_paths():
6 '''
7 Get paths to submodules so that we can exclude them from things like
8 check_test_name.py, check_unicode.py, etc.
9 '''
10 root_directory = os.path.dirname(os.path.dirname(__file__))
11 gitmodule_file = os.path.join(root_directory, '.gitmodules')
12 with open(gitmodule_file) as gitmodules:
13 data = gitmodules.read().split('\n')
14 submodule_paths = [datum.split(' = ')[1] for datum in data if
15 datum.startswith('\tpath = ')]
16 submodule_paths = [os.path.join(root_directory, path) for path in
17 submodule_paths]
18 # vendored with a script rather than via gitmodules
19 with open(
20 os.path.join(root_directory, ".gitattributes"), "r"
21 ) as attr_file:
22 for line in attr_file:
23 if "vendored" in line:
24 pattern = line.split(" ", 1)[0]
25 submodule_paths.extend(glob.glob(pattern))
26
27 return submodule_paths
28
29
30if __name__ == "__main__":

Callers 2

process_filesFunction · 0.90

Calls 5

openFunction · 0.85
joinMethod · 0.80
splitMethod · 0.80
startswithMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…