diff --git a/IPython/core/completerlib.py b/IPython/core/completerlib.py index 98e4c6f..22e14d7 100644 --- a/IPython/core/completerlib.py +++ b/IPython/core/completerlib.py @@ -324,7 +324,7 @@ def cd_completer(self, event): return [compress_user(relpath, tilde_expand, tilde_val)] # if no completions so far, try bookmarks - bks = self.db.get('bookmarks',{}).iterkeys() + bks = self.db.get('bookmarks',{}) bkmatches = [s for s in bks if s.startswith(event.symbol)] if bkmatches: return bkmatches diff --git a/IPython/kernel/zmq/ipkernel.py b/IPython/kernel/zmq/ipkernel.py index 0d79815..2a71dcf 100755 --- a/IPython/kernel/zmq/ipkernel.py +++ b/IPython/kernel/zmq/ipkernel.py @@ -599,7 +599,7 @@ class Kernel(Configurable): exec(code, shell.user_global_ns, shell.user_ns) result = working.get(resultname) finally: - for key in ns.iterkeys(): + for key in ns: working.pop(key) result_buf = serialize_object(result, diff --git a/IPython/kernel/zmq/serialize.py b/IPython/kernel/zmq/serialize.py index 282b2c2..72729a1 100644 --- a/IPython/kernel/zmq/serialize.py +++ b/IPython/kernel/zmq/serialize.py @@ -91,7 +91,7 @@ def serialize_object(obj, buffer_threshold=MAX_BYTES, item_threshold=MAX_ITEMS): buffers.extend(_extract_buffers(c, buffer_threshold)) elif istype(obj, dict) and len(obj) < item_threshold: cobj = {} - for k in sorted(obj.iterkeys()): + for k in sorted(obj): c = can(obj[k]) buffers.extend(_extract_buffers(c, buffer_threshold)) cobj[k] = c @@ -129,7 +129,7 @@ def unserialize_object(buffers, g=None): newobj = uncan_sequence(canned, g) elif istype(canned, dict) and len(canned) < MAX_ITEMS: newobj = {} - for k in sorted(canned.iterkeys()): + for k in sorted(canned): c = canned[k] _restore_buffers(c, bufs) newobj[k] = uncan(c, g) diff --git a/IPython/parallel/client/client.py b/IPython/parallel/client/client.py index 91ab385..f7a2f14 100644 --- a/IPython/parallel/client/client.py +++ b/IPython/parallel/client/client.py @@ -195,21 +195,21 @@ class Metadata(dict): def __getattr__(self, key): """getattr aliased to getitem""" - if key in self.iterkeys(): + if key in self: return self[key] else: raise AttributeError(key) def __setattr__(self, key, value): """setattr aliased to setitem, with strict""" - if key in self.iterkeys(): + if key in self: self[key] = value else: raise AttributeError(key) def __setitem__(self, key, value): """strict static key enforcement""" - if key in self.iterkeys(): + if key in self: dict.__setitem__(self, key, value) else: raise KeyError(key) diff --git a/IPython/parallel/util.py b/IPython/parallel/util.py index 274da72..5df28ec 100644 --- a/IPython/parallel/util.py +++ b/IPython/parallel/util.py @@ -59,7 +59,7 @@ class Namespace(dict): def __getattr__(self, key): """getattr aliased to getitem""" - if key in self.iterkeys(): + if key in self: return self[key] else: raise NameError(key) diff --git a/IPython/utils/jsonutil.py b/IPython/utils/jsonutil.py index 6b2cc89..f81766b 100644 --- a/IPython/utils/jsonutil.py +++ b/IPython/utils/jsonutil.py @@ -43,7 +43,7 @@ ISO8601_PAT=re.compile(r"^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+)Z?([\+\-]\d{ def rekey(dikt): """Rekey a dict that has been forced to use str keys where there should be ints by json.""" - for k in dikt.iterkeys(): + for k in dikt: if isinstance(k, string_types): ik=fk=None try: