Skip to content

Commit

Permalink
Upgrade pylint to 2.12.2 (pylint-dev#1297)
Browse files Browse the repository at this point in the history
* Upgrade pylint to 2.12.2

* Default Python in the CI is now python 3.8

* Remove useless suppression for python 3.8

* Disable no-member for false positive with zipimport
  • Loading branch information
Pierre-Sassoulas authored and tushar-deepsource committed Dec 20, 2021
1 parent 0356594 commit 286e94f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

env:
CACHE_VERSION: 3
DEFAULT_PYTHON: 3.6
DEFAULT_PYTHON: 3.8
PRE_COMMIT_CACHE: ~/.cache/pre-commit

jobs:
Expand Down
1 change: 1 addition & 0 deletions astroid/interpreter/_import/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ def _precache_zipimporters(path=None):
req_paths = tuple(path or sys.path)
cached_paths = tuple(pic)
new_paths = _cached_set_diff(req_paths, cached_paths)
# pylint: disable=no-member
for entry_path in new_paths:
try:
pic[entry_path] = zipimport.zipimporter(entry_path)
Expand Down
2 changes: 1 addition & 1 deletion astroid/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ def zip_import_data(self, filepath):
except ValueError:
continue
try:
# pylint: disable-next=no-member
importer = zipimport.zipimporter(eggpath + ext)
# pylint: enable=no-member
zmodname = resource.replace(os.path.sep, ".")
if importer.is_package(resource):
zmodname = zmodname + ".__init__"
Expand Down
10 changes: 9 additions & 1 deletion astroid/nodes/node_ng.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
from astroid.nodes.as_string import AsStringVisitor
from astroid.nodes.const import OP_PRECEDENCE

if TYPE_CHECKING:
from astroid import nodes

if sys.version_info >= (3, 6, 2):
from typing import NoReturn
else:
from typing_extensions import NoReturn

if sys.version_info >= (3, 8):
from typing import Literal
else:
Expand Down Expand Up @@ -448,7 +456,7 @@ def _fixed_source_line(self) -> Optional[int]:
We need this method since not all nodes have :attr:`lineno` set.
"""
line = self.lineno
_node: Optional[NodeNG] = self # pylint: disable = used-before-assignment
_node: Optional[NodeNG] = self
try:
while line is None:
_node = next(_node.get_children())
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_pre_commit.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
black==21.7b0
pylint==2.12.1
pylint==2.12.2
isort==5.9.2
flake8==4.0.1
flake8-typing-imports==1.11.0
Expand Down

0 comments on commit 286e94f

Please sign in to comment.