{"id":50533175,"url":"https://github.com/daedalus/oeis_validator","last_synced_at":"2026-06-03T15:30:27.258Z","repository":{"id":357634051,"uuid":"1235634281","full_name":"daedalus/oeis_validator","owner":"daedalus","description":"Validate OEIS entries against the internal format specification and style sheet","archived":false,"fork":false,"pushed_at":"2026-05-13T15:23:59.000Z","size":244,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-05-13T17:27:57.202Z","etag":null,"topics":["cli","integer-sequences","linting","number-theory","oeis","online-encyclopedia-of-integer-sequences","parser","python","style-linter","validator","zero-dependencies"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daedalus.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-05-11T14:05:55.000Z","updated_at":"2026-05-13T15:34:05.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/daedalus/oeis_validator","commit_stats":null,"previous_names":["daedalus/oeis_validator"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/daedalus/oeis_validator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daedalus%2Foeis_validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daedalus%2Foeis_validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daedalus%2Foeis_validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daedalus%2Foeis_validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daedalus","download_url":"https://codeload.github.com/daedalus/oeis_validator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daedalus%2Foeis_validator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33872297,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-03T02:00:06.370Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","integer-sequences","linting","number-theory","oeis","online-encyclopedia-of-integer-sequences","parser","python","style-linter","validator","zero-dependencies"],"created_at":"2026-06-03T15:30:25.203Z","updated_at":"2026-06-03T15:30:27.239Z","avatar_url":"https://github.com/daedalus.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# oeis-validator\n\nValidate OEIS entries against the internal format specification and style\nsheet. Parses `.txt` files in OEIS internal format and checks all 19 field tags\nfor compliance, consistency, and style adherence.\n\n[![PyPI](https://img.shields.io/pypi/v/oeis_validator.svg)](https://pypi.org/project/oeis_validator/)\n[![Python](https://img.shields.io/pypi/pyversions/oeis_validator.svg)](https://pypi.org/project/oeis_validator/)\n[![Coverage](https://img.shields.io/badge/coverage-88%25-brightgreen.svg)](https://github.com/daedalus/oeis_validator)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/master/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![Tests](https://img.shields.io/badge/tests-221%20passing-brightgreen.svg)](https://github.com/daedalus/oeis_validator)\n[![DeepWiki](https://img.shields.io/badge/docs-DeepWiki-blue.svg)](https://deepwiki.com/daedalus/oeis_validator)\n\n## Architecture\n\nThe validator operates as a linear pipeline:\n\n```\nRaw text → Parser → OEISEntry → Rules Engine → list[Issue] → Reporter → Report\n```\n\n- **Parser** (`parser.py`) — identifies OEIS field tags via regex, aggregates multi-line fields, normalizes sequence data into integers\n- **Data Models** (`models.py`) — `OEISEntry` holds parsed state (A-number, terms, offsets, keywords); `Issue` represents a single finding with level and code\n- **Rules Engine** (`rules.py`) — 90+ checks for structural requirements, keyword logic, style patterns, notation conventions\n- **Reporter \u0026 CLI** (`reporter.py`, `__main__.py`) — renders issues, handles argument parsing, determines exit code\n\n## Features\n\n- **All 19 field tags** — `%I`, `%S`, `%N`, `%C`, `%D`, `%F`, `%H`, `%I`, `%K`,\n  `%L`, `%M`, `%N`, `%O`, `%P`, `%R`, `%S`, `%T`, `%U`, `%Y`\n- **30 keyword checks** — validates `%K` against the official keyword list\n- **14 style patterns** — catches common OEIS style-sheet violations:\n  `counts the number of`, `greater or equal`, `less or equal`, `couples of`,\n  `respectfully`, `triplets of`, `amount of`, `fulfills`, `allows to`,\n  `except` (missing for), `unique` vs `distinct`, `its` vs `it's`,\n  `p(n)` ambiguity, `be integer` (missing article)\n- **Non-ASCII detection** — rejects stray Unicode in data/keyword fields\n- **Reference cross-checks** — URLs in `%D`, duplicate A-numbers in `%Y`,\n  b-file ordering in `%H`, `a_n`/`a[n]` notation in `%F`\n- **Program validation** — missing language labels in `%o`, unsigned programs\n- **CLI modes** — file input, stdin, `--demo`, `--coverage`\n- **Adversarial resilience** — null bytes, BOM, mixed line endings, RTL\n  overrides, shell injection attempts, binary input, 50-entry bulk parsing\n- **Zero dependencies** — pure Python stdlib\n\n## Install\n\n```bash\npip install oeis-validator\n```\n\n## Usage\n\n```bash\n# Validate a file\noeis-validator entry.txt\n\n# Validate from stdin\necho '%I A000001 %S A000001 1,1,2,3,5' | oeis-validator\n\n# Run built-in demos (good entry, bad entry, multi-entry)\noeis-validator --demo\n\n# Show rule coverage table\noeis-validator --coverage\n```\n\n## API\n\n```python\nfrom oeis_validator import parse_entry, validate, report\n\nentry = parse_entry(text)\nissues = validate(entry)\nexit_code = report(entry, issues)\n```\n\n## Real-world validation\n\nThe `data/` directory contains 10 real OEIS sequences fetched from the OEIS\nserver. The validator produces **0 ERROR-level issues** on all of them. Each\nwarning is cross-checked against the official style sheet (`.oeis_style_sheet.txt`):\n\n| Sequence | Warnings | Fields warned |\n|---|---|---|\n| A000005 (divisors) | 0 | — |\n| A000010 (totient) | 1 | `%H` |\n| A000040 (primes) | 5 | `%o`, `%D`, `%H`, `%Y` |\n| A000041 (partitions) | 1 | `%H` |\n| A000045 (Fibonacci) | 2 | `%H`, `%Y` |\n| A000108 (Catalan) | 1 | `%H` |\n| A000203 (sigma) | 5 | `%o`, `%H`, `%Y` |\n| A000217 (triangular) | 3 | `%o`, `%Y` |\n| A000290 (squares) | 1 | `%Y` |\n| A001222 (Omega) | 0 | — |\n\n## Development\n\n```bash\ngit clone https://github.com/daedalus/oeis_validator.git\ncd oeis_validator\npip install -e \".[test]\"\n\n# run tests (221+ passing)\npytest -v\n\n# format\nruff format src/ tests/\n\n# lint + type check\nprospector --with-tool ruff --with-tool mypy src/\nsemgrep --config=auto --severity=ERROR src/\n\n# find unused code\nvulture --min-confidence 90 src/\n```\n\n## Threat model (adversarial tests)\n\nThe test suite (`tests/test_adversarial.py`) validates the parser, rules, and\nCLI against 85 adversarial scenarios across six categories:\n\n| Category | Tests | Examples |\n|---|---|---|\n| **Parser** | 28 | Null bytes, BOM, mixed `\\r\\n`/`\\n`, RTL overrides, HTML/shell injection, 100-term sequences, negative zero, 50 repeated `%S` lines, zero-width chars, Unicode normalization, deeply nested parens (5000), 10K-char fields, ASCII art in comments, case-varying tags, invalid tag chars, EOF mid-tag, backslash continuation, whitespace-only fields |\n| **Rules** | 23 | Mixed valid/invalid keywords, contradictory keyword pairs, offset \u003e sequence length, 100/500 cross-references with/without duplicates, fake language labels, URL-free refs, all 19 tags stress test, signed programs (no false positive), cons/frac/tabl advisories, bref edge case, self-cross-ref |\n| **CLI** | 15 | Binary input, empty/large stdin, directory as file, BOM file, Latin-1 file, empty file, symlinks, unicode filenames, `--` separator, unknown flags |\n| **Style** | 9 | Case-variant pattern matching (`AllOwS tO`), false-positive avoidance for `except for`, `its`, `p(n)` in formulas, multiple patterns in one field, patterns in comments |\n| **Multi-entry** | 3 | 50-entry bulk parse, mixed keyword sets, blank-line separators |\n| **Integration** | 4 | Parse→validate→report pipeline, mixed valid/invalid entries, all 10 data files, 1000-term sequence no-crash |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaedalus%2Foeis_validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaedalus%2Foeis_validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaedalus%2Foeis_validator/lists"}