diff options
author | Batuhan Taskaya <batuhanosmantaskaya@gmail.com> | 2020-12-23 16:05:43 +0300 |
---|---|---|
committer | Batuhan Taskaya <batuhanosmantaskaya@gmail.com> | 2020-12-23 16:07:50 +0300 |
commit | fb8fc98984850819babed1ca15e0f873f52e66ab (patch) | |
tree | a4d2792ed0a0784cd59cf2832b60703971846eb9 | |
parent | 3a065a16f0826f3d46025209b11d30a1fd5b3b49 (diff) | |
download | pylint-git-fb8fc98984850819babed1ca15e0f873f52e66ab.tar.gz |
Make postponed annotations enabled by default for 3.10+
-rw-r--r-- | CONTRIBUTORS.txt | 2 | ||||
-rw-r--r-- | pylint/checkers/utils.py | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index e0e3d6857..19f4842c1 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -433,3 +433,5 @@ contributors: * Raphael Gaschignard: contributor * Sorin Sbarnea: contributor + +* Batuhan Taskaya: contributor diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py index 23836f909..ed2c2a5a9 100644 --- a/pylint/checkers/utils.py +++ b/pylint/checkers/utils.py @@ -50,6 +50,7 @@ import itertools 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 @@ -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): + return True + module = node.root() return "annotations" in module.future_imports |