Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(486)

Unified Diff: third_party/logilab/astroid/raw_building.py

Issue 776883002: pylint: upgrade to 1.4.0 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/logilab/astroid/protocols.py ('k') | third_party/logilab/astroid/rebuilder.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/logilab/astroid/raw_building.py
===================================================================
--- third_party/logilab/astroid/raw_building.py (revision 293207)
+++ third_party/logilab/astroid/raw_building.py (working copy)
@@ -25,6 +25,7 @@
from os.path import abspath
from inspect import (getargspec, isdatadescriptor, isfunction, ismethod,
ismethoddescriptor, isclass, isbuiltin, ismodule)
+import six
from astroid.node_classes import CONST_CLS
from astroid.nodes import (Module, Class, Const, const_factory, From,
@@ -57,8 +58,11 @@
enode.object = object
_attach_local_node(node, enode, name)
-EmptyNode.has_underlying_object = lambda self: self.object is not _marker
+def _has_underlying_object(self):
+ return hasattr(self, 'object') and self.object is not _marker
+EmptyNode.has_underlying_object = _has_underlying_object
+
def attach_const_node(node, name, value):
"""create a Const node and register it in the locals of the given
node with the specified name
@@ -247,10 +251,11 @@
attach_dummy_node(node, name)
continue
if ismethod(member):
- member = member.im_func
+ member = six.get_method_function(member)
if isfunction(member):
# verify this is not an imported function
- filename = getattr(member.func_code, 'co_filename', None)
+ filename = getattr(six.get_function_code(member),
+ 'co_filename', None)
if filename is None:
assert isinstance(member, object)
object_build_methoddescriptor(node, member, name)
@@ -261,8 +266,6 @@
elif isbuiltin(member):
if (not _io_discrepancy(member) and
self.imported_member(node, member, name)):
- #if obj is object:
- # print 'skippp', obj, name, member
continue
object_build_methoddescriptor(node, member, name)
elif isclass(member):
@@ -299,7 +302,7 @@
modname = getattr(member, '__module__', None)
except:
# XXX use logging
- print 'unexpected error while building astroid from living object'
+ print('unexpected error while building astroid from living object')
import traceback
traceback.print_exc()
modname = None
« no previous file with comments | « third_party/logilab/astroid/protocols.py ('k') | third_party/logilab/astroid/rebuilder.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698