Commit 2c7cd1b4 authored by Stefan Behnel's avatar Stefan Behnel

fix some pylint findings

parent 4479bf15
...@@ -77,9 +77,8 @@ class TreeVisitor(object): ...@@ -77,9 +77,8 @@ class TreeVisitor(object):
self.access_path = [] self.access_path = []
def dump_node(self, node, indent=0): def dump_node(self, node, indent=0):
ignored = list(node.child_attrs or []) + [u'child_attrs', u'pos', ignored = list(node.child_attrs or []) + [
u'gil_message', u'cpp_message', u'child_attrs', u'pos', u'gil_message', u'cpp_message', u'subexprs']
u'subexprs']
values = [] values = []
pos = getattr(node, 'pos', None) pos = getattr(node, 'pos', None)
if pos: if pos:
...@@ -93,7 +92,7 @@ class TreeVisitor(object): ...@@ -93,7 +92,7 @@ class TreeVisitor(object):
for attr in attribute_names: for attr in attribute_names:
if attr in ignored: if attr in ignored:
continue continue
if attr.startswith(u'_') or attr.endswith(u'_'): if attr.startswith('_') or attr.endswith('_'):
continue continue
try: try:
value = getattr(node, attr) value = getattr(node, attr)
...@@ -108,8 +107,7 @@ class TreeVisitor(object): ...@@ -108,8 +107,7 @@ class TreeVisitor(object):
else: else:
value = repr(value) value = repr(value)
values.append(u'%s = %s' % (attr, value)) values.append(u'%s = %s' % (attr, value))
return u'%s(%s)' % (node.__class__.__name__, return u'%s(%s)' % (node.__class__.__name__, u',\n '.join(values))
u',\n '.join(values))
def _find_node_path(self, stacktrace): def _find_node_path(self, stacktrace):
import os.path import os.path
...@@ -129,7 +127,6 @@ class TreeVisitor(object): ...@@ -129,7 +127,6 @@ class TreeVisitor(object):
return (last_traceback, nodes) return (last_traceback, nodes)
def _raise_compiler_error(self, child, e): def _raise_compiler_error(self, child, e):
import sys
trace = [''] trace = ['']
for parent, attribute, index in self.access_path: for parent, attribute, index in self.access_path:
node = getattr(parent, attribute) node = getattr(parent, attribute)
...@@ -389,7 +386,7 @@ class EnvTransform(CythonTransform): ...@@ -389,7 +386,7 @@ class EnvTransform(CythonTransform):
def visit_CArgDeclNode(self, node): def visit_CArgDeclNode(self, node):
# default arguments are evaluated in the outer scope # default arguments are evaluated in the outer scope
if node.default: if node.default:
attrs = [ attr for attr in node.child_attrs if attr != 'default' ] attrs = [attr for attr in node.child_attrs if attr != 'default']
self.visitchildren(node, attrs) self.visitchildren(node, attrs)
self.enter_scope(node, self.current_env().outer_scope) self.enter_scope(node, self.current_env().outer_scope)
self.visitchildren(node, ('default',)) self.visitchildren(node, ('default',))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment