Skip to content

Conversation

@michaelm-openai
Copy link

Fixes #11001

Related to typing python/typing#256

def __getitem__(self, i: int, /) -> _T_co: ...

@overload
def iter(object: str, /) -> Iterable[str]: ...
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be in a patch file, or it will be overwritten next time we sync typeshed. Look for similar patch files in the repo (there are a few related to LiteralString).

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

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

altair (https://github.com/vega/altair)
+ tools/vega_expr.py:822: error: "str" has no attribute "get"  [attr-defined]

ibis (https://github.com/ibis-project/ibis)
+ ibis/expr/types/generic.py:1785: error: "str" has no attribute "to_expr"  [attr-defined]

apprise (https://github.com/caronc/apprise)
+ apprise/config/base.py:1509: note:     def iter(str, /) -> Iterator[str]

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.

Allow mypy to flag str matching against Sequence[str] as an error

2 participants