Upload fetch_files.py
Browse files- fetch_files.py +28 -0
fetch_files.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import urllib.request, json, os, sys
|
| 2 |
+
|
| 3 |
+
def fetch_raw(owner, repo, path):
|
| 4 |
+
url = f'https://raw.githubusercontent.com/{owner}/{repo}/main/{path}'
|
| 5 |
+
try:
|
| 6 |
+
with urllib.request.urlopen(url) as resp:
|
| 7 |
+
return resp.read().decode('utf-8')
|
| 8 |
+
except Exception as e:
|
| 9 |
+
return f'ERROR: {e}'
|
| 10 |
+
|
| 11 |
+
files = [
|
| 12 |
+
('ticketguy', 'littlefig', 'benchmark/benchmark_gpu.py'),
|
| 13 |
+
('ticketguy', 'littlefig', 'cogmembench/runner.py'),
|
| 14 |
+
('ticketguy', 'littlefig', 'cogmembench/scorer.py'),
|
| 15 |
+
('ticketguy', 'littlefig', 'src/little_fig/engine/memory_fabric.py'),
|
| 16 |
+
('ticketguy', 'littlefig', 'src/little_fig/engine/model.py'),
|
| 17 |
+
('ticketguy', 'littlefig', 'pyproject.toml'),
|
| 18 |
+
('ticketguy', 'Lila', 'src/main.py'),
|
| 19 |
+
('ticketguy', 'Lila', 'README.md'),
|
| 20 |
+
('ticketguy', 'embers-diaries', 'pyproject.toml'),
|
| 21 |
+
]
|
| 22 |
+
|
| 23 |
+
for owner, repo, path in files:
|
| 24 |
+
content = fetch_raw(owner, repo, path)
|
| 25 |
+
out_path = f'/tmp/{repo}_{path.replace("/", "_")}'
|
| 26 |
+
with open(out_path, 'w') as f:
|
| 27 |
+
f.write(content)
|
| 28 |
+
print(f'Wrote {out_path} ({len(content)} chars)')
|