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

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

Issue 753543006: pylint: upgrade to 1.4.0 (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
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
diff --git a/third_party/logilab/astroid/raw_building.py b/third_party/logilab/astroid/raw_building.py
index e245f912b913692ef49b4ed442bf8ae8f965159f..08f6af6da9cb7ee9ecc25f66987af35c69f2f26f 100644
--- a/third_party/logilab/astroid/raw_building.py
+++ b/third_party/logilab/astroid/raw_building.py
@@ -25,6 +25,7 @@ import sys
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,7 +58,10 @@ def attach_dummy_node(node, name, object=_marker):
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
@@ -247,10 +251,11 @@ class InspectBuilder(object):
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 @@ class InspectBuilder(object):
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 @@ class InspectBuilder(object):
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