Skip to content

Commit 70d6bf5

Browse files
committed
Update pylint.
1 parent c9e357c commit 70d6bf5

File tree

982 files changed

+11623
-58790
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

982 files changed

+11623
-58790
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ pylama:
5454
@pip install --upgrade --force-reinstall --target=$(LIBS) pycodestyle
5555
@pip install --upgrade --force-reinstall --target=$(LIBS) pyflakes
5656
@pip install --upgrade --force-reinstall --target=$(LIBS) mccabe
57-
@find $(LIBS)/*.dist-info | xargs rm -rf
57+
@pip install --upgrade --force-reinstall --target=$(LIBS) pylint
58+
@find $(LIBS) -name *.dist-info -type d | xargs rm -rf
59+
@find $(LIBS) -name *.egg-info -type d | xargs rm -rf
60+
@find $(LIBS) -name test* -type d | xargs rm -rf
5861

5962
.PHONY: rope
6063
rope:

pymode/libs/astroid/__init__.py

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,10 @@
1-
# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
2-
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
3-
#
4-
# This file is part of astroid.
5-
#
6-
# astroid is free software: you can redistribute it and/or modify it
7-
# under the terms of the GNU Lesser General Public License as published by the
8-
# Free Software Foundation, either version 2.1 of the License, or (at your
9-
# option) any later version.
10-
#
11-
# astroid is distributed in the hope that it will be useful, but
12-
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13-
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
14-
# for more details.
15-
#
16-
# You should have received a copy of the GNU Lesser General Public License along
17-
# with astroid. If not, see <http://www.gnu.org/licenses/>.
1+
# Copyright (c) 2006-2013, 2015 LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr>
2+
# Copyright (c) 2014 Google, Inc.
3+
# Copyright (c) 2015-2016 Claudiu Popa <pcmanticore@gmail.com>
4+
5+
# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
6+
# For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER
7+
188
"""Python Abstract Syntax Tree New Generation
199
2010
The aim of this module is to provide a common base representation of
@@ -39,14 +29,27 @@
3929
4030
* builder contains the class responsible to build astroid trees
4131
"""
42-
__doctype__ = "restructuredtext en"
4332

33+
import os
4434
import sys
4535
import re
4636
from operator import attrgetter
4737

38+
import enum
39+
40+
41+
_Context = enum.Enum('Context', 'Load Store Del')
42+
Load = _Context.Load
43+
Store = _Context.Store
44+
Del = _Context.Del
45+
del _Context
46+
47+
48+
from .__pkginfo__ import version as __version__
4849
# WARNING: internal imports order matters !
4950

51+
# pylint: disable=redefined-builtin, wildcard-import
52+
5053
# make all exception classes accessible from astroid package
5154
from astroid.exceptions import *
5255

@@ -58,22 +61,21 @@
5861

5962
# more stuff available
6063
from astroid import raw_building
61-
from astroid.bases import Instance, BoundMethod, UnboundMethod
64+
from astroid.bases import BaseInstance, Instance, BoundMethod, UnboundMethod
6265
from astroid.node_classes import are_exclusive, unpack_infer
6366
from astroid.scoped_nodes import builtin_lookup
64-
from astroid.builder import parse
65-
from astroid.util import YES
67+
from astroid.builder import parse, extract_node
68+
from astroid.util import Uninferable, YES
6669

67-
# make a manager instance (borg) as well as Project and Package classes
68-
# accessible from astroid package
70+
# make a manager instance (borg) accessible from astroid package
6971
from astroid.manager import AstroidManager
7072
MANAGER = AstroidManager()
7173
del AstroidManager
7274

7375
# transform utilities (filters and decorator)
7476

7577
class AsStringRegexpPredicate(object):
76-
"""Class to be used as predicate that may be given to `register_transform`
78+
"""ClassDef to be used as predicate that may be given to `register_transform`
7779
7880
First argument is a regular expression that will be searched against the `as_string`
7981
representation of the node onto which it's applied.
@@ -92,6 +94,7 @@ def __init__(self, regexp, expression=None):
9294
def __call__(self, node):
9395
if self.expression is not None:
9496
node = attrgetter(self.expression)(node)
97+
# pylint: disable=no-member; github.com/pycqa/astroid/126
9598
return self.regexp.search(node.as_string())
9699

97100
def inference_tip(infer_function):
@@ -114,8 +117,8 @@ def transform(node, infer_function=infer_function):
114117
def register_module_extender(manager, module_name, get_extension_mod):
115118
def transform(node):
116119
extension_module = get_extension_mod()
117-
for name, objs in extension_module._locals.items():
118-
node._locals[name] = objs
120+
for name, objs in extension_module.locals.items():
121+
node.locals[name] = objs
119122
for obj in objs:
120123
if obj.parent is extension_module:
121124
obj.parent = node
@@ -124,13 +127,11 @@ def transform(node):
124127

125128

126129
# load brain plugins
127-
from os import listdir
128-
from os.path import join, dirname
129-
BRAIN_MODULES_DIR = join(dirname(__file__), 'brain')
130+
BRAIN_MODULES_DIR = os.path.join(os.path.dirname(__file__), 'brain')
130131
if BRAIN_MODULES_DIR not in sys.path:
131132
# add it to the end of the list so user path take precedence
132133
sys.path.append(BRAIN_MODULES_DIR)
133134
# load modules in this directory
134-
for module in listdir(BRAIN_MODULES_DIR):
135+
for module in os.listdir(BRAIN_MODULES_DIR):
135136
if module.endswith('.py'):
136137
__import__(module[:-3])

pymode/libs/astroid/__pkginfo__.py

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,49 @@
1-
# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
2-
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
3-
#
4-
# This file is part of astroid.
5-
#
6-
# astroid is free software: you can redistribute it and/or modify it
7-
# under the terms of the GNU Lesser General Public License as published by the
8-
# Free Software Foundation, either version 2.1 of the License, or (at your
9-
# option) any later version.
10-
#
11-
# astroid is distributed in the hope that it will be useful, but
12-
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13-
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
14-
# for more details.
15-
#
16-
# You should have received a copy of the GNU Lesser General Public License along
17-
# with astroid. If not, see <http://www.gnu.org/licenses/>.
1+
# Copyright (c) 2006-2014 LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr>
2+
# Copyright (c) 2014-2016 Claudiu Popa <pcmanticore@gmail.com>
3+
# Copyright (c) 2014 Google, Inc.
4+
5+
# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
6+
# For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER
7+
188
"""astroid packaging information"""
9+
10+
from sys import version_info as py_version
11+
12+
from pkg_resources import parse_version
13+
from setuptools import __version__ as setuptools_version
14+
1915
distname = 'astroid'
2016

2117
modname = 'astroid'
2218

23-
numversion = (1, 4, 9)
24-
version = '.'.join([str(num) for num in numversion])
19+
version = '1.5.3'
20+
numversion = tuple(map(int, version.split('.')))
21+
22+
extras_require = {}
23+
install_requires = ['lazy_object_proxy', 'six', 'wrapt']
24+
25+
26+
def has_environment_marker_range_operators_support():
27+
"""Code extracted from 'pytest/setup.py'
28+
https://github.com/pytest-dev/pytest/blob/7538680c/setup.py#L31
29+
30+
The first known release to support environment marker with range operators
31+
it is 17.1, see: https://setuptools.readthedocs.io/en/latest/history.html#id113
32+
"""
33+
return parse_version(setuptools_version) >= parse_version('17.1')
34+
35+
36+
if has_environment_marker_range_operators_support():
37+
extras_require[':python_version<"3.4"'] = ['enum34>=1.1.3', 'singledispatch']
38+
extras_require[':python_version<"3.3"'] = ['backports.functools_lru_cache']
39+
else:
40+
if py_version < (3, 4):
41+
install_requires.extend(['enum34', 'singledispatch'])
42+
if py_version < (3, 3):
43+
install_requires.append('backports.functools_lru_cache')
2544

26-
install_requires = ['six', 'lazy_object_proxy', 'wrapt']
2745

46+
# pylint: disable=redefined-builtin; why license is a builtin anyway?
2847
license = 'LGPL'
2948

3049
author = 'Python Code Quality Authority'

0 commit comments

Comments
 (0)