[Python-modules-commits] [python-blessed] 01/07: Imported Upstream version 1.14.1

ChangZhuo Chen czchen at moszumanska.debian.org
Mon May 9 11:16:51 UTC 2016


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

czchen pushed a commit to branch master
in repository python-blessed.

commit fe6c0dbd3b113c06f9364a1f2ad53a7266e2fccf
Author: ChangZhuo Chen (陳昌倬) <czchen at debian.org>
Date:   Mon May 9 18:51:22 2016 +0800

    Imported Upstream version 1.14.1
---
 .coveragerc                           |   14 +
 LICENSE                               |   20 +
 MANIFEST.in                           |    7 +
 PKG-INFO                              |  206 ++++++
 README.rst                            |  178 +++++
 blessed.egg-info/PKG-INFO             |  206 ++++++
 blessed.egg-info/SOURCES.txt          |   43 ++
 blessed.egg-info/dependency_links.txt |    1 +
 blessed.egg-info/requires.txt         |    2 +
 blessed.egg-info/top_level.txt        |    1 +
 blessed.egg-info/zip-safe             |    1 +
 blessed/__init__.py                   |   18 +
 blessed/_capabilities.py              |  169 +++++
 blessed/formatters.py                 |  419 ++++++++++++
 blessed/keyboard.py                   |  451 +++++++++++++
 blessed/sequences.py                  |  433 ++++++++++++
 blessed/terminal.py                   | 1194 +++++++++++++++++++++++++++++++++
 blessed/tests/__init__.py             |    0
 blessed/tests/accessories.py          |  248 +++++++
 blessed/tests/test_core.py            |  492 ++++++++++++++
 blessed/tests/test_formatters.py      |  436 ++++++++++++
 blessed/tests/test_keyboard.py        |  931 +++++++++++++++++++++++++
 blessed/tests/test_length_sequence.py |  429 ++++++++++++
 blessed/tests/test_sequences.py       |  522 ++++++++++++++
 blessed/tests/test_wrap.py            |  139 ++++
 blessed/tests/wall.ans                |    7 +
 docs/api.rst                          |   43 ++
 docs/contributing.rst                 |   62 ++
 docs/examples.rst                     |   89 +++
 docs/further.rst                      |  104 +++
 docs/history.rst                      |  235 +++++++
 docs/index.rst                        |   25 +
 docs/intro.rst                        |  178 +++++
 docs/overview.rst                     |  599 +++++++++++++++++
 docs/pains.rst                        |  342 ++++++++++
 requirements-about.txt                |    1 +
 requirements-analysis.txt             |    3 +
 requirements-docs.txt                 |    3 +
 requirements-tests.txt                |    4 +
 requirements.txt                      |    2 +
 setup.cfg                             |    8 +
 setup.py                              |   69 ++
 tox.ini                               |   77 +++
 version.json                          |    1 +
 44 files changed, 8412 insertions(+)

diff --git a/.coveragerc b/.coveragerc
new file mode 100644
index 0000000..de699ea
--- /dev/null
+++ b/.coveragerc
@@ -0,0 +1,14 @@
+[run]
+branch = True
+source = blessed
+parallel = True
+
+[report]
+omit = blessed/tests/*
+exclude_lines = pragma: no cover
+precision = 1
+
+[paths]
+source =
+    blessed/
+    /opt/TeamCity/*/blessed/*.py
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..4b07132
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2014 Jeff Quast
+Copyright (c) 2011 Erik Rose
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..f6fd7f2
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,7 @@
+include docs/*.rst
+include LICENSE
+include version.json
+include *.txt
+include .coveragerc
+include tox.ini
+include blessed/tests/wall.ans
diff --git a/PKG-INFO b/PKG-INFO
new file mode 100644
index 0000000..1853883
--- /dev/null
+++ b/PKG-INFO
@@ -0,0 +1,206 @@
+Metadata-Version: 1.1
+Name: blessed
+Version: 1.14.1
+Summary: A thin, practical wrapper around terminal styling, screen positioning, and keyboard input.
+Home-page: https://github.com/jquast/blessed
+Author: Jeff Quast, Erik Rose
+Author-email: contact at jeffquast.com
+License: MIT
+Description: .. image:: https://img.shields.io/travis/jquast/blessed/master.svg
+            :alt: Travis Continuous Integration
+            :target: https://travis-ci.org/jquast/blessed/
+        
+        .. image:: https://img.shields.io/teamcity/https/teamcity-master.pexpect.org/s/Blessed_BuildHead.svg
+            :alt: TeamCity Build status
+            :target: https://teamcity-master.pexpect.org/viewType.html?buildTypeId=Blessed_BuildHead&branch_Blessed=%3Cdefault%3E&tab=buildTypeStatusDiv
+        
+        .. image:: https://coveralls.io/repos/jquast/blessed/badge.svg?branch=master&service=github
+            :alt: Coveralls Code Coverage
+            :target: https://coveralls.io/github/jquast/blessed?branch=master
+        
+        .. image:: https://img.shields.io/pypi/v/blessed.svg
+            :alt: Latest Version
+            :target: https://pypi.python.org/pypi/blessed
+        
+        .. image:: https://img.shields.io/pypi/dm/blessed.svg
+            :alt: Downloads
+            :target: https://pypi.python.org/pypi/blessed
+        
+        .. image:: https://badges.gitter.im/Join%20Chat.svg
+            :alt: Join Chat
+            :target: https://gitter.im/jquast/blessed
+        
+        Introduction
+        ============
+        
+        Blessed is a thin, practical wrapper around terminal capabilities in Python.
+        
+        Coding with *Blessed* looks like this... ::
+        
+            from blessed import Terminal
+        
+            t = Terminal()
+        
+            print(t.bold('Hi there!'))
+            print(t.bold_red_on_bright_green('It hurts my eyes!'))
+        
+            with t.location(0, t.height - 1):
+                print(t.center(t.blink('press any key to continue.')))
+        
+            with t.cbreak():
+                inp = t.inkey()
+            print('You pressed ' + repr(inp))
+        
+        
+        Brief Overview
+        --------------
+        
+        *Blessed* is a more simplified wrapper around curses_, providing :
+        
+        * Styles, color, and maybe a little positioning without necessarily
+          clearing the whole screen first.
+        * Works great with standard Python string formatting.
+        * Provides up-to-the-moment terminal height and width, so you can respond to
+          terminal size changes.
+        * Avoids making a mess if the output gets piped to a non-terminal:
+          outputs to any file-like object such as *StringIO*, files, or pipes.
+        * Uses the `terminfo(5)`_ database so it works with any terminal type
+          and supports any terminal capability: No more C-like calls to tigetstr_
+          and tparm_.
+        * Keeps a minimum of internal state, so you can feel free to mix and match with
+          calls to curses or whatever other terminal libraries you like.
+        * Provides plenty of context managers to safely express terminal modes,
+          automatically restoring the terminal to a safe state on exit.
+        * Act intelligently when somebody redirects your output to a file, omitting
+          all of the terminal sequences such as styling, colors, or positioning.
+        * Dead-simple keyboard handling: safely decoding unicode input in your
+          system's preferred locale and supports application/arrow keys.
+        * Allows the printable length of strings containing sequences to be
+          determined.
+        
+        Blessed **does not** provide...
+        
+        * Windows command prompt support.  A PDCurses_ build of python for windows
+          provides only partial support at this time -- there are plans to merge with
+          the ansi_ module in concert with colorama_ to resolve this.  `Patches
+          welcome <https://github.com/jquast/blessed/issues/18>`_!
+        
+        
+        Before And After
+        ----------------
+        
+        With the built-in curses_ module, this is how you would typically
+        print some underlined text at the bottom of the screen::
+        
+            from curses import tigetstr, setupterm, tparm
+            from fcntl import ioctl
+            from os import isatty
+            import struct
+            import sys
+            from termios import TIOCGWINSZ
+        
+            # If we want to tolerate having our output piped to other commands or
+            # files without crashing, we need to do all this branching:
+            if hasattr(sys.stdout, 'fileno') and isatty(sys.stdout.fileno()):
+                setupterm()
+                sc = tigetstr('sc')
+                cup = tigetstr('cup')
+                rc = tigetstr('rc')
+                underline = tigetstr('smul')
+                normal = tigetstr('sgr0')
+            else:
+                sc = cup = rc = underline = normal = ''
+        
+            # Save cursor position.
+            print(sc)
+        
+            if cup:
+                # tigetnum('lines') doesn't always update promptly, hence this:
+                height = struct.unpack('hhhh', ioctl(0, TIOCGWINSZ, '\000' * 8))[0]
+        
+                # Move cursor to bottom.
+                print(tparm(cup, height - 1, 0))
+        
+            print('This is {under}underlined{normal}!'
+                  .format(under=underline, normal=normal))
+        
+            # Restore cursor position.
+            print(rc)
+        
+        The same program with *Blessed* is simply::
+        
+            from blessed import Terminal
+        
+            term = Terminal()
+            with term.location(0, term.height - 1):
+                print('This is' + term.underline('underlined') + '!')
+        
+        Requirements
+        ------------
+        
+        *Blessed* is tested with Python 2.7, 3.4, and 3.5 on Debian Linux, Mac, and
+        FreeBSD.
+        
+        Further Documentation
+        ---------------------
+        
+        More documentation can be found at http://blessed.readthedocs.org/en/latest/
+        
+        Bugs, Contributing, Support
+        ---------------------------
+        
+        **Bugs** or suggestions? Visit the `issue tracker`_ and file an issue.
+        We welcome your bug reports and feature suggestions!
+        
+        Would you like to **contribute**?  That's awesome!  We've written a
+        `guide <http://blessed.readthedocs.org/en/latest/contributing.html>`_
+        to help you.
+        
+        Are you stuck and need **support**?  Give `stackoverflow`_ a try.  If
+        you're still having trouble, we'd like to hear about it!  Open an issue
+        in the `issue tracker`_ with a well-formed question.
+        
+        License
+        -------
+        
+        *Blessed* is under the MIT License. See the LICENSE file.
+        
+        Forked
+        ------
+        
+        *Blessed* is a fork of `blessings <https://github.com/erikrose/blessings>`_.
+        Changes since 1.7 have all been proposed but unaccepted upstream.
+        
+        Furthermore, a project in the node.js language of the `same name
+        <https://github.com/chjj/blessed>`_ is **not** related, or a fork
+        of each other in any way.
+        
+        .. _`issue tracker`: https://github.com/jquast/blessed/issues/
+        .. _curses: https://docs.python.org/3/library/curses.html
+        .. _tigetstr: http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man3/tigetstr.3
+        .. _tparm: http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man3/tparm.3
+        .. _ansi: https://github.com/tehmaze/ansi
+        .. _colorama: https://pypi.python.org/pypi/colorama
+        .. _PDCurses: http://www.lfd.uci.edu/~gohlke/pythonlibs/#curses
+        .. _`terminfo(5)`: http://invisible-island.net/ncurses/man/terminfo.5.html
+        .. _`stackoverflow`: http://stackoverflow.com/
+        
+Keywords: terminal,sequences,tty,curses,ncurses,formatting,style,color,console,keyboard,ansi,xterm
+Platform: UNKNOWN
+Classifier: Intended Audience :: Developers
+Classifier: Natural Language :: English
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Environment :: Console
+Classifier: Environment :: Console :: Curses
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Operating System :: POSIX
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.6
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.2
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Topic :: Software Development :: Libraries
+Classifier: Topic :: Software Development :: User Interfaces
+Classifier: Topic :: Terminals
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..ddd957d
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,178 @@
+.. image:: https://img.shields.io/travis/jquast/blessed/master.svg
+    :alt: Travis Continuous Integration
+    :target: https://travis-ci.org/jquast/blessed/
+
+.. image:: https://img.shields.io/teamcity/https/teamcity-master.pexpect.org/s/Blessed_BuildHead.svg
+    :alt: TeamCity Build status
+    :target: https://teamcity-master.pexpect.org/viewType.html?buildTypeId=Blessed_BuildHead&branch_Blessed=%3Cdefault%3E&tab=buildTypeStatusDiv
+
+.. image:: https://coveralls.io/repos/jquast/blessed/badge.svg?branch=master&service=github
+    :alt: Coveralls Code Coverage
+    :target: https://coveralls.io/github/jquast/blessed?branch=master
+
+.. image:: https://img.shields.io/pypi/v/blessed.svg
+    :alt: Latest Version
+    :target: https://pypi.python.org/pypi/blessed
+
+.. image:: https://img.shields.io/pypi/dm/blessed.svg
+    :alt: Downloads
+    :target: https://pypi.python.org/pypi/blessed
+
+.. image:: https://badges.gitter.im/Join%20Chat.svg
+    :alt: Join Chat
+    :target: https://gitter.im/jquast/blessed
+
+Introduction
+============
+
+Blessed is a thin, practical wrapper around terminal capabilities in Python.
+
+Coding with *Blessed* looks like this... ::
+
+    from blessed import Terminal
+
+    t = Terminal()
+
+    print(t.bold('Hi there!'))
+    print(t.bold_red_on_bright_green('It hurts my eyes!'))
+
+    with t.location(0, t.height - 1):
+        print(t.center(t.blink('press any key to continue.')))
+
+    with t.cbreak():
+        inp = t.inkey()
+    print('You pressed ' + repr(inp))
+
+
+Brief Overview
+--------------
+
+*Blessed* is a more simplified wrapper around curses_, providing :
+
+* Styles, color, and maybe a little positioning without necessarily
+  clearing the whole screen first.
+* Works great with standard Python string formatting.
+* Provides up-to-the-moment terminal height and width, so you can respond to
+  terminal size changes.
+* Avoids making a mess if the output gets piped to a non-terminal:
+  outputs to any file-like object such as *StringIO*, files, or pipes.
+* Uses the `terminfo(5)`_ database so it works with any terminal type
+  and supports any terminal capability: No more C-like calls to tigetstr_
+  and tparm_.
+* Keeps a minimum of internal state, so you can feel free to mix and match with
+  calls to curses or whatever other terminal libraries you like.
+* Provides plenty of context managers to safely express terminal modes,
+  automatically restoring the terminal to a safe state on exit.
+* Act intelligently when somebody redirects your output to a file, omitting
+  all of the terminal sequences such as styling, colors, or positioning.
+* Dead-simple keyboard handling: safely decoding unicode input in your
+  system's preferred locale and supports application/arrow keys.
+* Allows the printable length of strings containing sequences to be
+  determined.
+
+Blessed **does not** provide...
+
+* Windows command prompt support.  A PDCurses_ build of python for windows
+  provides only partial support at this time -- there are plans to merge with
+  the ansi_ module in concert with colorama_ to resolve this.  `Patches
+  welcome <https://github.com/jquast/blessed/issues/18>`_!
+
+
+Before And After
+----------------
+
+With the built-in curses_ module, this is how you would typically
+print some underlined text at the bottom of the screen::
+
+    from curses import tigetstr, setupterm, tparm
+    from fcntl import ioctl
+    from os import isatty
+    import struct
+    import sys
+    from termios import TIOCGWINSZ
+
+    # If we want to tolerate having our output piped to other commands or
+    # files without crashing, we need to do all this branching:
+    if hasattr(sys.stdout, 'fileno') and isatty(sys.stdout.fileno()):
+        setupterm()
+        sc = tigetstr('sc')
+        cup = tigetstr('cup')
+        rc = tigetstr('rc')
+        underline = tigetstr('smul')
+        normal = tigetstr('sgr0')
+    else:
+        sc = cup = rc = underline = normal = ''
+
+    # Save cursor position.
+    print(sc)
+
+    if cup:
+        # tigetnum('lines') doesn't always update promptly, hence this:
+        height = struct.unpack('hhhh', ioctl(0, TIOCGWINSZ, '\000' * 8))[0]
+
+        # Move cursor to bottom.
+        print(tparm(cup, height - 1, 0))
+
+    print('This is {under}underlined{normal}!'
+          .format(under=underline, normal=normal))
+
+    # Restore cursor position.
+    print(rc)
+
+The same program with *Blessed* is simply::
+
+    from blessed import Terminal
+
+    term = Terminal()
+    with term.location(0, term.height - 1):
+        print('This is' + term.underline('underlined') + '!')
+
+Requirements
+------------
+
+*Blessed* is tested with Python 2.7, 3.4, and 3.5 on Debian Linux, Mac, and
+FreeBSD.
+
+Further Documentation
+---------------------
+
+More documentation can be found at http://blessed.readthedocs.org/en/latest/
+
+Bugs, Contributing, Support
+---------------------------
+
+**Bugs** or suggestions? Visit the `issue tracker`_ and file an issue.
+We welcome your bug reports and feature suggestions!
+
+Would you like to **contribute**?  That's awesome!  We've written a
+`guide <http://blessed.readthedocs.org/en/latest/contributing.html>`_
+to help you.
+
+Are you stuck and need **support**?  Give `stackoverflow`_ a try.  If
+you're still having trouble, we'd like to hear about it!  Open an issue
+in the `issue tracker`_ with a well-formed question.
+
+License
+-------
+
+*Blessed* is under the MIT License. See the LICENSE file.
+
+Forked
+------
+
+*Blessed* is a fork of `blessings <https://github.com/erikrose/blessings>`_.
+Changes since 1.7 have all been proposed but unaccepted upstream.
+
+Furthermore, a project in the node.js language of the `same name
+<https://github.com/chjj/blessed>`_ is **not** related, or a fork
+of each other in any way.
+
+.. _`issue tracker`: https://github.com/jquast/blessed/issues/
+.. _curses: https://docs.python.org/3/library/curses.html
+.. _tigetstr: http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man3/tigetstr.3
+.. _tparm: http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man3/tparm.3
+.. _ansi: https://github.com/tehmaze/ansi
+.. _colorama: https://pypi.python.org/pypi/colorama
+.. _PDCurses: http://www.lfd.uci.edu/~gohlke/pythonlibs/#curses
+.. _`terminfo(5)`: http://invisible-island.net/ncurses/man/terminfo.5.html
+.. _`stackoverflow`: http://stackoverflow.com/
diff --git a/blessed.egg-info/PKG-INFO b/blessed.egg-info/PKG-INFO
new file mode 100644
index 0000000..1853883
--- /dev/null
+++ b/blessed.egg-info/PKG-INFO
@@ -0,0 +1,206 @@
+Metadata-Version: 1.1
+Name: blessed
+Version: 1.14.1
+Summary: A thin, practical wrapper around terminal styling, screen positioning, and keyboard input.
+Home-page: https://github.com/jquast/blessed
+Author: Jeff Quast, Erik Rose
+Author-email: contact at jeffquast.com
+License: MIT
+Description: .. image:: https://img.shields.io/travis/jquast/blessed/master.svg
+            :alt: Travis Continuous Integration
+            :target: https://travis-ci.org/jquast/blessed/
+        
+        .. image:: https://img.shields.io/teamcity/https/teamcity-master.pexpect.org/s/Blessed_BuildHead.svg
+            :alt: TeamCity Build status
+            :target: https://teamcity-master.pexpect.org/viewType.html?buildTypeId=Blessed_BuildHead&branch_Blessed=%3Cdefault%3E&tab=buildTypeStatusDiv
+        
+        .. image:: https://coveralls.io/repos/jquast/blessed/badge.svg?branch=master&service=github
+            :alt: Coveralls Code Coverage
+            :target: https://coveralls.io/github/jquast/blessed?branch=master
+        
+        .. image:: https://img.shields.io/pypi/v/blessed.svg
+            :alt: Latest Version
+            :target: https://pypi.python.org/pypi/blessed
+        
+        .. image:: https://img.shields.io/pypi/dm/blessed.svg
+            :alt: Downloads
+            :target: https://pypi.python.org/pypi/blessed
+        
+        .. image:: https://badges.gitter.im/Join%20Chat.svg
+            :alt: Join Chat
+            :target: https://gitter.im/jquast/blessed
+        
+        Introduction
+        ============
+        
+        Blessed is a thin, practical wrapper around terminal capabilities in Python.
+        
+        Coding with *Blessed* looks like this... ::
+        
+            from blessed import Terminal
+        
+            t = Terminal()
+        
+            print(t.bold('Hi there!'))
+            print(t.bold_red_on_bright_green('It hurts my eyes!'))
+        
+            with t.location(0, t.height - 1):
+                print(t.center(t.blink('press any key to continue.')))
+        
+            with t.cbreak():
+                inp = t.inkey()
+            print('You pressed ' + repr(inp))
+        
+        
+        Brief Overview
+        --------------
+        
+        *Blessed* is a more simplified wrapper around curses_, providing :
+        
+        * Styles, color, and maybe a little positioning without necessarily
+          clearing the whole screen first.
+        * Works great with standard Python string formatting.
+        * Provides up-to-the-moment terminal height and width, so you can respond to
+          terminal size changes.
+        * Avoids making a mess if the output gets piped to a non-terminal:
+          outputs to any file-like object such as *StringIO*, files, or pipes.
+        * Uses the `terminfo(5)`_ database so it works with any terminal type
+          and supports any terminal capability: No more C-like calls to tigetstr_
+          and tparm_.
+        * Keeps a minimum of internal state, so you can feel free to mix and match with
+          calls to curses or whatever other terminal libraries you like.
+        * Provides plenty of context managers to safely express terminal modes,
+          automatically restoring the terminal to a safe state on exit.
+        * Act intelligently when somebody redirects your output to a file, omitting
+          all of the terminal sequences such as styling, colors, or positioning.
+        * Dead-simple keyboard handling: safely decoding unicode input in your
+          system's preferred locale and supports application/arrow keys.
+        * Allows the printable length of strings containing sequences to be
+          determined.
+        
+        Blessed **does not** provide...
+        
+        * Windows command prompt support.  A PDCurses_ build of python for windows
+          provides only partial support at this time -- there are plans to merge with
+          the ansi_ module in concert with colorama_ to resolve this.  `Patches
+          welcome <https://github.com/jquast/blessed/issues/18>`_!
+        
+        
+        Before And After
+        ----------------
+        
+        With the built-in curses_ module, this is how you would typically
+        print some underlined text at the bottom of the screen::
+        
+            from curses import tigetstr, setupterm, tparm
+            from fcntl import ioctl
+            from os import isatty
+            import struct
+            import sys
+            from termios import TIOCGWINSZ
+        
+            # If we want to tolerate having our output piped to other commands or
+            # files without crashing, we need to do all this branching:
+            if hasattr(sys.stdout, 'fileno') and isatty(sys.stdout.fileno()):
+                setupterm()
+                sc = tigetstr('sc')
+                cup = tigetstr('cup')
+                rc = tigetstr('rc')
+                underline = tigetstr('smul')
+                normal = tigetstr('sgr0')
+            else:
+                sc = cup = rc = underline = normal = ''
+        
+            # Save cursor position.
+            print(sc)
+        
+            if cup:
+                # tigetnum('lines') doesn't always update promptly, hence this:
+                height = struct.unpack('hhhh', ioctl(0, TIOCGWINSZ, '\000' * 8))[0]
+        
+                # Move cursor to bottom.
+                print(tparm(cup, height - 1, 0))
+        
+            print('This is {under}underlined{normal}!'
+                  .format(under=underline, normal=normal))
+        
+            # Restore cursor position.
+            print(rc)
+        
+        The same program with *Blessed* is simply::
+        
+            from blessed import Terminal
+        
+            term = Terminal()
+            with term.location(0, term.height - 1):
+                print('This is' + term.underline('underlined') + '!')
+        
+        Requirements
+        ------------
+        
+        *Blessed* is tested with Python 2.7, 3.4, and 3.5 on Debian Linux, Mac, and
+        FreeBSD.
+        
+        Further Documentation
+        ---------------------
+        
+        More documentation can be found at http://blessed.readthedocs.org/en/latest/
+        
+        Bugs, Contributing, Support
+        ---------------------------
+        
+        **Bugs** or suggestions? Visit the `issue tracker`_ and file an issue.
+        We welcome your bug reports and feature suggestions!
+        
+        Would you like to **contribute**?  That's awesome!  We've written a
+        `guide <http://blessed.readthedocs.org/en/latest/contributing.html>`_
+        to help you.
+        
+        Are you stuck and need **support**?  Give `stackoverflow`_ a try.  If
+        you're still having trouble, we'd like to hear about it!  Open an issue
+        in the `issue tracker`_ with a well-formed question.
+        
+        License
+        -------
+        
+        *Blessed* is under the MIT License. See the LICENSE file.
+        
+        Forked
+        ------
+        
+        *Blessed* is a fork of `blessings <https://github.com/erikrose/blessings>`_.
+        Changes since 1.7 have all been proposed but unaccepted upstream.
+        
+        Furthermore, a project in the node.js language of the `same name
+        <https://github.com/chjj/blessed>`_ is **not** related, or a fork
+        of each other in any way.
+        
+        .. _`issue tracker`: https://github.com/jquast/blessed/issues/
+        .. _curses: https://docs.python.org/3/library/curses.html
+        .. _tigetstr: http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man3/tigetstr.3
+        .. _tparm: http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man3/tparm.3
+        .. _ansi: https://github.com/tehmaze/ansi
+        .. _colorama: https://pypi.python.org/pypi/colorama
+        .. _PDCurses: http://www.lfd.uci.edu/~gohlke/pythonlibs/#curses
+        .. _`terminfo(5)`: http://invisible-island.net/ncurses/man/terminfo.5.html
+        .. _`stackoverflow`: http://stackoverflow.com/
+        
+Keywords: terminal,sequences,tty,curses,ncurses,formatting,style,color,console,keyboard,ansi,xterm
+Platform: UNKNOWN
+Classifier: Intended Audience :: Developers
+Classifier: Natural Language :: English
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Environment :: Console
+Classifier: Environment :: Console :: Curses
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Operating System :: POSIX
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.6
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.2
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Topic :: Software Development :: Libraries
+Classifier: Topic :: Software Development :: User Interfaces
+Classifier: Topic :: Terminals
diff --git a/blessed.egg-info/SOURCES.txt b/blessed.egg-info/SOURCES.txt
new file mode 100644
index 0000000..6b76f4d
--- /dev/null
+++ b/blessed.egg-info/SOURCES.txt
@@ -0,0 +1,43 @@
+.coveragerc
+LICENSE
+MANIFEST.in
+README.rst
+requirements-about.txt
+requirements-analysis.txt
+requirements-docs.txt
+requirements-tests.txt
+requirements.txt
+setup.cfg
+setup.py
+tox.ini
+version.json
+blessed/__init__.py
+blessed/_capabilities.py
+blessed/formatters.py
+blessed/keyboard.py
+blessed/sequences.py
+blessed/terminal.py
+blessed.egg-info/PKG-INFO
+blessed.egg-info/SOURCES.txt
+blessed.egg-info/dependency_links.txt
+blessed.egg-info/requires.txt
+blessed.egg-info/top_level.txt
+blessed.egg-info/zip-safe
+blessed/tests/__init__.py
+blessed/tests/accessories.py
+blessed/tests/test_core.py
+blessed/tests/test_formatters.py
+blessed/tests/test_keyboard.py
+blessed/tests/test_length_sequence.py
+blessed/tests/test_sequences.py
+blessed/tests/test_wrap.py
+blessed/tests/wall.ans
+docs/api.rst
+docs/contributing.rst
+docs/examples.rst
+docs/further.rst
+docs/history.rst
+docs/index.rst
+docs/intro.rst
+docs/overview.rst
+docs/pains.rst
\ No newline at end of file
diff --git a/blessed.egg-info/dependency_links.txt b/blessed.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/blessed.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/blessed.egg-info/requires.txt b/blessed.egg-info/requires.txt
new file mode 100644
index 0000000..10f88fa
--- /dev/null
+++ b/blessed.egg-info/requires.txt
@@ -0,0 +1,2 @@
+wcwidth>=0.1.4
+six>=1.9.0
diff --git a/blessed.egg-info/top_level.txt b/blessed.egg-info/top_level.txt
new file mode 100644
index 0000000..d43de1b
--- /dev/null
+++ b/blessed.egg-info/top_level.txt
@@ -0,0 +1 @@
+blessed
diff --git a/blessed.egg-info/zip-safe b/blessed.egg-info/zip-safe
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/blessed.egg-info/zip-safe
@@ -0,0 +1 @@
+
diff --git a/blessed/__init__.py b/blessed/__init__.py
new file mode 100644
index 0000000..88954e1
--- /dev/null
+++ b/blessed/__init__.py
@@ -0,0 +1,18 @@
+"""
+A thin, practical wrapper around terminal capabilities in Python.
+
+http://pypi.python.org/pypi/blessed
+"""
+# std imports
+import platform as _platform
+
+# local
+from blessed.terminal import Terminal
+
+if ('3', '0', '0') <= _platform.python_version_tuple() < ('3', '2', '2+'):
+    # Good till 3.2.10
+    # Python 3.x < 3.2.3 has a bug in which tparm() erroneously takes a string.
+    raise ImportError('Blessed needs Python 3.2.3 or greater for Python 3 '
+                      'support due to http://bugs.python.org/issue10570.')
+
+__all__ = ('Terminal',)
diff --git a/blessed/_capabilities.py b/blessed/_capabilities.py
new file mode 100644
index 0000000..a4c6d05
--- /dev/null
+++ b/blessed/_capabilities.py
@@ -0,0 +1,169 @@
+"""Terminal capability builder patterns."""
+# std imports
+import re
+
+try:
+    from collections import OrderedDict
+except ImportError:
+    # python 2.6 requires 3rd party library (backport)
+    #
+    # pylint: disable=import-error
+    #         Unable to import 'ordereddict'
+    from ordereddict import OrderedDict
+
+__all__ = (
+    'CAPABILITY_DATABASE',
+    'CAPABILITIES_RAW_MIXIN',
+    'CAPABILITIES_ADDITIVES',
+    'CAPABILITIES_CAUSE_MOVEMENT',
+)
+
+CAPABILITY_DATABASE = OrderedDict((
+    ('bell', ('bel', {})),
+    ('carriage_return', ('cr', {})),
+    ('change_scroll_region', ('csr', {'nparams': 2})),
+    ('clear_all_tabs', ('tbc', {})),
+    ('clear_screen', ('clear', {})),
+    ('clr_bol', ('el1', {})),
+    ('clr_eol', ('el', {})),
+    ('clr_eos', ('clear_eos', {})),
+    ('column_address', ('hpa', {'nparams': 1})),
+    ('cursor_address', ('cup', {'nparams': 2, 'match_grouped': True})),
+    ('cursor_down', ('cud1', {})),
+    ('cursor_home', ('home', {})),
+    ('cursor_invisible', ('civis', {})),
+    ('cursor_left', ('cub1', {})),
+    ('cursor_normal', ('cnorm', {})),
+    ('cursor_report', ('u6', {'nparams': 2, 'match_grouped': True})),
+    ('cursor_right', ('cuf1', {})),
+    ('cursor_up', ('cuu1', {})),
+    ('cursor_visible', ('cvvis', {})),
+    ('delete_character', ('dch1', {})),
+    ('delete_line', ('dl1', {})),
+    ('enter_blink_mode', ('blink', {})),
+    ('enter_bold_mode', ('bold', {})),
+    ('enter_dim_mode', ('dim', {})),
+    ('enter_fullscreen', ('smcup', {})),
+    ('enter_standout_mode', ('standout', {})),
+    ('enter_superscript_mode', ('superscript', {})),
+    ('enter_susimpleript_mode', ('susimpleript', {})),
+    ('enter_underline_mode', ('underline', {})),
+    ('erase_chars', ('ech', {'nparams': 1})),
+    ('exit_alt_charset_mode', ('rmacs', {})),
+    ('exit_am_mode', ('rmam', {})),
+    ('exit_attribute_mode', ('sgr0', {})),
+    ('exit_ca_mode', ('rmcup', {})),
+    ('exit_fullscreen', ('rmcup', {})),
+    ('exit_insert_mode', ('rmir', {})),
+    ('exit_standout_mode', ('rmso', {})),
+    ('exit_underline_mode', ('rmul', {})),
+    ('flash_hook', ('hook', {})),
+    ('flash_screen', ('flash', {})),
+    ('insert_line', ('il1', {})),
+    ('keypad_local', ('rmkx', {})),
+    ('keypad_xmit', ('smkx', {})),
+    ('meta_off', ('rmm', {})),
+    ('meta_on', ('smm', {})),
+    ('orig_pair', ('op', {})),
+    ('parm_down_cursor', ('cud', {'nparams': 1})),
+    ('parm_left_cursor', ('cub', {'nparams': 1, 'match_grouped': True})),
+    ('parm_dch', ('dch', {'nparams': 1})),
+    ('parm_delete_line', ('dl', {'nparams': 1})),
+    ('parm_ich', ('ich', {'nparams': 1})),
+    ('parm_index', ('indn', {'nparams': 1})),
+    ('parm_insert_line', ('il', {'nparams': 1})),
+    ('parm_right_cursor', ('cuf', {'nparams': 1, 'match_grouped': True})),
+    ('parm_rindex', ('rin', {'nparams': 1})),
+    ('parm_up_cursor', ('cuu', {'nparams': 1})),
+    ('print_screen', ('mc0', {})),
+    ('prtr_off', ('mc4', {})),
+    ('prtr_on', ('mc5', {})),
+    ('reset_1string', ('r1', {})),
+    ('reset_2string', ('r2', {})),
+    ('reset_3string', ('r3', {})),
+    ('restore_cursor', ('rc', {})),
+    ('row_address', ('vpa', {'nparams': 1})),
+    ('save_cursor', ('sc', {})),
+    ('scroll_forward', ('ind', {})),
+    ('scroll_reverse', ('rev', {})),
+    ('set0_des_seq', ('s0ds', {})),
+    ('set1_des_seq', ('s1ds', {})),
+    ('set2_des_seq', ('s2ds', {})),
+    ('set3_des_seq', ('s3ds', {})),
+    # this 'color' is deceiving, but often matching, and a better match
+    # than set_a_attributes1 or set_a_foreground.
+    ('color', ('_foreground_color', {'nparams': 1, 'match_any': True,
+                                     'numeric': 1})),
+    ('set_a_foreground', ('color', {'nparams': 1, 'match_any': True,
+                                    'numeric': 1})),
+    ('set_a_background', ('on_color', {'nparams': 1, 'match_any': True,
+                                       'numeric': 1})),
+    ('set_tab', ('hts', {})),
+    ('tab', ('ht', {})),
+    ('italic', ('sitm', {})),
+    ('no_italic', ('sitm', {})),
+))
+
+CAPABILITIES_RAW_MIXIN = {
+    'bell': re.escape('\a'),
+    'carriage_return': re.escape('\r'),
+    'cursor_left': re.escape('\b'),
+    'cursor_report': re.escape('\x1b') + r'\[(\d+)\;(\d+)R',
+    'cursor_right': re.escape('\x1b') + r'\[C',
+    'exit_attribute_mode': re.escape('\x1b') + r'\[m',
+    'parm_left_cursor': re.escape('\x1b') + r'\[(\d+)D',
+    'parm_right_cursor': re.escape('\x1b') + r'\[(\d+)C',
+    'restore_cursor': re.escape(r'\x1b\[u'),
+    'save_cursor': re.escape(r'\x1b\[s'),
+    'scroll_forward': re.escape('\n'),
+    'set0_des_seq': re.escape('\x1b(B'),
+    'tab': re.escape('\t'),
+    # one could get carried away, such as by adding '\x1b#8' (dec tube
+    # alignment test) by reversing basic vt52, ansi, and xterm sequence
+    # parsers.  There is plans to do just that for ANSI.SYS support.
+}
+
+
+CAPABILITIES_ADDITIVES = {
+    'color256': ('color', re.escape('\x1b') + r'\[38;5;(\d+)m'),
+    'shift_in': ('', re.escape('\x0f')),
+    'shift_out': ('', re.escape('\x0e')),
+    # sgr(...) outputs strangely, use the basic ANSI/EMCA-48 codes here.
+    'set_a_attributes1': (
+        'sgr', re.escape('\x1b') + r'\[\d+m'),
+    'set_a_attributes2': (
+        'sgr', re.escape('\x1b') + r'\[\d+\;\d+m'),
+    'set_a_attributes3': (
+        'sgr', re.escape('\x1b') + r'\[\d+\;\d+\;\d+m'),
+    'set_a_attributes4': (
+        'sgr', re.escape('\x1b') + r'\[\d+\;\d+\;\d+\;\d+m'),
+    # this helps where xterm's sgr0 includes set0_des_seq, we'd
+    # rather like to also match this immediate substring.
+    'sgr0': ('sgr0', re.escape('\x1b') + r'\[m'),
+    'backspace': ('', re.escape('\b')),
+    'ascii_tab': ('', re.escape('\t')),
+}
+
+CAPABILITIES_CAUSE_MOVEMENT = (
+    'ascii_tab',
+    'backspace',
+    'carriage_return',
+    'clear_screen',
+    'column_address',
+    'cursor_address',
+    'cursor_down',
+    'cursor_home',
+    'cursor_left',
+    'cursor_right',
+    'cursor_up',
+    'enter_fullscreen',
+    'exit_fullscreen',
+    'parm_down_cursor',
+    'parm_left_cursor',
+    'parm_right_cursor',
+    'parm_up_cursor',
+    'restore_cursor',
+    'row_address',
+    'scroll_forward',
+    'tab',
+)
diff --git a/blessed/formatters.py b/blessed/formatters.py
new file mode 100644
index 0000000..6602073
... 7726 lines suppressed ...

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



More information about the Python-modules-commits mailing list