Skip to content

[argparse] Replace some Sequence instances with Iterable#15613

Open
srittau wants to merge 1 commit intopython:mainfrom
srittau:argparse-iterable
Open

[argparse] Replace some Sequence instances with Iterable#15613
srittau wants to merge 1 commit intopython:mainfrom
srittau:argparse-iterable

Conversation

@srittau
Copy link
Copy Markdown
Collaborator

@srittau srittau commented Apr 5, 2026

No description provided.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 5, 2026

Diff from mypy_primer, showing the effect of this PR on open source code:

materialize (https://github.com/MaterializeInc/materialize)
- misc/python/materialize/mzcompose/composition.py:101: note:          def parse_known_args(self, args: Sequence[str] | None = ..., namespace: None = ...) -> tuple[Namespace, list[str]]
+ misc/python/materialize/mzcompose/composition.py:101: note:          def parse_known_args(self, args: Iterable[str] | None = ..., namespace: None = ...) -> tuple[Namespace, list[str]]
- misc/python/materialize/mzcompose/composition.py:101: note:          def [_N] parse_known_args(self, args: Sequence[str] | None, namespace: _N) -> tuple[_N, list[str]]
+ misc/python/materialize/mzcompose/composition.py:101: note:          def [_N] parse_known_args(self, args: Iterable[str] | None, namespace: _N) -> tuple[_N, list[str]]
- misc/python/materialize/cli/mzcompose.py:1044: note:          def parse_known_args(self, args: Sequence[str] | None = ..., namespace: None = ...) -> tuple[Namespace, list[str]]
+ misc/python/materialize/cli/mzcompose.py:1044: note:          def parse_known_args(self, args: Iterable[str] | None = ..., namespace: None = ...) -> tuple[Namespace, list[str]]
- misc/python/materialize/cli/mzcompose.py:1044: note:          def [_N] parse_known_args(self, args: Sequence[str] | None, namespace: _N) -> tuple[_N, list[str]]
+ misc/python/materialize/cli/mzcompose.py:1044: note:          def [_N] parse_known_args(self, args: Iterable[str] | None, namespace: _N) -> tuple[_N, list[str]]
- misc/python/materialize/cli/mzcompose.py:1056: note:          def parse_known_args(self, args: Sequence[str] | None = ..., namespace: None = ...) -> tuple[Namespace, list[str]]
+ misc/python/materialize/cli/mzcompose.py:1056: note:          def parse_known_args(self, args: Iterable[str] | None = ..., namespace: None = ...) -> tuple[Namespace, list[str]]
- misc/python/materialize/cli/mzcompose.py:1056: note:          def [_N] parse_known_args(self, args: Sequence[str] | None, namespace: _N) -> tuple[_N, list[str]]
+ misc/python/materialize/cli/mzcompose.py:1056: note:          def [_N] parse_known_args(self, args: Iterable[str] | None, namespace: _N) -> tuple[_N, list[str]]
- misc/python/materialize/cli/scratch/__main__.py:101: error: Argument "aliases" to "add_parser" of "_SubParsersAction" has incompatible type "str | Callable[[Any], Any] | Callable[[], None] | Callable[[ArgumentParser], None] | Callable[[Namespace], None] | list[str]"; expected "Sequence[str]"  [arg-type]
+ misc/python/materialize/cli/scratch/__main__.py:101: error: Argument "aliases" to "add_parser" of "_SubParsersAction" has incompatible type "str | Callable[[Any], Any] | Callable[[], None] | Callable[[ArgumentParser], None] | Callable[[Namespace], None] | list[str]"; expected "Iterable[str]"  [arg-type]

deprecated: bool = False,
help: str | None = ...,
aliases: Sequence[str] = ...,
aliases: Iterable[str] = ...,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one needs to be twice iterable (so e.g. an iterator won't work at runtime). It's a pity there isn't better way to express that in the current type system

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