Download pool/shard011/Python/0096550_countpairs.py from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 733 Bytes
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard011/Python/0096550_countpairs.py
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard011/Python/0096550_countpairs.py
-
curl -L -o 0096550_countpairs.py https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard011/Python/0096550_countpairs.py
733 Bytes
| from toolz import groupby, first | |
| from sys import argv | |
| from contextlib import contextmanager | |
| from time import time | |
| from sys import stdout | |
| def duration(outfile=stdout): | |
| start = time() | |
| yield | |
| end = time() | |
| outfile.write(str(end - start) + '\n') | |
| def processdata(filename="word-pairs.txt"): | |
| file = open(filename, 'r') | |
| lines = map(str.strip, file) | |
| word_pairs = map(lambda s: s.split(','), lines) | |
| result = groupby(first, word_pairs) | |
| for i in range(0, int(argv[1])): | |
| with duration(): | |
| processdata("dummy.txt") | |
| y = 0 | |
| for n in range(1, 10^8): | |
| ret = n | |
| ret = n + 2 | |
| ret = n + 1 | |
| y += ret | |
| with duration(): | |
| processdata("wordpairs.txt") | |