Skip to content

typing: add type hints to parser helper functions (#938) - #1743

Open
DaBestCode wants to merge 1 commit into
collective:mainfrom
DaBestCode:type-hints-parser
Open

typing: add type hints to parser helper functions (#938)#1743
DaBestCode wants to merge 1 commit into
collective:mainfrom
DaBestCode:type-hints-parser

Conversation

@DaBestCode

Copy link
Copy Markdown

Linked issue

Description

This pull request adds comprehensive type hints to parser helper functions in the icalendar library, contributing to issue #938's goal of adding type hints throughout the codebase.

Changes Made

  1. src/icalendar/parser_tools.py:

    • Enhanced to_unicode() docstring with a "Returns" section to better document the function's return behavior
  2. src/icalendar/parser/parameter.py:

    • Added return type annotation -> Callable to the single_string_parameter() decorator function
    • Added parameter type annotation upper: bool = False to clarify the upper parameter's type
    • Added return type hints to inner functions:
      • decorator(): -> property
      • fget(): -> str | None (getter returns optional string)
      • fset(): -> None (setter returns None)
      • fdel(): -> None (deleter returns None)
  3. news/938.chore.2:

    • Added changelog entry documenting the type hint improvements

Benefits

  • Improved IDE autocompletion and type checking support
  • Better documentation through explicit type hints
  • Compatibility with static type checkers (mypy, pyright, etc.)
  • No changes to runtime behavior or logic

Checklist

Additional information

  • All existing tests pass (pytest src/icalendar/tests/test_unit_parser_tools.py and parameter-related tests)
  • Type hints follow PEP 484 conventions using Python 3.10+ union syntax (|)
  • Changes are backward compatible and contain no breaking changes

@github-actions

Copy link
Copy Markdown
Contributor

This pull request did not pass quality checks and AI use is suspected. Please review Contribute and make any necessary amendments.

@github-actions github-actions Bot added the ai-suspicion This contribution is possibly created with lots of AI help without enough human understanding. label Aug 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Profile summary:

GitHub user: DaBestCode
🟢 No concerns found with user's profile.
🟢 No concerns found with recent PR activity.
🟢 No concerns found with recent issue activity.

For a more detailed report, run `gh-profiler DaBestCode`.
Full profile
GitHub user: DaBestCode
🟢 No concerns found with user's profile.
   🟢 Account age: 2 years
   🟢 Profile information:
        name: Pruthvi Nandan Janga
        blog: https://myportfolio-phi-ebon.vercel.app/
        email: pjanga@asu.edu
        bio: LeetCode Freak
        linkedin: https://www.linkedin.com/in/pruthvi-janga-9609a3238
      Empty fields: company, location

🟢 No concerns found with recent PR activity.
   1 PR opened in the last 21 days.
      0 opened against repos the user owns.
      0 opened against repos in publicly associated orgs.
      1 opened against external repos.

   🟢 0 of 1 external PRs merged in the last 21 days.
   🟢 0 of 1 external PRs closed without merging in the last 21 days.

🟢 No concerns found with recent issue activity.
   🟢 No new issues opened in the last 21 days.

@read-the-docs-community

Copy link
Copy Markdown

@stevepiercy

Copy link
Copy Markdown
Member

CI fails == no review

@DaBestCode please follow our contributing guidelines. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-suspicion This contribution is possibly created with lots of AI help without enough human understanding.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants