Skip to content

Commit ec99fd1

Browse files
dreamiurgclaude
andauthored
fix: parse ascent rows with nested tables in route icons (#17)
* fix: parse ascent rows with nested tables in route icons Fix parser skipping ascent rows that contain nested tables in the route icons column. The parser was using recursive cell counting which included cells from nested tables, causing valid rows to be rejected for having too many cells. Changes: - Add recursive=False to find_all() when counting table cells - Ensures only direct child cells are counted, not nested ones - Add tests for Mount Si (peak 2087) which has nested tables - Exclude test cassettes from large file and YAML lint checks Fixes issue where ascents with multiple route icons were missing from output due to incorrect cell count validation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * chore: update uv.lock with version 1.6.2 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * chore: remove uv.lock from version control Add uv.lock to .gitignore to prevent tracking dependency lock file. The lock file can vary between environments and should be generated locally by each developer. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 7dde86c commit ec99fd1

File tree

5 files changed

+23021
-1
lines changed

5 files changed

+23021
-1
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ repos:
2323
- id: check-json
2424
- id: check-added-large-files
2525
args: [--maxkb=1000]
26+
exclude: ^tests/cassettes/
2627
- id: check-case-conflict
2728
- id: check-merge-conflict
2829

@@ -75,6 +76,7 @@ repos:
7576
hooks:
7677
- id: yamllint
7778
args: [-c=.yamllint.yaml]
79+
exclude: ^tests/cassettes/
7880

7981
# Global settings
8082
default_install_hook_types: [pre-commit, commit-msg]

peakbagger/scraper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,8 @@ def parse_peak_ascents(html: str) -> list[Ascent]:
367367

368368
# Process data rows (skip first 2 rows: separator and header)
369369
for row in rows[2:]:
370-
cells: list[Tag] = row.find_all(["td", "th"]) # type: ignore[assignment]
370+
# Use recursive=False to avoid counting cells in nested tables (e.g., route icons)
371+
cells: list[Tag] = row.find_all(["td", "th"], recursive=False) # type: ignore[assignment]
371372

372373
# Skip rows that don't match the expected column count
373374
if len(cells) != num_columns:

0 commit comments

Comments
 (0)