[argparse] Replace some Sequence instances with Iterable#15613
Open
srittau wants to merge 1 commit intopython:mainfrom
Open
[argparse] Replace some Sequence instances with Iterable#15613srittau wants to merge 1 commit intopython:mainfrom
Sequence instances with Iterable#15613srittau wants to merge 1 commit intopython:mainfrom
Conversation
Contributor
|
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]
|
brianschubert
approved these changes
Apr 5, 2026
| deprecated: bool = False, | ||
| help: str | None = ..., | ||
| aliases: Sequence[str] = ..., | ||
| aliases: Iterable[str] = ..., |
Collaborator
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.