Skip to content

Commit a490bcf

Browse files
dreamiurgclaude
andauthored
fix: resolve mypy type errors and exclude test cassettes from yamllint (#9)
* fix: resolve mypy type errors and exclude test cassettes from yamllint - Add explicit type annotations for after_date variables in cli.py to fix mypy type inference errors when using datetime | None across if/elif branches - Exclude tests/cassettes/ directory from yamllint checks since these are auto-generated VCR.py test fixtures with formatting that violates yamllint rules (long lines, indentation) Fixes mypy errors: - cli.py:374 - Incompatible types in assignment (datetime | None vs datetime) - cli.py:529 - Incompatible types in assignment (datetime | None vs datetime) All pre-commit hooks now pass except no-commit-to-branch (expected on master). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor: address CodeRabbit review feedback - Use explicit glob pattern `tests/cassettes/**` in yamllint config for clarity (instead of `tests/cassettes/`) - Hoist datetime variable declarations in ascents and stats commands to improve type checker flow analysis and avoid redefinition warnings - Declare `after_date` and `before_date` as `datetime | None` upfront before if/elif blocks for cleaner scoping Addresses CodeRabbit nitpick comments on PR #9. 🤖 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 1faa61c commit a490bcf

File tree

3 files changed

+735
-724
lines changed

3 files changed

+735
-724
lines changed

.yamllint.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
---
22
extends: default
33

4+
ignore: |
5+
tests/cassettes/**
6+
47
rules:
58
line-length:
69
max: 120

peakbagger/cli.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,9 @@ def ascents(
361361

362362
# Apply date filters
363363
filtered_ascents = ascent_list
364+
# Declare date filter variables upfront for mypy type flow
365+
after_date: datetime | None = None
366+
before_date: datetime | None = None
364367
if within:
365368
try:
366369
period = analyzer.parse_within_period(within)
@@ -516,6 +519,9 @@ def stats(
516519

517520
# Apply date filters
518521
filtered_ascents = ascent_list
522+
# Declare date filter variables upfront for mypy type flow
523+
after_date: datetime | None = None
524+
before_date: datetime | None = None
519525
if within:
520526
try:
521527
period = analyzer.parse_within_period(within)

0 commit comments

Comments
 (0)