MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / main

Function main

docs/mathnet/scripts/extract-fragments.py:33–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31
32
33def main() -> None:
34 ap = argparse.ArgumentParser()
35 ap.add_argument('sample')
36 ap.add_argument('--out', default='fragments.json')
37 args = ap.parse_args()
38
39 seen: dict[str, None] = {}
40 total = 0
41 for line in open(args.sample):
42 row = json.loads(line)
43 lang = row.get('language')
44 if lang is not None and 'English' not in lang:
45 continue
46 for frag in extract(row.get('problem_markdown', '')):
47 total += 1
48 seen.setdefault(frag)
49
50 with open(args.out, 'w') as f:
51 json.dump(sorted(seen), f, ensure_ascii=False, indent=0)
52 print(f'{total} fragments, {len(seen)} unique -> {args.out}')
53
54
55if __name__ == '__main__':

Callers 1

Calls 3

extractFunction · 0.70
getMethod · 0.65
printFunction · 0.50

Tested by

no test coverage detected