Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f409349

Browse files
committed
Remove uses of iterkeys
1 parent 123b9cd commit f409349

6 files changed

Lines changed: 9 additions & 9 deletions

File tree

IPython/core/completerlib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ def cd_completer(self, event):
324324
return [compress_user(relpath, tilde_expand, tilde_val)]
325325

326326
# if no completions so far, try bookmarks
327-
bks = self.db.get('bookmarks',{}).iterkeys()
327+
bks = self.db.get('bookmarks',{})
328328
bkmatches = [s for s in bks if s.startswith(event.symbol)]
329329
if bkmatches:
330330
return bkmatches

IPython/kernel/zmq/ipkernel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ def apply_request(self, stream, ident, parent):
599599
exec(code, shell.user_global_ns, shell.user_ns)
600600
result = working.get(resultname)
601601
finally:
602-
for key in ns.iterkeys():
602+
for key in ns:
603603
working.pop(key)
604604

605605
result_buf = serialize_object(result,

IPython/kernel/zmq/serialize.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def serialize_object(obj, buffer_threshold=MAX_BYTES, item_threshold=MAX_ITEMS):
9191
buffers.extend(_extract_buffers(c, buffer_threshold))
9292
elif istype(obj, dict) and len(obj) < item_threshold:
9393
cobj = {}
94-
for k in sorted(obj.iterkeys()):
94+
for k in sorted(obj):
9595
c = can(obj[k])
9696
buffers.extend(_extract_buffers(c, buffer_threshold))
9797
cobj[k] = c
@@ -129,7 +129,7 @@ def unserialize_object(buffers, g=None):
129129
newobj = uncan_sequence(canned, g)
130130
elif istype(canned, dict) and len(canned) < MAX_ITEMS:
131131
newobj = {}
132-
for k in sorted(canned.iterkeys()):
132+
for k in sorted(canned):
133133
c = canned[k]
134134
_restore_buffers(c, bufs)
135135
newobj[k] = uncan(c, g)

IPython/parallel/client/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,21 +195,21 @@ def __init__(self, *args, **kwargs):
195195

196196
def __getattr__(self, key):
197197
"""getattr aliased to getitem"""
198-
if key in self.iterkeys():
198+
if key in self:
199199
return self[key]
200200
else:
201201
raise AttributeError(key)
202202

203203
def __setattr__(self, key, value):
204204
"""setattr aliased to setitem, with strict"""
205-
if key in self.iterkeys():
205+
if key in self:
206206
self[key] = value
207207
else:
208208
raise AttributeError(key)
209209

210210
def __setitem__(self, key, value):
211211
"""strict static key enforcement"""
212-
if key in self.iterkeys():
212+
if key in self:
213213
dict.__setitem__(self, key, value)
214214
else:
215215
raise KeyError(key)

IPython/parallel/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class Namespace(dict):
5959

6060
def __getattr__(self, key):
6161
"""getattr aliased to getitem"""
62-
if key in self.iterkeys():
62+
if key in self:
6363
return self[key]
6464
else:
6565
raise NameError(key)

IPython/utils/jsonutil.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
def rekey(dikt):
4444
"""Rekey a dict that has been forced to use str keys where there should be
4545
ints by json."""
46-
for k in dikt.iterkeys():
46+
for k in dikt:
4747
if isinstance(k, string_types):
4848
ik=fk=None
4949
try:

0 commit comments

Comments
 (0)