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

Make postponed annotations enabled by default for 3.10+ #3993

Merged
merged 2 commits into from
Dec 29, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -433,3 +433,5 @@ contributors:
* Raphael Gaschignard: contributor

* Sorin Sbarnea: contributor

* Batuhan Taskaya: contributor
4 changes: 4 additions & 0 deletions pylint/checkers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import numbers
import re
import string
import sys
from functools import lru_cache, partial
from typing import Callable, Dict, Iterable, List, Match, Optional, Set, Tuple, Union

Expand Down Expand Up @@ -1264,6 +1265,9 @@ def get_node_last_lineno(node: astroid.node_classes.NodeNG) -> int:

def is_postponed_evaluation_enabled(node: astroid.node_classes.NodeNG) -> bool:
"""Check if the postponed evaluation of annotations is enabled"""
if sys.version_info[:2] >= (3, 10):
isidentical marked this conversation as resolved.
Show resolved Hide resolved
return True

module = node.root()
return "annotations" in module.future_imports

Expand Down