diff options
author | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2014-10-27 00:35:18 +0200 |
---|---|---|
committer | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2014-10-27 00:35:18 +0200 |
commit | 09cd8b7eefb021f2d8327e42614bca7cbb8915f2 (patch) | |
tree | e54d46837b31f00197106ad6f104f3444c65b521 /node_classes.py | |
parent | 1c5cab5ce9c6bf5c2a161748d03a5fa44a69e15e (diff) | |
download | astroid-git-09cd8b7eefb021f2d8327e42614bca7cbb8915f2.tar.gz |
Make the source compatible with Python 2.7 and 3.3+.
Diffstat (limited to 'node_classes.py')
-rw-r--r-- | node_classes.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/node_classes.py b/node_classes.py index 13376d11..71e512f4 100644 --- a/node_classes.py +++ b/node_classes.py @@ -20,6 +20,7 @@ import sys +import six from logilab.common.decorators import cachedproperty from astroid.exceptions import NoDefault @@ -41,7 +42,7 @@ def unpack_infer(stmt, context=None): yield infered_elt return # if infered is a final node, return it and stop - infered = stmt.infer(context).next() + infered = next(stmt.infer(context)) if infered is stmt: yield infered return @@ -495,7 +496,7 @@ class Const(NodeNG, Instance): self.value = value def getitem(self, index, context=None): - if isinstance(self.value, basestring): + if isinstance(self.value, six.string_types): return Const(self.value[index]) raise TypeError('%r (value=%s)' % (self, self.value)) @@ -503,7 +504,7 @@ class Const(NodeNG, Instance): return False def itered(self): - if isinstance(self.value, basestring): + if isinstance(self.value, six.string_types): return self.value raise TypeError() @@ -548,7 +549,7 @@ class Dict(NodeNG, Instance): self.items = [] else: self.items = [(const_factory(k), const_factory(v)) - for k, v in items.iteritems()] + for k, v in items.items()] def pytype(self): return '%s.dict' % BUILTINS |