Download fixtures/seed_project/cache.py from tailot/lingologos-thinkingpython: direct link, hf CLI and curl.
- Browser
- Download file 318 Bytes
-
https://huggingface.co/datasets/tailot/lingologos-thinkingpython/resolve/main/fixtures/seed_project/cache.py
- Command line
-
hf download hf://datasets/tailot/lingologos-thinkingpython/fixtures/seed_project/cache.py
-
curl -L -o cache.py https://huggingface.co/datasets/tailot/lingologos-thinkingpython/resolve/main/fixtures/seed_project/cache.py
318 Bytes
| import hashlib | |
| import time | |
| def memo(items=[]): | |
| keys = [] | |
| for item in items: | |
| keys.append(item[0]) | |
| return keys | |
| def expiry(hours: int): | |
| return hours * 86400 | |
| def touch(entry): | |
| if entry.get('warm'): | |
| return entry['key'] | |
| return '' | |
| def mark(entry): | |
| return 'key ' + entry['key'] | |