Skip to content

[alt] Improve re overloads to help out pyright #9593

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

AlexWaygood
Copy link
Member

A simpler approach than #9592, but let's see what mypy_primer says. Fixes #9591

@github-actions
Copy link
Contributor

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

pip (https://github.com/pypa/pip)
+ src/pip/_internal/req/req_file.py:512: error: Unpacking a string is disallowed  [misc]
+ src/pip/_internal/req/req_file.py:513: error: Cannot determine type of "var_name"  [has-type]
+ src/pip/_internal/req/req_file.py:517: error: Cannot determine type of "env_var"  [has-type]

pybind11 (https://github.com/pybind/pybind11)
+ setup.py:73: error: Need type annotation for "matches" (hint: "matches: Dict[<type>, <type>] = ...")  [var-annotated]
+ setup.py:73: error: Argument 1 to "dict" has incompatible type "List[str]"; expected "Iterable[Tuple[<nothing>, <nothing>]]"  [arg-type]

pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/pytester.py:582: error: Unpacking a string is disallowed  [misc]
+ src/_pytest/pytester.py:582: error: Cannot determine type of "noun"  [has-type]
+ src/_pytest/pytester.py:582: error: Cannot determine type of "count"  [has-type]

core (https://github.com/home-assistant/core)
+ homeassistant/components/sentry/__init__.py:168: error: Unpacking a string is disallowed  [misc]
+ homeassistant/components/sentry/__init__.py:170: error: Cannot determine type of "group1"  [has-type]
+ homeassistant/components/sentry/__init__.py:170: error: Cannot determine type of "group2"  [has-type]
+ homeassistant/components/sentry/__init__.py:170: error: Cannot determine type of "group3"  [has-type]
+ homeassistant/components/sentry/__init__.py:171: error: Cannot determine type of "group2"  [has-type]
+ homeassistant/components/sentry/__init__.py:174: error: Cannot determine type of "group3"  [has-type]
+ homeassistant/components/sentry/__init__.py:175: error: Cannot determine type of "group4"  [has-type]
+ homeassistant/components/sentry/__init__.py:176: error: Cannot determine type of "group4"  [has-type]
+ homeassistant/components/sentry/__init__.py:179: error: Cannot determine type of "group2"  [has-type]
+ homeassistant/components/sentry/__init__.py:179: error: Cannot determine type of "group3"  [has-type]
+ homeassistant/components/sentry/__init__.py:184: error: Cannot determine type of "group1"  [has-type]

sublime_debugger (https://github.com/daveleroy/sublime_debugger)
+ modules/ui/html.py:261: error: Unpacking a string is disallowed  [misc]
+ modules/ui/html.py:262: error: Cannot determine type of "string_double"  [has-type]
+ modules/ui/html.py:262: error: Cannot determine type of "string"  [has-type]
+ modules/ui/html.py:263: error: Cannot determine type of "number"  [has-type]
+ modules/ui/html.py:263: error: Cannot determine type of "number_hex"  [has-type]
+ modules/ui/html.py:268: error: Cannot determine type of "other"  [has-type]
+ modules/ui/html.py:269: error: Cannot determine type of "other"  [has-type]

steam.py (https://github.com/Gobot1234/steam.py)
+ steam/utils.py:523: error: Unpacking a string is disallowed  [misc]
+ steam/utils.py:523: error: Cannot determine type of "key"  [has-type]
+ steam/utils.py:523: error: Cannot determine type of "value"  [has-type]
+ steam/utils.py:533: error: Unpacking a string is disallowed  [misc]
+ steam/utils.py:533: error: Cannot determine type of "key"  [has-type]
+ steam/utils.py:533: error: Cannot determine type of "value"  [has-type]

@AlexWaygood
Copy link
Member Author

Doesn't look good.

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.

re.match(), re.search() and re.fullmatch() cannot be used with AnyStr
1 participant