Skip to content
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

mypy: error: expected '(' with 2023.8.2 #349

Closed
ogajduse opened this issue Aug 16, 2023 · 5 comments · Fixed by #352
Closed

mypy: error: expected '(' with 2023.8.2 #349

ogajduse opened this issue Aug 16, 2023 · 5 comments · Fixed by #352

Comments

@ogajduse
Copy link

I use homeassistant-stubs in the https://github.com/custom-components/feedparser repository.

I have bumped into an issue with the latest version of stubs.
https://github.com/custom-components/feedparser/actions/runs/5876164929/job/15933776158?pr=91#step:4:145

 /home/runner/.cache/pre-commit/repoa5dodlk1/py_env-python3.11/lib/python3.11/site-packages/homeassistant-stubs/components/sensor/__init__.pyi:26: error: expected '('  [syntax]

The issue seems to be in stubs itself.

@bramstroker
Copy link

I have exactly the same issue.

@loopj
Copy link
Contributor

loopj commented Aug 24, 2023

For some reason, a method is being generated with a hyphen in the name (__mypy-replace), see https://github.com/KapJI/homeassistant-stubs/blob/main/homeassistant-stubs/components/sensor/__init__.pyi#L26

Still seeing this issue on 2023.8.3

@bramstroker
Copy link

I did a quick test and can tell the stub is generated correctly with MyPy 1.4.1
When MyPy is upgraded to 1.5.0 or 1.5.1 the extra function is generated causing the syntax error:

def __mypy-replace(

So it's definitely some regression bug in stubgen code.

Don't have time to create a bug report now at mypy.

Might be an idea for @KapJI to fix MyPy dependency to 1.4.1 for the time being so at least the stubs can be generated correctly now.
As things are completely broken atm.

@KapJI
Copy link
Owner

KapJI commented Aug 30, 2023

Thanks for escalating it with mypy team!

@KapJI
Copy link
Owner

KapJI commented Nov 10, 2023

Version 2023.11.2 was published which uses mypy 1.7.0. It has multiple improvements for dataclass stubs. Give it a try.

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 a pull request may close this issue.

4 participants