MCPcopy
hub / github.com/GPflow/GPflow / _crawl_sources

Function _crawl_sources

benchmark/plot.py:43–72  ·  view source on GitHub ↗
(sources: Sequence[Path])

Source from the content-addressed store, hash-verified

41
42
43def _crawl_sources(sources: Sequence[Path]) -> Tuple[pd.DataFrame, Collection[BenchmarkMetadata]]:
44 results_df_list = []
45 results_metadata = []
46 visited = set()
47 queue = list(sources)
48 while queue:
49 source = queue.pop()
50
51 source = source.resolve()
52 assert source.is_dir()
53 # Sym-links can cause cycles - don't visit the same directory multiple times...
54 if source in visited:
55 continue
56 visited.add(source)
57
58 metrics_df_path = source / "metrics.csv"
59 metadata_path = source / "metadata.json"
60 if metrics_df_path.exists() or metadata_path.exists():
61 assert metrics_df_path.exists()
62 assert metadata_path.exists()
63 results_df_list.append(pd.read_csv(metrics_df_path))
64 with open(metadata_path, "rt") as f:
65 results_metadata.append(BenchmarkMetadata.from_json(json.load(f)))
66
67 for child in source.iterdir():
68 if child.is_dir():
69 queue.append(child)
70
71 results_df = pd.concat(results_df_list, axis="index", ignore_index=True)
72 return results_df, results_metadata
73
74
75def plot(

Callers 2

test_crawl_sourcesFunction · 0.90
plot_from_argvFunction · 0.85

Calls 2

from_jsonMethod · 0.80
addMethod · 0.45

Tested by 1

test_crawl_sourcesFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…