Skip to content

mypy pyhton lambda based error in mypy v0.910 #11751

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
tahirahmad2030 opened this issue Dec 15, 2021 · 1 comment
Closed

mypy pyhton lambda based error in mypy v0.910 #11751

tahirahmad2030 opened this issue Dec 15, 2021 · 1 comment
Labels

Comments

@tahirahmad2030
Copy link

Crash Report

A code snippet like

result = min(SUPPORT_YEARS, key=lambda x: abs(x - scope))

when we run mypy hook on it using mypy version: rev: v0.910, It throws errors as:
error: Returning Any from function declared to return "SupportsLessThan"

If we change the version of mypy to rev: v0.782 an old version of the same. It works fine.

These type of mypy errors have been noticed in latest versions of mypy like refer #9656

Has anyone got this type of mypy errors and knows a fix. Please post.

Traceback

mypy.....................................................................Failed
- hook id: mypy
- exit code: 1

scepter/utils.py:44: error: Returning Any from function declared to return "SupportsLessThan"
scepter/dataindexer.py:314: error: Returning Any from function declared to return "SupportsLessThan"
Found 2 errors in 2 files (checked 2 source files)

To Reproduce

(Write what you did to reproduce the crash. Full source code is
appreciated. We also very much appreciate it if you try to narrow the
source down to a small stand-alone example.)

Your Environment

  • Mypy version used: rev: v0.910
  • Mypy command-line flags:
  • Mypy configuration options from mypy.ini (and other config files):
  • Python version used: 3.6
  • Operating system and version: mac
@hauntsaninja
Copy link
Collaborator

hauntsaninja commented Dec 17, 2021

Closing as a duplicate of #9656

Also note this isn't a crash, just a false positive. Feel free to use # type: ignore or --no-warn-return-any

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants