summaryrefslogtreecommitdiff
path: root/pylint/checkers/strings.py
diff options
context:
space:
mode:
authorMarc Mueller <30130371+cdce8p@users.noreply.github.com>2021-11-25 16:35:46 +0100
committerGitHub <noreply@github.com>2021-11-25 16:35:46 +0100
commita9c1017929e586173dfb907315793727e7eb0389 (patch)
tree4f04f6a0a4caf2b03816a12d5088582ca521351a /pylint/checkers/strings.py
parent1f7f2e96c39ee89ee9fb18ab23f3dfbb9325c870 (diff)
downloadpylint-git-a9c1017929e586173dfb907315793727e7eb0389.tar.gz
Require Python 3.6.2 (#5068)
* Bump python_requires to >= 3.6.2 * Import typing names directly * Use typing.NamedTuple for MessageTest * Add default value to MessageStyle * Revert "Add an exception at install for python < 3.6.2 (#5171)" This reverts commit 37e330cadd12800b484ef89cd599dcb06f1ba539. Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Diffstat (limited to 'pylint/checkers/strings.py')
-rw-r--r--pylint/checkers/strings.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/pylint/checkers/strings.py b/pylint/checkers/strings.py
index eb43411de..fb145eaf8 100644
--- a/pylint/checkers/strings.py
+++ b/pylint/checkers/strings.py
@@ -41,7 +41,7 @@ import collections
import numbers
import re
import tokenize
-from typing import TYPE_CHECKING, Iterable
+from typing import Counter, Iterable
import astroid
from astroid import nodes
@@ -50,9 +50,6 @@ from pylint.checkers import BaseChecker, BaseTokenChecker, utils
from pylint.checkers.utils import check_messages
from pylint.interfaces import IAstroidChecker, IRawChecker, ITokenChecker
-if TYPE_CHECKING:
- from typing import Counter # typing.Counter added in Python 3.6.1
-
_AST_NODE_STR_TYPES = ("__builtin__.unicode", "__builtin__.str", "builtins.str")
# Prefixes for both strings and bytes literals per
# https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals
@@ -774,8 +771,7 @@ class StringConstantChecker(BaseTokenChecker):
Args:
tokens: The tokens to be checked against for consistent usage.
"""
- # typing.Counter added in Python 3.6.1 so this type hint must be a comment
- string_delimiters = collections.Counter() # type: Counter[str]
+ string_delimiters: Counter[str] = collections.Counter()
# First, figure out which quote character predominates in the module
for tok_type, token, _, _, _ in tokens: