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

Can't understand list[T] annotation #83

Closed
Masynchin opened this issue Apr 24, 2022 · 2 comments
Closed

Can't understand list[T] annotation #83

Masynchin opened this issue Apr 24, 2022 · 2 comments

Comments

@Masynchin
Copy link

Describe the bug
Vermin can't understand list[T] annotation. It shows that minimal version is 3.0

To Reproduce
I run

vernim main.py

on main.py

def main(arguments: list[str]):
    ...

Expected behavior
Show that minimal version is 3.9

Environment (please complete the following information):

  • Vermin version of 1.3.3
  • Python version of 3.10.2
@netromdk
Copy link
Owner

netromdk commented May 1, 2022

Hello @Masynchin.

If you enable evaluation of annotations via --eval-annotations then it yields the desired result:

annotations requires !2, 3.0
builtin generic type annotation (list[..]) requires !2, 3.9

The reason for this to be enabled explicitly is covered in the caveats section of the README:

Function and variable annotations aren't evaluated at definition time when from __future__ import annotations is used (PEP 563). This is why --no-eval-annotations is on by default (since v1.1.1, #66). If annotations are being evaluated at runtime, like using typing.get_type_hints or evaluating __annotations__ of an object, --eval-annotations should be used for best results.

@Masynchin
Copy link
Author

@netromdk Thanks a lot!

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

No branches or pull requests

2 participants