Add the Python variant, agreeing with Go byte for byte
A second, independent implementation of the same contract, in the same repo: - swehockey/dom.py builds the tree on html.parser, so the variant has no runtime dependencies; the only HTML5 behaviour it depends on - stray <tr> landing in an implicit <tbody> - is handled explicitly by table_rows(). - parse.py mirrors the Go layout profiles, dual-render checks, carry-forward and invariants; a DriftError is raised in the same places with the same advice. - cli.py offers the same three commands, flags and exit codes as the Go main. - tests/ assert against the Go golden files, so the suite is also a cross-implementation check. 23 offline tests plus an opt-in live test. Verified against the live site: JSON and CSV are byte-identical to the Go output (364 games, 102536 bytes / 365 lines), and the full archive crawl gives the same 27 seasons, 2119 games and 1779 played. Also split the DriftError hint out in Go, so a golden mismatch no longer tells the reader to extend layouts[].
This commit is contained in:
1 parent
6b701819ca
commit
47e1811d9e
15 files changed
+1821
-3
No files matched your search
@@ -0,0 +1,30 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=68"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "swehockey-schedule"
|
||||
version = "1.0.0"
|
||||
description = "Deterministic crawler for the stats.swehockey.se schedule table"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.10"
|
||||
license = { text = "MIT" }
|
||||
authors = [{ name = "Mats Tornberg" }]
|
||||
keywords = ["hockey", "swehockey", "shl", "crawler", "scraper", "deterministic"]
|
||||
classifiers = [
|
||||
"Programming Language :: Python :: 3",
|
||||
"Topic :: Text Processing :: Markup :: HTML",
|
||||
]
|
||||
|
||||
# No runtime dependencies on purpose: the HTML tree is built on html.parser
|
||||
# from the standard library.
|
||||
dependencies = []
|
||||
|
||||
[project.scripts]
|
||||
swehockey-schedule = "swehockey.cli:main"
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://git.k6n.net/mats/swehockey"
|
||||
|
||||
[tool.setuptools]
|
||||
packages = ["swehockey"]
|
||||
Reference in new issue
Block a user