Skip to content

Commit

Permalink
Make postponed annotations enabled by default for 3.10+
Browse files Browse the repository at this point in the history
  • Loading branch information
isidentical committed Dec 23, 2020
1 parent 3a065a1 commit fb8fc98
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
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):
return True

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

Expand Down

0 comments on commit fb8fc98

Please sign in to comment.