[Python-modules-commits] [prompt-toolkit] 01/03: Import prompt-toolkit_0.54.orig.tar.gz

Scott Kitterman kitterman at moszumanska.debian.org
Wed Dec 2 06:46:48 UTC 2015


This is an automated email from the git hooks/post-receive script.

kitterman pushed a commit to branch master
in repository prompt-toolkit.

commit 1c3f493bc2bce3a131449db3a0a1d0ad3d3b7ed7
Author: Scott Kitterman <scott at kitterman.com>
Date:   Wed Dec 2 00:50:52 2015 -0500

    Import prompt-toolkit_0.54.orig.tar.gz
---
 CHANGELOG                                       |  31 +++
 PKG-INFO                                        |  22 +--
 README.rst                                      |  20 +-
 TODO.rst                                        |  39 ----
 examples/asyncio-prompt.py                      |   4 +-
 examples/auto-suggestion.py                     |   2 +-
 examples/bottom-toolbar.py                      |   5 +-
 examples/colored-prompt.py                      |   3 +-
 examples/regular-language.py                    |   5 +-
 examples/telnet.py                              |  11 +-
 prompt_toolkit.egg-info/PKG-INFO                |  22 +--
 prompt_toolkit.egg-info/SOURCES.txt             |   4 +-
 prompt_toolkit.egg-info/pbr.json                |   1 +
 prompt_toolkit/application.py                   |  51 ++---
 prompt_toolkit/auto_suggest.py                  |  18 +-
 prompt_toolkit/buffer.py                        | 103 +++++-----
 prompt_toolkit/clipboard/base.py                |   2 +-
 prompt_toolkit/completion.py                    |  30 +--
 prompt_toolkit/contrib/completers/filesystem.py |   8 +-
 prompt_toolkit/contrib/ipython.py               |  21 ---
 prompt_toolkit/contrib/repl.py                  |  21 ---
 prompt_toolkit/contrib/telnet/server.py         |  12 +-
 prompt_toolkit/document.py                      |   4 +-
 prompt_toolkit/enums.py                         |  12 +-
 prompt_toolkit/eventloop/asyncio_posix.py       |  12 +-
 prompt_toolkit/eventloop/asyncio_win32.py       |   9 +-
 prompt_toolkit/eventloop/base.py                |  22 ++-
 prompt_toolkit/eventloop/callbacks.py           |  13 +-
 prompt_toolkit/eventloop/posix.py               |  95 ++++++++--
 prompt_toolkit/eventloop/posix_utils.py         |   7 +-
 prompt_toolkit/eventloop/win32.py               |  14 +-
 prompt_toolkit/filters/base.py                  |   6 +-
 prompt_toolkit/filters/types.py                 |   6 +-
 prompt_toolkit/filters/utils.py                 |  11 +-
 prompt_toolkit/history.py                       |   4 +-
 prompt_toolkit/input.py                         |   5 +-
 prompt_toolkit/interface.py                     | 168 +++++++++--------
 prompt_toolkit/key_binding/bindings/basic.py    |   2 +-
 prompt_toolkit/key_binding/bindings/vi.py       |   2 +-
 prompt_toolkit/key_binding/input_processor.py   |   5 +
 prompt_toolkit/key_binding/registry.py          |  24 ++-
 prompt_toolkit/layout/__init__.py               |   6 +-
 prompt_toolkit/layout/containers.py             |  94 ++++++----
 prompt_toolkit/layout/controls.py               |  45 +++--
 prompt_toolkit/layout/dimension.py              |  19 +-
 prompt_toolkit/layout/lexers.py                 |   3 +-
 prompt_toolkit/layout/margins.py                |  24 ++-
 prompt_toolkit/layout/menus.py                  |   4 +-
 prompt_toolkit/layout/processors.py             |  45 ++++-
 prompt_toolkit/layout/screen.py                 |  28 ++-
 prompt_toolkit/layout/utils.py                  |  27 ++-
 prompt_toolkit/output.py                        |  51 ++---
 prompt_toolkit/renderer.py                      |  59 +++---
 prompt_toolkit/search_state.py                  |   6 +-
 prompt_toolkit/selection.py                     |   5 +
 prompt_toolkit/shortcuts.py                     | 240 +++++++++++++++---------
 prompt_toolkit/styles.py                        | 124 +++++++++++-
 prompt_toolkit/terminal/vt100_output.py         |  26 ++-
 prompt_toolkit/terminal/win32_output.py         |  13 +-
 prompt_toolkit/utils.py                         |   9 +
 prompt_toolkit/validation.py                    |  17 +-
 setup.cfg                                       |   2 +-
 setup.py                                        |   2 +-
 63 files changed, 1080 insertions(+), 625 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 63c5a24..3409e77 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,37 @@
 CHANGELOG
 =========
 
+0.54: 2015-10-29
+----------------
+
+New features:
+- Allow CommandLineInterface to run in any thread.
+- Hide cursor while rendering.
+- Added add_reader/remove_reader methods to EventLoop.
+- Support for 'reverse' style.
+- Redraw more lazy, by using invalidate.
+- Added show_cursor property to Screen.
+- Center or right align text in TokenListControl also when it spans multiple
+  lines.
+
+Fixes:
+- Bugfix in PathCompleter. (Expanduser issue.)
+- Fix in signal handler.
+- Use utf-8 encoding in Vt100_Output by default.
+- Use correct default token in BufferControl.
+- Fix in ControlL key binding. Use @handle to allow desactivation.
+
+Backwards-incompatible changes:
+- Renamed create_default_layout to create_prompt_layout
+- Renamed create_default_application to create_prompt_application
+- Renamed Layout to Container.
+- Renamed CommandLineInterfaces.request_redraw to invalidate.
+- Changed the actual value of SEARCH_BUFFER, DEFAULT_BUFFER, SYSTEM_BUFFER and
+  DUMMY_BUFFER.
+- Changed order of keyword arguments of the BufferControl class. "buffer_name"
+  now comes first.
+- Removed old pt(i)python code.
+
 0.53: 2015-10-06
 ----------------
 
diff --git a/PKG-INFO b/PKG-INFO
index 13bf7b9..9dd9ece 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.0
 Name: prompt_toolkit
-Version: 0.53
+Version: 0.54
 Summary: Library for building powerful interactive command lines in Python
 Home-page: https://github.com/jonathanslenders/python-prompt-toolkit
 Author: Jonathan Slenders
@@ -12,23 +12,21 @@ Description: Python Prompt Toolkit
         |Build Status|  |PyPI|
         
         ``prompt_toolkit`` is a library for building powerful interactive command lines
-        in Python.
+        and terminal applications in Python.
         
-        Looking for ptpython, the Python REPL?
-        **************************************
+        Read the `documentation on readthedocs
+        <http://python-prompt-toolkit.readthedocs.org/en/latest/>`_.
         
-        Are you looking for ``ptpython``, the interactive Python Shell? We moved the
-        ``ptpython`` source code to a separate repository. This way we are sure not to
-        pollute the ``prompt_toolkit`` library with any ``ptpython``-specific stuff and
-        ``ptpython`` can be developed independently. You will now have to install it
-        through::
         
-            pip install ptpython
+        Ptpython
+        ********
         
-        `Go to ptpython... <http://github.com/jonathanslenders/ptpython/>`_
+        `ptpython <http://github.com/jonathanslenders/ptpython/>`_ is an interactive
+        Python Shell, build on top of prompt-toolkit.
         
         .. image :: https://github.com/jonathanslenders/python-prompt-toolkit/raw/master/docs/images/ptpython.png
         
+        
         prompt-toolkit features
         ***********************
         
@@ -117,6 +115,8 @@ Description: Python Prompt Toolkit
         - `wharfee <http://wharfee.com/>`_: A Docker command line.
         - `xonsh <http://xonsh.org/>`_: A Python-ish, BASHwards-compatible shell.
         - `saws <https://github.com/donnemartin/saws>`_: A Supercharged AWS Command Line Interface.
+        - `cycli <https://github.com/nicolewhite/cycli>`_:  A Command Line Interface for Cypher.
+        - `crash <https://github.com/crate/crash>`_:  Crate command line client.
         
         
         (Want your own project to be listed here? Please create a GitHub issue.)
diff --git a/README.rst b/README.rst
index 45c9eea..77294e2 100644
--- a/README.rst
+++ b/README.rst
@@ -4,23 +4,21 @@ Python Prompt Toolkit
 |Build Status|  |PyPI|
 
 ``prompt_toolkit`` is a library for building powerful interactive command lines
-in Python.
+and terminal applications in Python.
 
-Looking for ptpython, the Python REPL?
-**************************************
+Read the `documentation on readthedocs
+<http://python-prompt-toolkit.readthedocs.org/en/latest/>`_.
 
-Are you looking for ``ptpython``, the interactive Python Shell? We moved the
-``ptpython`` source code to a separate repository. This way we are sure not to
-pollute the ``prompt_toolkit`` library with any ``ptpython``-specific stuff and
-``ptpython`` can be developed independently. You will now have to install it
-through::
 
-    pip install ptpython
+Ptpython
+********
 
-`Go to ptpython... <http://github.com/jonathanslenders/ptpython/>`_
+`ptpython <http://github.com/jonathanslenders/ptpython/>`_ is an interactive
+Python Shell, build on top of prompt-toolkit.
 
 .. image :: https://github.com/jonathanslenders/python-prompt-toolkit/raw/master/docs/images/ptpython.png
 
+
 prompt-toolkit features
 ***********************
 
@@ -109,6 +107,8 @@ Projects using prompt-toolkit
 - `wharfee <http://wharfee.com/>`_: A Docker command line.
 - `xonsh <http://xonsh.org/>`_: A Python-ish, BASHwards-compatible shell.
 - `saws <https://github.com/donnemartin/saws>`_: A Supercharged AWS Command Line Interface.
+- `cycli <https://github.com/nicolewhite/cycli>`_:  A Command Line Interface for Cypher.
+- `crash <https://github.com/crate/crash>`_:  Crate command line client.
 
 
 (Want your own project to be listed here? Please create a GitHub issue.)
diff --git a/TODO.rst b/TODO.rst
deleted file mode 100644
index e80bc0c..0000000
--- a/TODO.rst
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-- Focus stack needs to accept values other than `None`. This way we can better give the sidebar and exit message focus in ptpython, and it doesn't break focus in unpredictable ways in ptpdb.
-
-- Margins in BufferControl needs to be rendered independently. That way we can clean up code in the Screen class (which should not be responsible for calling margins.) The Screen class should however keep a mapping of the line numbers to input lines. This will also make it possible to invalidate margins independently of the main content. (Probably it's not worth having invalidation on the margins -- it's not heavy to calculate.)
-
-- Find a way to support backgrounds. A.k.a: find a way to eleminate Pygments.
-
-- support editing of larger buffers.
-
-
-Eleminate pygments
-------------------
-
-We need two things:
-- Tokens to identify chunks of text.
-- A stylesheet.
-For both, we still want to be able to use Pygments, by wrapping them, without loosing any performance.
-
-
-Pygments limitations:
-- Tokens have just one class, unlike CSS. A <span> in HTML can have several classes, where each class contributes to a part of the styling. (E.g. the background.)
-
-Token.History.Something
-
-
-Editing of larger buffers
--------------------------
-
-We need two things:
-- A way to incrementally edit text of large buffers. (Keeping history.)
-- A way to incrementally lex the result of such a large buffer.
-
-
-Renames:
--------
-
-WindowRenderInfo.rendered_height -> window_height
-WindowRenderInfo.input_line_to_screen_line -> should become property.
diff --git a/examples/asyncio-prompt.py b/examples/asyncio-prompt.py
index 7d98660..edc6dd4 100755
--- a/examples/asyncio-prompt.py
+++ b/examples/asyncio-prompt.py
@@ -19,7 +19,7 @@ possible. ::
 """
 from __future__ import unicode_literals
 from prompt_toolkit.interface import CommandLineInterface
-from prompt_toolkit.shortcuts import create_default_application, create_asyncio_eventloop
+from prompt_toolkit.shortcuts import create_prompt_application, create_asyncio_eventloop
 
 import asyncio
 import sys
@@ -51,7 +51,7 @@ def interactive_shell():
 
     # Create interface.
     cli = CommandLineInterface(
-        application=create_default_application('Say something inside the event loop: '),
+        application=create_prompt_application('Say something inside the event loop: '),
         eventloop=eventloop)
 
     # Patch stdout in something that will always print *above* the prompt when
diff --git a/examples/auto-suggestion.py b/examples/auto-suggestion.py
index 6e26acc..00c5a3a 100755
--- a/examples/auto-suggestion.py
+++ b/examples/auto-suggestion.py
@@ -2,7 +2,7 @@
 """
 Simple example of a CLI that demonstrates fish-style auto suggestion.
 
-When you type some input, it will match the input against the hitory. If One
+When you type some input, it will match the input against the history. If One
 entry of the history starts with the given input, then it will show the
 remaining part as a suggestion. Pressing the right arrow will insert this
 suggestion.
diff --git a/examples/bottom-toolbar.py b/examples/bottom-toolbar.py
index 60cd36d..c3929d7 100755
--- a/examples/bottom-toolbar.py
+++ b/examples/bottom-toolbar.py
@@ -4,8 +4,9 @@ Simple example showing a bottom toolbar.
 """
 from __future__ import unicode_literals
 from prompt_toolkit import prompt
-from pygments.token import Token
+from prompt_toolkit.styles import PygmentsStyle
 from pygments.style import Style
+from pygments.token import Token
 
 
 class TestStyle(Style):
@@ -20,7 +21,7 @@ def main():
 
     text = prompt('Say something: ',
                   get_bottom_toolbar_tokens=get_bottom_toolbar_tokens,
-                  style=TestStyle)
+                  style=PygmentsStyle(TestStyle))
     print('You said: %s' % text)
 
 
diff --git a/examples/colored-prompt.py b/examples/colored-prompt.py
index f6ce71d..aaa1ff4 100755
--- a/examples/colored-prompt.py
+++ b/examples/colored-prompt.py
@@ -6,6 +6,7 @@ from __future__ import unicode_literals
 
 from prompt_toolkit import prompt
 from pygments.style import Style
+from prompt_toolkit.styles import PygmentsStyle
 from pygments.styles.default import DefaultStyle
 from pygments.token import Token
 
@@ -39,5 +40,5 @@ def get_prompt_tokens(cli):
 
 
 if __name__ == '__main__':
-    answer = prompt(get_prompt_tokens=get_prompt_tokens, style=ExampleStyle)
+    answer = prompt(get_prompt_tokens=get_prompt_tokens, style=PygmentsStyle(ExampleStyle))
     print('You said: %s' % answer)
diff --git a/examples/regular-language.py b/examples/regular-language.py
index 7edc019..140de9a 100755
--- a/examples/regular-language.py
+++ b/examples/regular-language.py
@@ -20,7 +20,7 @@ from prompt_toolkit.contrib.regular_languages.compiler import compile
 from prompt_toolkit.contrib.regular_languages.completion import GrammarCompleter
 from prompt_toolkit.contrib.regular_languages.lexer import GrammarLexer
 from prompt_toolkit.layout.lexers import SimpleLexer
-from prompt_toolkit.styles import DefaultStyle
+from prompt_toolkit.styles import DefaultStyle, PygmentsStyle
 
 from pygments.token import Token
 
@@ -69,7 +69,8 @@ if __name__ == '__main__':
         # REPL loop.
         while True:
             # Read input and parse the result.
-            text = prompt('Calculate: ', lexer=lexer, completer=completer, style=ExampleStyle)
+            text = prompt('Calculate: ', lexer=lexer, completer=completer,
+                          style=PygmentsStyle(ExampleStyle))
             m = g.match(text)
             if m:
                 vars = m.variables()
diff --git a/examples/telnet.py b/examples/telnet.py
index 27b55a2..60fdf5c 100755
--- a/examples/telnet.py
+++ b/examples/telnet.py
@@ -4,7 +4,7 @@ from __future__ import unicode_literals
 from prompt_toolkit.contrib.completers import WordCompleter
 from prompt_toolkit.contrib.telnet.application import TelnetApplication
 from prompt_toolkit.contrib.telnet.server import TelnetServer
-from prompt_toolkit.shortcuts import create_default_application
+from prompt_toolkit.shortcuts import create_prompt_application
 from prompt_toolkit.application import AbortAction
 
 from pygments.lexers import HtmlLexer
@@ -26,11 +26,10 @@ class ExampleApplication(TelnetApplication):
         # Set CommandLineInterface.
         animal_completer = WordCompleter(['alligator', 'ant'])
         telnet_connection.set_application(
-            create_default_application(
-                       message='Say something: ',
-                       lexer=HtmlLexer,
-                       completer=animal_completer,
-                       on_abort=AbortAction.RETRY),
+            create_prompt_application(message='Say something: ',
+                                      lexer=HtmlLexer,
+                                      completer=animal_completer,
+                                      on_abort=AbortAction.RETRY),
             self.handle_command)
 
     def handle_command(self, telnet_connection, document):
diff --git a/prompt_toolkit.egg-info/PKG-INFO b/prompt_toolkit.egg-info/PKG-INFO
index 8cb5050..29de500 100644
--- a/prompt_toolkit.egg-info/PKG-INFO
+++ b/prompt_toolkit.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.0
 Name: prompt-toolkit
-Version: 0.53
+Version: 0.54
 Summary: Library for building powerful interactive command lines in Python
 Home-page: https://github.com/jonathanslenders/python-prompt-toolkit
 Author: Jonathan Slenders
@@ -12,23 +12,21 @@ Description: Python Prompt Toolkit
         |Build Status|  |PyPI|
         
         ``prompt_toolkit`` is a library for building powerful interactive command lines
-        in Python.
+        and terminal applications in Python.
         
-        Looking for ptpython, the Python REPL?
-        **************************************
+        Read the `documentation on readthedocs
+        <http://python-prompt-toolkit.readthedocs.org/en/latest/>`_.
         
-        Are you looking for ``ptpython``, the interactive Python Shell? We moved the
-        ``ptpython`` source code to a separate repository. This way we are sure not to
-        pollute the ``prompt_toolkit`` library with any ``ptpython``-specific stuff and
-        ``ptpython`` can be developed independently. You will now have to install it
-        through::
         
-            pip install ptpython
+        Ptpython
+        ********
         
-        `Go to ptpython... <http://github.com/jonathanslenders/ptpython/>`_
+        `ptpython <http://github.com/jonathanslenders/ptpython/>`_ is an interactive
+        Python Shell, build on top of prompt-toolkit.
         
         .. image :: https://github.com/jonathanslenders/python-prompt-toolkit/raw/master/docs/images/ptpython.png
         
+        
         prompt-toolkit features
         ***********************
         
@@ -117,6 +115,8 @@ Description: Python Prompt Toolkit
         - `wharfee <http://wharfee.com/>`_: A Docker command line.
         - `xonsh <http://xonsh.org/>`_: A Python-ish, BASHwards-compatible shell.
         - `saws <https://github.com/donnemartin/saws>`_: A Supercharged AWS Command Line Interface.
+        - `cycli <https://github.com/nicolewhite/cycli>`_:  A Command Line Interface for Cypher.
+        - `crash <https://github.com/crate/crash>`_:  Crate command line client.
         
         
         (Want your own project to be listed here? Please create a GitHub issue.)
diff --git a/prompt_toolkit.egg-info/SOURCES.txt b/prompt_toolkit.egg-info/SOURCES.txt
index fcebb25..082c87d 100644
--- a/prompt_toolkit.egg-info/SOURCES.txt
+++ b/prompt_toolkit.egg-info/SOURCES.txt
@@ -3,7 +3,6 @@ CHANGELOG
 LICENSE
 MANIFEST.in
 README.rst
-TODO.rst
 setup.py
 examples/abortaction.retry.py
 examples/asyncio-prompt.py
@@ -64,6 +63,7 @@ prompt_toolkit/win32_types.py
 prompt_toolkit.egg-info/PKG-INFO
 prompt_toolkit.egg-info/SOURCES.txt
 prompt_toolkit.egg-info/dependency_links.txt
+prompt_toolkit.egg-info/pbr.json
 prompt_toolkit.egg-info/requires.txt
 prompt_toolkit.egg-info/top_level.txt
 prompt_toolkit/clipboard/__init__.py
@@ -71,8 +71,6 @@ prompt_toolkit/clipboard/base.py
 prompt_toolkit/clipboard/in_memory.py
 prompt_toolkit/clipboard/pyperclip.py
 prompt_toolkit/contrib/__init__.py
-prompt_toolkit/contrib/ipython.py
-prompt_toolkit/contrib/repl.py
 prompt_toolkit/contrib/completers/__init__.py
 prompt_toolkit/contrib/completers/base.py
 prompt_toolkit/contrib/completers/filesystem.py
diff --git a/prompt_toolkit.egg-info/pbr.json b/prompt_toolkit.egg-info/pbr.json
new file mode 100644
index 0000000..eeda1aa
--- /dev/null
+++ b/prompt_toolkit.egg-info/pbr.json
@@ -0,0 +1 @@
+{"is_release": false, "git_version": "0abd440"}
\ No newline at end of file
diff --git a/prompt_toolkit/application.py b/prompt_toolkit/application.py
index b77cf65..5867a06 100644
--- a/prompt_toolkit/application.py
+++ b/prompt_toolkit/application.py
@@ -3,15 +3,15 @@ from __future__ import unicode_literals
 from .buffer import Buffer, AcceptAction
 from .clipboard import Clipboard, InMemoryClipboard
 from .enums import DEFAULT_BUFFER
-from .filters import CLIFilter, Never, to_cli_filter
+from .filters import CLIFilter, to_cli_filter
 from .focus_stack import FocusStack
 from .key_binding.bindings.basic import load_basic_bindings
 from .key_binding.bindings.emacs import load_emacs_bindings
 from .key_binding.registry import Registry
 from .layout import Window
-from .layout.containers import Layout
+from .layout.containers import Container
 from .layout.controls import BufferControl
-from .styles import DefaultStyle
+from .styles import DefaultStyle, Style, PygmentsStyle
 from .utils import Callback
 
 __all__ = (
@@ -34,30 +34,35 @@ class AbortAction:
 
 class Application(object):
     """
-    Application class to be passed to a `CommandLineInterface`.
+    Application class to be passed to a
+    :class:`~prompt_toolkit.interface.CommandLineInterface`.
 
     This contains all customizable logic that is not I/O dependent.
     (So, what is independent of event loops, input and output.)
 
-    This way, such an `Application` can run easily on several
-    `CommandLineInterface`s, each with a different I/O backends.
-    that runs for instance over telnet, SSH or any other I/O backend.
+    This way, such an :class:`.Application` can run easily on several
+    :class:`~prompt_toolkit.interface.CommandLineInterface` instances, each
+    with a different I/O backends. that runs for instance over telnet, SSH or
+    any other I/O backend.
 
-    :param layout: A :class:`Layout` instance.
-    :param buffer: A :class:`Buffer` instance for the default buffer.
+    :param layout: A :class:`~prompt_toolkit.layout.containers.Container` instance.
+    :param buffer: A :class:`~prompt_toolkit.buffer.Buffer` instance for the default buffer.
     :param initial_focussed_buffer: Name of the buffer that is focussed during start-up.
-    :param key_bindings_registry: :class:`Registry` instance for the key bindings.
-    :param clipboard: Clipboard to use.
+    :param key_bindings_registry:
+        :class:`~prompt_toolkit.key_binding.registry.Registry` instance for the
+        key bindings.
+    :param clipboard: :class:`~prompt_toolkit.clipboard.base.Clipboard` to use.
     :param on_abort: What to do when Control-C is pressed.
     :param on_exit: What to do when Control-D is pressed.
     :param use_alternate_screen: When True, run the application on the alternate screen buffer.
-    :param mouse_support: (CLIFilter or boolean). When True, enable mouse support.
     :param get_title: Callable that returns the current title to be displayed in the terminal.
 
     Filters:
 
-    :param paste_mode: Filter.
-    :param ignore_case: Filter.
+    :param mouse_support: (:class:`~prompt_toolkit.filters.CLIFilter` or
+        boolean). When True, enable mouse support.
+    :param paste_mode: :class:`~prompt_toolkit.filters.CLIFilter` or boolean.
+    :param ignore_case: :class:`~prompt_toolkit.filters.CLIFilter` or boolean.
 
     Callbacks:
 
@@ -67,17 +72,18 @@ class Application(object):
     :param on_stop: Called when reading input ends.
     :param on_reset: Called during reset.
     :param on_buffer_changed: Called when another buffer gets the focus.
-    :param on_initialize: Called after the `CommandLineInterface` initializes.
+    :param on_initialize: Called after the
+        :class:`~prompt_toolkit.interface.CommandLineInterface` initializes.
     """
     def __init__(self, layout=None, buffer=None, buffers=None,
                  initial_focussed_buffer=DEFAULT_BUFFER,
-                 style=None, get_style=None,
+                 style=None,
                  key_bindings_registry=None, clipboard=None,
                  on_abort=AbortAction.IGNORE, on_exit=AbortAction.IGNORE,
                  use_alternate_screen=False, mouse_support=False,
                  get_title=None, focus_stack=None,
 
-                 paste_mode=Never(), ignore_case=Never(),
+                 paste_mode=False, ignore_case=False,
 
                  on_input_timeout=None, on_start=None, on_stop=None,
                  on_reset=None, on_initialize=None, on_buffer_changed=None):
@@ -86,7 +92,7 @@ class Application(object):
         ignore_case = to_cli_filter(ignore_case)
         mouse_support = to_cli_filter(mouse_support)
 
-        assert layout is None or isinstance(layout, Layout)
+        assert layout is None or isinstance(layout, Container)
         assert buffer is None or isinstance(buffer, Buffer)
         assert buffers is None or isinstance(buffers, dict)
         assert key_bindings_registry is None or isinstance(key_bindings_registry, Registry)
@@ -103,19 +109,14 @@ class Application(object):
         assert on_reset is None or isinstance(on_reset, Callback)
         assert on_buffer_changed is None or isinstance(on_buffer_changed, Callback)
         assert on_initialize is None or isinstance(on_initialize, Callback)
-        assert not (style and get_style)
+        assert style is None or isinstance(style, Style)
 
         self.layout = layout or Window(BufferControl())
         self.buffer = buffer or Buffer(accept_action=AcceptAction.RETURN_DOCUMENT)
         self.buffers = buffers or {}
         self.initial_focussed_buffer = initial_focussed_buffer
 
-        if style:
-            self.get_style = lambda: style
-        elif get_style:
-            self.get_style = get_style
-        else:
-            self.get_style = lambda: DefaultStyle
+        self.style = style or PygmentsStyle(DefaultStyle)
 
         if key_bindings_registry is None:
             key_bindings_registry = Registry()
diff --git a/prompt_toolkit/auto_suggest.py b/prompt_toolkit/auto_suggest.py
index 73ad937..1d51305 100644
--- a/prompt_toolkit/auto_suggest.py
+++ b/prompt_toolkit/auto_suggest.py
@@ -1,12 +1,10 @@
 """
-Fish-style [0] like auto-suggestion.
+`Fish-style <http://fishshell.com/>`_  like auto-suggestion.
 
 While a user types input in a certain buffer, suggestions are generated
 (asynchronously.) Usually, they are displayed after the input. When the cursor
 presses the right arrow and the cursor is at the end of the input, the
 suggestion will be inserted.
-
-[0] http://fishshell.com/
 """
 from __future__ import unicode_literals
 from abc import ABCMeta, abstractmethod
@@ -25,6 +23,8 @@ __all__ = (
 class Suggestion(object):
     """
     Suggestion returned by an auto-suggest algorithm.
+
+    :param text: The suggestion text.
     """
     def __init__(self, text):
         self.text = text
@@ -40,7 +40,17 @@ class AutoSuggest(with_metaclass(ABCMeta, object)):
     @abstractmethod
     def get_suggestion(self, cli, buffer, document):
         """
-        Return `None` or a `Suggestion` instance.
+        Return `None` or a :class:`.Suggestion` instance.
+
+        We receive both ``buffer`` and ``document``. The reason is that auto
+        suggestions are retrieved asynchronously. (Like completions.) The
+        buffer text could be changed in the meantime, but ``document`` contains
+        the buffer document like it was at the start of the auto suggestion
+        call. So, from here, don't access ``buffer.text``, but use
+        ``document.text`` instead.
+
+        :param buffer: The :class:`~prompt_toolkit.buffer.Buffer` instance.
+        :param document: The :class:`~prompt_toolkit.document.Document` instance.
         """
 
 
diff --git a/prompt_toolkit/buffer.py b/prompt_toolkit/buffer.py
index 9e51e4b..cc935b4 100644
--- a/prompt_toolkit/buffer.py
+++ b/prompt_toolkit/buffer.py
@@ -9,7 +9,7 @@ from .clipboard import ClipboardData
 from .completion import Completer, Completion, CompleteEvent
 from .document import Document
 from .enums import IncrementalSearchDirection
-from .filters import Never, to_simple_filter
+from .filters import to_simple_filter
 from .history import History, InMemoryHistory
 from .search_state import SearchState
 from .selection import SelectionType, SelectionState
@@ -30,7 +30,7 @@ __all__ = (
 )
 
 class EditReadOnlyBuffer(Exception):
-    " Attempt editing of read-only buffer. "
+    " Attempt editing of read-only :class:`.Buffer`. "
 
 
 class AcceptAction(object):
@@ -38,10 +38,12 @@ class AcceptAction(object):
     What to do when the input is accepted by the user.
     (When Enter was pressed in the command line.)
 
-    :param handler: (optional) A callable which accepts a CLI and `Document'
-                    that is called when the user accepts input.
+    :param handler: (optional) A callable which takes a
+        :class:`~prompt_toolkit.interface.CommandLineInterface` and
+        :class:`~prompt_toolkit.document.Document`. It is called when the user
+        accepts input.
     :param render_cli_done: When using a handler, first render the CLI in the
-                    'done' state, then call the handler. This
+        'done' state, then call the handler. This
     """
     def __init__(self, handler=None):
         assert handler is None or callable(handler)
@@ -50,7 +52,8 @@ class AcceptAction(object):
     @classmethod
     def run_in_terminal(cls, handler, render_cli_done=False):
         """
-        Create an `AcceptAction` that runs the given handler in the terminal.
+        Create an :class:`.AcceptAction` that runs the given handler in the
+        terminal.
 
         :param render_cli_done: When True, render the interface in the 'Done'
                 state first, then execute the function. If False, erase the
@@ -109,7 +112,7 @@ class CompletionState(object):
 
     def go_to_index(self, index):
         """
-        Create a new CompletionState object with the new index.
+        Create a new :class:`.CompletionState` object with the new index.
         """
         return CompletionState(self.original_document, self.current_completions, complete_index=index)
 
@@ -149,32 +152,38 @@ class Buffer(object):
     current input line and implements all text manupulations on top of it. It
     also implements the history, undo stack and the completion state.
 
-    :attr completer : :class:`~prompt_toolkit.completion.Completer` instance.
-    :attr history: :class:`~prompt_toolkit.history.History` instance.
-    :attr callbacks: :class:`~.Callbacks` instance.
-
-    :attr tempfile_suffix: Suffix to be appended to the tempfile for the 'open
+    :param completer: :class:`~prompt_toolkit.completion.Completer` instance.
+    :param history: :class:`~prompt_toolkit.history.History` instance.
+    :param tempfile_suffix: Suffix to be appended to the tempfile for the 'open
                            in editor' function.
-    :attr is_multiline: SimpleFilter to indicate whether we should consider
-                        this buffer a multiline input. If so, key bindings can
-                        decide to insert newlines when pressing [Enter].
-                        (Instead of accepting the input.)
-    :param complete_while_typing: Filter instance. Decide whether or not to do
-                                  asynchronous autocompleting while typing.
+
+    Events:
 
     :param on_text_changed: Callback instance or None.
     :param on_text_insert: Callback instance or None.
     :param on_cursor_position_changed: Callback instance or None.
-    :param enable_history_search: SimpleFilter to indicate when up-arrow partial
-        string matching is enabled. It is adviced to not enable this at the
-        same time as `complete_while_typing`, because when there is an
-        autocompletion found, the up arrows usually browse through the
-        completions, rather than through the history.
+
+    Filters:
+
+    :param is_multiline: :class:`~prompt_toolkit.filters.SimpleFilter` to
+        indicate whether we should consider this buffer a multiline input. If
+        so, key bindings can decide to insert newlines when pressing [Enter].
+        (Instead of accepting the input.)
+    :param complete_while_typing: :class:`~prompt_toolkit.filters.SimpleFilter`
+        instance. Decide whether or not to do asynchronous autocompleting while
+        typing.
+    :param enable_history_search: :class:`~prompt_toolkit.filters.SimpleFilter`
+        to indicate when up-arrow partial string matching is enabled. It is
+        adviced to not enable this at the same time as `complete_while_typing`,
+        because when there is an autocompletion found, the up arrows usually
+        browse through the completions, rather than through the history.
+    :param read_only: :class:`~prompt_toolkit.filters.SimpleFilter`. When True,
+        changes will not be allowed.
     """
     def __init__(self, completer=None, auto_suggest=None, history=None,
                  validator=None, tempfile_suffix='',
-                 is_multiline=Never(), complete_while_typing=Never(),
-                 enable_history_search=Never(), initial_document=None,
+                 is_multiline=False, complete_while_typing=False,
+                 enable_history_search=False, initial_document=None,
                  accept_action=AcceptAction.IGNORE, read_only=False,
                  on_text_changed=None, on_text_insert=None, on_cursor_position_changed=None):
 
@@ -353,15 +362,15 @@ class Buffer(object):
     @property
     def document(self):
         """
-        Return :class:`Document` instance from the current text and cursor
-        position.
+        Return :class:`~prompt_toolkit.document.Document` instance from the
+        current text and cursor position.
         """
         return Document(self.text, self.cursor_position, selection=self.selection_state)
 
     @document.setter
     def document(self, value):
         """
-        Set :class:`Document` instance.
+        Set :class:`~prompt_toolkit.document.Document` instance.
 
         This will set both the text and cursor position at the same time, but
         atomically. (Change events will be triggered only after both have been set.)
@@ -370,11 +379,12 @@ class Buffer(object):
 
     def set_document(self, value, bypass_readonly=False):
         """
-        Set :class:`Document` instance. Like the `document` property, but
-        accept an `bypass_readonly` argument.
+        Set :class:`~prompt_toolkit.document.Document` instance. Like the
+        ``document`` property, but accept an ``bypass_readonly`` argument.
 
-        :param bypass_readonly: When True, don't raise an `EditReadOnlyBuffer`
-                                exception, even when the buffer is read-only.
+        :param bypass_readonly: When True, don't raise an
+                                :class:`.EditReadOnlyBuffer` exception, even
+                                when the buffer is read-only.
         """
         assert isinstance(value, Document)
 
@@ -444,10 +454,10 @@ class Buffer(object):
         """
         Transform a part of the input string.
 
-        :param :from_: (int) start position.
-        :param :to: (int) end position.
-        :param :transform_callback: Callable which accepts a string and returns
-                                    the transformed string.
+        :param from_: (int) start position.
+        :param to: (int) end position.
+        :param transform_callback: Callable which accepts a string and returns
+            the transformed string.
         """
         assert from_ < to
 
@@ -739,7 +749,7 @@ class Buffer(object):
         Move forwards through the history.
 
         :param count: Amount of items to move forward.
-        :param history_search: When True, filter history using self.history_search_text.
+        :param history_search: When True, filter history using ``self.history_search_text``.
         """
         self._set_history_search()
 
@@ -788,7 +798,7 @@ class Buffer(object):
 
     def copy_selection(self, _cut=False):
         """
-        Copy selected text and return :class:`ClipboardData` instance.
+        Copy selected text and return :class:`.ClipboardData` instance.
         """
         if self.selection_state:
             type = self.selection_state.type
@@ -810,7 +820,7 @@ class Buffer(object):
 
     def cut_selection(self):
         """
-        Delete selected text and return :class:`ClipboardData` instance.
+        Delete selected text and return :class:`.ClipboardData` instance.
         """
         return self.copy_selection(_cut=True)
 
@@ -1028,8 +1038,8 @@ class Buffer(object):
 
     def document_for_search(self, search_state):
         """
-        Return a `Document` instance that has the text/cursor position for this
-        search, if we would apply it.
+        Return a :class:`~prompt_toolkit.document.Document` instance that has
+        the text/cursor position for this search, if we would apply it.
         """
         search_result = self._search(search_state, include_current_position=True)
 
@@ -1041,8 +1051,8 @@ class Buffer(object):
 
     def apply_search(self, search_state, include_current_position=True, count=1):
         """
-        Return a `Document` instance that has the text/cursor position for this
-        search, if we would apply it.
+        Apply search. If something is found, set `working_index` and
+        `cursor_position`.
         """
         search_result = self._search(search_state,
             include_current_position=include_current_position, count=count)
@@ -1059,7 +1069,8 @@ class Buffer(object):
         """
         Open code in editor.
 
-        :param cli: `CommandLineInterface` instance.
+        :param cli: :class:`~prompt_toolkit.interface.CommandLineInterface`
+            instance.
         """
         if self.read_only():
             raise EditReadOnlyBuffer()
@@ -1128,7 +1139,7 @@ class Buffer(object):
 
 def indent(buffer, from_row, to_row, count=1):
     """
-    Indent text of the `Buffer` object.
+    Indent text of a :class:`.Buffer` object.
     """
     current_row = buffer.document.cursor_position_row
     line_range = range(from_row, to_row)
@@ -1145,7 +1156,7 @@ def indent(buffer, from_row, to_row, count=1):
 
 def unindent(buffer, from_row, to_row, count=1):
     """
-    Unindent text of the `Buffer` object.
+    Unindent text of a :class:`.Buffer` object.
     """
     current_row = buffer.document.cursor_position_row
     line_range = range(from_row, to_row)
diff --git a/prompt_toolkit/clipboard/base.py b/prompt_toolkit/clipboard/base.py
index 8dad4d4..34a0140 100644
--- a/prompt_toolkit/clipboard/base.py
+++ b/prompt_toolkit/clipboard/base.py
@@ -19,7 +19,7 @@ class ClipboardData(object):
     Text on the clipboard.
 
     :param text: string
-    :param type: :class:`~.ClipboardDataType`
+    :param type: :class:`~prompt_toolkit.selection.SelectionType`
     """
     def __init__(self, text='', type=SelectionType.CHARACTERS):
         assert isinstance(text, six.string_types)
diff --git a/prompt_toolkit/completion.py b/prompt_toolkit/completion.py
index 9c6b380..ede5b96 100644
--- a/prompt_toolkit/completion.py
+++ b/prompt_toolkit/completion.py
@@ -7,25 +7,26 @@ from six import with_metaclass
 __all__ = (
     'Completion',
     'Completer',
+    'CompleteEvent',
     'get_common_complete_suffix',
 )
 
 
 class Completion(object):
+    """
+    :param text: The new string that will be inserted into the document.
+    :param start_position: Position relative to the cursor_position where the
+        new text will start. The text will be inserted between the
+        start_position and the original cursor position.
+    :param display: (optional string) If the completion has to be displayed
+        differently in the completion menu.
+    :param display_meta: (Optional string) Meta information about the
+        completion, e.g. the path or source where it's coming from.
+    :param get_display_meta: Lazy `display_meta`. Retrieve meta information
+        only when meta is displayed.
+    """
     def __init__(self, text, start_position=0, display=None, display_meta=None,
                  get_display_meta=None):
-        """
-        :param text: The new string that will be inserted into the document.
-        :param start_position: Position relative to the cursor_position where the
-            new text will start. The text will be inserted between the
-            start_position and the original cursor position.
-        :param display: (optional string) If the completion has to be displayed
-            differently in the completion menu.
-        :param display_meta: (Optional string) Meta information about the
-            completion, e.g. the path or source where it's coming from.
-        :param get_display_meta: Lazy `display_meta`. Retrieve meta information
-            only when meta is displayed.
-        """
         self.text = text
         self.start_position = start_position
         self._display_meta = display_meta
@@ -101,7 +102,10 @@ class Completer(with_metaclass(ABCMeta, object)):
     @abstractmethod
     def get_completions(self, document, complete_event):
         """
-        Yield `Completion` instances.
+        Yield :class:`.Completion` instances.
+
+        :param document: :class:`~prompt_toolkit.document.Document` instance.
+        :param complete_event: :class:`.CompleteEvent` instance.
         """
         while False:
             yield
diff --git a/prompt_toolkit/contrib/completers/filesystem.py b/prompt_toolkit/contrib/completers/filesystem.py
index 5244802..2b392e4 100644
--- a/prompt_toolkit/contrib/completers/filesystem.py
+++ b/prompt_toolkit/contrib/completers/filesystem.py
@@ -42,6 +42,10 @@ class PathCompleter(Completer):
             return
 
         try:
+            # Do tilde expansion.
+            if self.expanduser:
+                text = os.path.expanduser(text)
+
             # Directories where to look.
             dirname = os.path.dirname(text)
             if dirname:
@@ -56,10 +60,6 @@ class PathCompleter(Completer):
             # Get all filenames.
             filenames = []
             for directory in directories:
-                # Do tilde expansion.
-                if self.expanduser:
-                    directory = os.path.expanduser(directory)
-
                 # Look for matches in this directory.
                 if os.path.isdir(directory):
                     for filename in os.listdir(directory):
diff --git a/prompt_toolkit/contrib/ipython.py b/prompt_toolkit/contrib/ipython.py
deleted file mode 100644
index 927beb5..0000000
--- a/prompt_toolkit/contrib/ipython.py
+++ /dev/null
@@ -1,21 +0,0 @@
-"""
-DEPRECATED.
-"""
-from __future__ import unicode_literals
-
-__all__ = ('embed', )
-
-
-# We have this for compatibility with older versions of:
-# django_extensions.management.commands.shell_plus
-try:
-    import ptpython.ipython
-
... 2945 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/prompt-toolkit.git



More information about the Python-modules-commits mailing list