File size: 1,746 Bytes
9728219
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"""sedev_filter.py IN.jsonl.gz OUT.jsonl.gz (11-02, tablinum-3 agent domain) - keep Stack Overflow threads whose QUESTION TITLE is about
agent tooling: shell / terminal / Linux & macOS & Windows command line, git, containers, CI, packaging & build, web automation &
scraping, regex & text tools, ssh / networking / services, editors, env & encoding. Chosen by domain (title keywords), never by
benchmark items. common-pile/stackexchange rows (CC BY-SA 4.0) pass through unchanged for hf_dolma.py se."""
import gzip, json, re, sys
K = re.compile(r"\b(bash|shell|zsh|fish shell|sh script|terminal|command[- ]line|linux|ubuntu|debian|centos|fedora|arch linux|wsl|macos|"
               r"homebrew|git|github|gitlab|docker\w*|podman|compose|kubernetes|kubectl|helm|github actions|gitlab ci|jenkins|ci pipeline|"
               r"yaml|jq|curl|wget|regex|regular expression|ssh|scp|rsync|cron\w*|systemd|systemctl|nginx|chmod|chown|sudo|pip|npm|npx|"
               r"yarn|pnpm|conda|venv|virtualenv|pyenv|poetry|makefile|cmake|selenium|playwright|puppeteer|xpath|css selector|"
               r"web ?scrap\w*|beautifulsoup|webdriver|headless|powershell|cmd\.exe|batch file|environment variables?|\$path|utf-?8|"
               r"awk|sed|grep|xargs|find command|stdin|stdout|subprocess|tmux|vim|emacs|vs ?code|devcontainer|dotenv|ffmpeg|"
               r"imagemagick|pandoc|openssl|certbot|ufw|iptables|dns|port forwarding|symlink|tar|zip|unzip|apt(-get)?|yum|dnf|pacman|snap|flatpak)\b", re.I)
n = k = 0; out = gzip.open(sys.argv[2], "wt")
for l in gzip.open(sys.argv[1], "rt"):
    n += 1
    if K.search(json.loads(l)["text"].split("\n", 1)[0]): out.write(l); k += 1
out.close(); print(f"sedev_filter {sys.argv[1]}: kept {k}/{n}", file=sys.stderr)