Skip to content

Improve code quality: simplify is_leap_year and refactor ISO 8601 parsing#19

Merged
chetmancini merged 1 commit intomasterfrom
chetmancini/helsinki
Jan 25, 2026
Merged

Improve code quality: simplify is_leap_year and refactor ISO 8601 parsing#19
chetmancini merged 1 commit intomasterfrom
chetmancini/helsinki

Conversation

@chetmancini
Copy link
Copy Markdown
Owner

Summary

  • Simplify is_leap_year() to use the stdlib calendar.isleap() function
  • Refactor parse_iso8601() regex to module-level compiled pattern with verbose mode for improved readability
  • Fix overly broad Exception catches in timezone functions (now_in_timezone, convert_timezone, get_timezone_offset) to specifically catch ZoneInfoNotFoundError
  • Add ZoneInfoNotFoundError to imports

Test Plan

  • All 108 existing tests pass
  • Linting and formatting checks pass
  • No behavioral changes to public APIs

🤖 Generated with Claude Code

…egex, and fix exception handling

- Replace manual leap year calculation with calendar.isleap()
- Move ISO 8601 regex to module-level compiled pattern with verbose mode for readability
- Fix overly broad Exception catches in timezone functions to catch ZoneInfoNotFoundError
- Add ZoneInfoNotFoundError to imports

Co-Authored-By: Claude Haiku 4.5 <[email protected]>
@chetmancini chetmancini merged commit d9510e5 into master Jan 25, 2026
6 checks passed
@chetmancini chetmancini deleted the chetmancini/helsinki branch January 25, 2026 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant