Show More
@@ -324,7 +324,7 b' def cd_completer(self, event):' | |||||
324 | return [compress_user(relpath, tilde_expand, tilde_val)] |
|
324 | return [compress_user(relpath, tilde_expand, tilde_val)] | |
325 |
|
325 | |||
326 | # if no completions so far, try bookmarks |
|
326 | # if no completions so far, try bookmarks | |
327 |
bks = self.db.get('bookmarks',{}) |
|
327 | bks = self.db.get('bookmarks',{}) | |
328 | bkmatches = [s for s in bks if s.startswith(event.symbol)] |
|
328 | bkmatches = [s for s in bks if s.startswith(event.symbol)] | |
329 | if bkmatches: |
|
329 | if bkmatches: | |
330 | return bkmatches |
|
330 | return bkmatches |
@@ -599,7 +599,7 b' class Kernel(Configurable):' | |||||
599 | exec(code, shell.user_global_ns, shell.user_ns) |
|
599 | exec(code, shell.user_global_ns, shell.user_ns) | |
600 | result = working.get(resultname) |
|
600 | result = working.get(resultname) | |
601 | finally: |
|
601 | finally: | |
602 |
for key in ns |
|
602 | for key in ns: | |
603 | working.pop(key) |
|
603 | working.pop(key) | |
604 |
|
604 | |||
605 | result_buf = serialize_object(result, |
|
605 | result_buf = serialize_object(result, |
@@ -91,7 +91,7 b' def serialize_object(obj, buffer_threshold=MAX_BYTES, item_threshold=MAX_ITEMS):' | |||||
91 | buffers.extend(_extract_buffers(c, buffer_threshold)) |
|
91 | buffers.extend(_extract_buffers(c, buffer_threshold)) | |
92 | elif istype(obj, dict) and len(obj) < item_threshold: |
|
92 | elif istype(obj, dict) and len(obj) < item_threshold: | |
93 | cobj = {} |
|
93 | cobj = {} | |
94 |
for k in sorted(obj |
|
94 | for k in sorted(obj): | |
95 | c = can(obj[k]) |
|
95 | c = can(obj[k]) | |
96 | buffers.extend(_extract_buffers(c, buffer_threshold)) |
|
96 | buffers.extend(_extract_buffers(c, buffer_threshold)) | |
97 | cobj[k] = c |
|
97 | cobj[k] = c | |
@@ -129,7 +129,7 b' def unserialize_object(buffers, g=None):' | |||||
129 | newobj = uncan_sequence(canned, g) |
|
129 | newobj = uncan_sequence(canned, g) | |
130 | elif istype(canned, dict) and len(canned) < MAX_ITEMS: |
|
130 | elif istype(canned, dict) and len(canned) < MAX_ITEMS: | |
131 | newobj = {} |
|
131 | newobj = {} | |
132 |
for k in sorted(canned |
|
132 | for k in sorted(canned): | |
133 | c = canned[k] |
|
133 | c = canned[k] | |
134 | _restore_buffers(c, bufs) |
|
134 | _restore_buffers(c, bufs) | |
135 | newobj[k] = uncan(c, g) |
|
135 | newobj[k] = uncan(c, g) |
@@ -195,21 +195,21 b' class Metadata(dict):' | |||||
195 |
|
195 | |||
196 | def __getattr__(self, key): |
|
196 | def __getattr__(self, key): | |
197 | """getattr aliased to getitem""" |
|
197 | """getattr aliased to getitem""" | |
198 |
if key in self |
|
198 | if key in self: | |
199 | return self[key] |
|
199 | return self[key] | |
200 | else: |
|
200 | else: | |
201 | raise AttributeError(key) |
|
201 | raise AttributeError(key) | |
202 |
|
202 | |||
203 | def __setattr__(self, key, value): |
|
203 | def __setattr__(self, key, value): | |
204 | """setattr aliased to setitem, with strict""" |
|
204 | """setattr aliased to setitem, with strict""" | |
205 |
if key in self |
|
205 | if key in self: | |
206 | self[key] = value |
|
206 | self[key] = value | |
207 | else: |
|
207 | else: | |
208 | raise AttributeError(key) |
|
208 | raise AttributeError(key) | |
209 |
|
209 | |||
210 | def __setitem__(self, key, value): |
|
210 | def __setitem__(self, key, value): | |
211 | """strict static key enforcement""" |
|
211 | """strict static key enforcement""" | |
212 |
if key in self |
|
212 | if key in self: | |
213 | dict.__setitem__(self, key, value) |
|
213 | dict.__setitem__(self, key, value) | |
214 | else: |
|
214 | else: | |
215 | raise KeyError(key) |
|
215 | raise KeyError(key) |
@@ -59,7 +59,7 b' class Namespace(dict):' | |||||
59 |
|
59 | |||
60 | def __getattr__(self, key): |
|
60 | def __getattr__(self, key): | |
61 | """getattr aliased to getitem""" |
|
61 | """getattr aliased to getitem""" | |
62 |
if key in self |
|
62 | if key in self: | |
63 | return self[key] |
|
63 | return self[key] | |
64 | else: |
|
64 | else: | |
65 | raise NameError(key) |
|
65 | raise NameError(key) |
@@ -43,7 +43,7 b' ISO8601_PAT=re.compile(r"^(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d+)Z?([\\+\\-]\\d{' | |||||
43 | def rekey(dikt): |
|
43 | def rekey(dikt): | |
44 | """Rekey a dict that has been forced to use str keys where there should be |
|
44 | """Rekey a dict that has been forced to use str keys where there should be | |
45 | ints by json.""" |
|
45 | ints by json.""" | |
46 |
for k in dikt |
|
46 | for k in dikt: | |
47 | if isinstance(k, string_types): |
|
47 | if isinstance(k, string_types): | |
48 | ik=fk=None |
|
48 | ik=fk=None | |
49 | try: |
|
49 | try: |
General Comments 0
You need to be logged in to leave comments.
Login now