コード例 #1
0
ファイル: editing.py プロジェクト: hirochachacha/apython
def edit_input_history():
    with tempfile.NamedTemporaryFile() as f:
        input = bpython.running.stdin
        f.write(input.encode(getpreferredencoding()))
        f.flush()
        editor_invocation = invoke_editor(f.name, 0, False).split()
        invoke_command(editor_invocation)
コード例 #2
0
ファイル: editing.py プロジェクト: hirochachacha/apython
def edit_history():
    with tempfile.NamedTemporaryFile() as f:
        entries = bpython.running.clirepl.history.entries
        output = pprint.pformat(entries)
        f.write(output.encode(getpreferredencoding()))
        f.flush()
        editor_invocation = invoke_editor(f.name, 0, False).split()
        invoke_command(editor_invocation)
コード例 #3
0
 def _get_precise_keyname(self, ambiguous_keyname):
     if isinstance(ambiguous_keyname, text_type):
         ambiguous_keyname = ambiguous_keyname.encode(getpreferredencoding())
     if ambiguous_keyname in self._keymap:
         return ambiguous_keyname
     elif ambiguous_keyname in self._alias_keymap:
         keyname = self._alias_keymap[ambiguous_keyname]
         return self._get_precise_keyname(keyname)
     else:
         #TODO need some warning for debugging
         return ambiguous_keyname
コード例 #4
0
 def pager(self, output):
     if not py3 and isinstance(output, str):
         output = output.decode(getpreferredencoding())
     self._repl.pager(output)
コード例 #5
0
ファイル: _internal.py プロジェクト: bpython/bpython
 def pager(self, output):
     if not py3 and isinstance(output, str):
         output = output.decode(getpreferredencoding())
     self._repl.pager(output)