Skip to content

Fix progress_bar return type annotation: CollectionIterator[T]#2

Merged
bjorngun merged 2 commits into
package-review-fixesfrom
copilot/sub-pr-1
Mar 3, 2026
Merged

Fix progress_bar return type annotation: CollectionIterator[T]#2
bjorngun merged 2 commits into
package-review-fixesfrom
copilot/sub-pr-1

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 3, 2026

progress_bar is a generator but was annotated -> Collection, which is both semantically wrong and misleading to type checkers and callers.

Changes

  • src/dev_tools/progress_bar.py
    • Introduce TypeVar T
    • Parameterise input as Collection[T] — preserves the len() (Sized) constraint
    • Change return type to Iterator[T] — accurately reflects the generator behaviour
# Before
def progress_bar(iterable: Collection, ...) -> Collection: ...

# After
T = TypeVar("T")
def progress_bar(iterable: Collection[T], ...) -> Iterator[T]: ...

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: bjorngun <47886783+bjorngun@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP address feedback from package review discussions Fix progress_bar return type annotation: CollectionIterator[T] Mar 3, 2026
@bjorngun bjorngun marked this pull request as ready for review March 3, 2026 19:40
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@bjorngun bjorngun merged commit a073c32 into package-review-fixes Mar 3, 2026
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.

2 participants