summaryrefslogtreecommitdiff
path: root/astroid/builder.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2015-12-14 03:10:31 +0200
committerClaudiu Popa <pcmanticore@gmail.com>2015-12-14 03:10:31 +0200
commitd65e7cd75d368a075ff271c8320e94ebf2f2d9b1 (patch)
tree0c5dd609a5c90f447323e65ca571a6eb74fd68dd /astroid/builder.py
parentd4d1842ed2c3b51de80869ad0b423f11b1937987 (diff)
downloadastroid-git-d65e7cd75d368a075ff271c8320e94ebf2f2d9b1.tar.gz
Cleanup pylint's warnings over astroid codebase
Some of the messages were disabled in pylintrc, since they're not very useful for our case. Other parameters, such as the number of arguments / statements / attributes etc were configured so that they won't be too restrictive for our codebase, since making the code to respect them right now requires too much development changes, which is not justified by the end result. Closes issue #284.
Diffstat (limited to 'astroid/builder.py')
-rw-r--r--astroid/builder.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/astroid/builder.py b/astroid/builder.py
index 21b227d1..47aee988 100644
--- a/astroid/builder.py
+++ b/astroid/builder.py
@@ -22,6 +22,7 @@ at the same time.
"""
import _ast
+import re
import os
import sys
import textwrap
@@ -41,6 +42,8 @@ def _parse(string):
if sys.version_info >= (3, 0):
# pylint: disable=no-name-in-module; We don't understand flows yet.
+ # pylint: disable=wrong-import-order, wrong-import-position; have to do it here,
+ # rather than moving the entire block between standard and local imports.
from tokenize import detect_encoding
def open_source_file(filename):
@@ -51,8 +54,6 @@ if sys.version_info >= (3, 0):
return stream, encoding, data
else:
- import re
-
_ENCODING_RGX = re.compile(r"\s*#+.*coding[:=]\s*([-\w.]+)")
def _guess_encoding(string):
@@ -86,7 +87,7 @@ class AstroidBuilder(raw_building.InspectBuilder):
applied after the tree was built from source or from a live object,
by default being True.
"""
-
+ # pylint: disable=redefined-outer-name
def __init__(self, manager=None, apply_transforms=True):
super(AstroidBuilder, self).__init__()
self._manager = manager or MANAGER
@@ -129,7 +130,7 @@ class AstroidBuilder(raw_building.InspectBuilder):
# detect_encoding returns utf-8 if no encoding specified
util.reraise(exceptions.AstroidBuildingError(
'Wrong ({encoding}) or no encoding specified for {filename}.',
- encoding=encoding, filename=filename))
+ encoding=encoding, filename=path))
with stream:
# get module name if necessary
if modname is None:
@@ -241,7 +242,7 @@ class AstroidBuilder(raw_building.InspectBuilder):
continue
# get assign in __init__ first XXX useful ?
if (frame.name == '__init__' and values and
- not values[0].frame().name == '__init__'):
+ values[0].frame().name != '__init__'):
values.insert(0, node)
else:
values.append(node)