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

Skip to content

Commit c11ed25

Browse files
committed
Pass history request keys as **kwargs
1 parent 76dcfa3 commit c11ed25

2 files changed

Lines changed: 4 additions & 12 deletions

File tree

IPython/kernel/zmq/kernelbase.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -416,19 +416,9 @@ def do_inspect(self, code, cursor_pos, detail_level=0):
416416
return {'status': 'ok', 'data':{}, 'metadata':{}, 'found':False}
417417

418418
def history_request(self, stream, ident, parent):
419-
# We need to pull these out, as passing **kwargs doesn't work with
420-
# unicode keys before Python 2.6.5.
421419
content = parent['content']
422420

423-
reply_content = self.do_history(content['hist_access_type'],
424-
content['output'], content['raw'],
425-
content.get('session', None),
426-
content.get('start', None),
427-
content.get('stop', None),
428-
content.get('n', None),
429-
content.get('pattern', None),
430-
content.get('unique', False),
431-
)
421+
reply_content = self.do_history(**content)
432422

433423
reply_content = json_clean(reply_content)
434424
msg = self.session.send(stream, 'history_reply',

docs/source/development/wrapperkernels.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ relevant section of the :doc:`messaging spec <messaging>`.
128128

129129
.. method:: do_history(hist_access_type, output, raw, session=None, start=None, stop=None, n=None, pattern=None, unique=False)
130130

131-
History access
131+
History access. Only the relevant parameters for the type of history
132+
request concerned will be passed, so your method definition must have defaults
133+
for all the arguments shown with defaults here.
132134

133135
.. seealso::
134136

0 commit comments

Comments
 (0)