[Python-modules-commits] [humanfriendly] 01/03: Import humanfriendly_3.2.orig.tar.gz

Wolfgang Borgert debacle at moszumanska.debian.org
Tue May 30 09:10:45 UTC 2017


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

debacle pushed a commit to branch master
in repository humanfriendly.

commit 3dc81ec7db549842ad30358e52abb2778d114cfd
Author: W. Martin Borgert <debacle at debian.org>
Date:   Tue May 30 11:01:59 2017 +0200

    Import humanfriendly_3.2.orig.tar.gz
---
 PKG-INFO                        | 15 ++++---
 README.rst                      | 10 ++---
 humanfriendly.egg-info/PKG-INFO | 15 ++++---
 humanfriendly/__init__.py       | 32 ++++++++++-----
 humanfriendly/cli.py            | 24 ++++++------
 humanfriendly/prompts.py        |  7 +++-
 humanfriendly/terminal.py       | 87 +++++++++++++++++++++++++++++++----------
 humanfriendly/tests.py          | 45 ++++++++++-----------
 humanfriendly/usage.py          |  8 ++--
 setup.cfg                       |  1 -
 setup.py                        |  5 ++-
 11 files changed, 157 insertions(+), 92 deletions(-)

diff --git a/PKG-INFO b/PKG-INFO
index b4c1508..20d5571 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: humanfriendly
-Version: 2.4
+Version: 3.2
 Summary: Human friendly output for text interfaces using Python
 Home-page: https://humanfriendly.readthedocs.io
 Author: Peter Odding
@@ -31,8 +31,8 @@ Description: humanfriendly: Human friendly input/output in Python
           friendly rendering of usage messages and querying the terminal for its
           size.
         
-        The `humanfriendly` package is currently tested on Python 2.6, 2.7, 3.4, 3.5
-        and PyPy.
+        The `humanfriendly` package is currently tested on Python 2.6, 2.7, 3.4, 3.5,
+        3.6 and PyPy (2.7).
         
         .. contents::
            :local:
@@ -65,7 +65,8 @@ Description: humanfriendly: Human friendly input/output in Python
         
         **Usage:** `humanfriendly [OPTIONS]`
         
-        Human friendly input/output (text formatting) on the command line based on the Python package with the same name.
+        Human friendly input/output (text formatting) on the command
+        line based on the Python package with the same name.
         
         **Supported options:**
         
@@ -96,8 +97,7 @@ Description: humanfriendly: Human friendly input/output in Python
            number of bytes to standard output."
            ``--parse-length=VALUE``,"Parse a human readable length (given as the string ``VALUE``) and print the
            number of metres to standard output."
-           "``-h``, ``--help``","Show this message and exit.
-           "
+           "``-h``, ``--help``",Show this message and exit.
         
         .. [[[end]]]
         
@@ -168,6 +168,9 @@ Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Communications
 Classifier: Topic :: Scientific/Engineering :: Human Machine Interfaces
 Classifier: Topic :: Software Development
diff --git a/README.rst b/README.rst
index b8dbdb1..0ab6edb 100644
--- a/README.rst
+++ b/README.rst
@@ -23,8 +23,8 @@ text interfaces more user friendly. Some example features:
   friendly rendering of usage messages and querying the terminal for its
   size.
 
-The `humanfriendly` package is currently tested on Python 2.6, 2.7, 3.4, 3.5
-and PyPy.
+The `humanfriendly` package is currently tested on Python 2.6, 2.7, 3.4, 3.5,
+3.6 and PyPy (2.7).
 
 .. contents::
    :local:
@@ -57,7 +57,8 @@ Command line
 
 **Usage:** `humanfriendly [OPTIONS]`
 
-Human friendly input/output (text formatting) on the command line based on the Python package with the same name.
+Human friendly input/output (text formatting) on the command
+line based on the Python package with the same name.
 
 **Supported options:**
 
@@ -88,8 +89,7 @@ Human friendly input/output (text formatting) on the command line based on the P
    number of bytes to standard output."
    ``--parse-length=VALUE``,"Parse a human readable length (given as the string ``VALUE``) and print the
    number of metres to standard output."
-   "``-h``, ``--help``","Show this message and exit.
-   "
+   "``-h``, ``--help``",Show this message and exit.
 
 .. [[[end]]]
 
diff --git a/humanfriendly.egg-info/PKG-INFO b/humanfriendly.egg-info/PKG-INFO
index b4c1508..20d5571 100644
--- a/humanfriendly.egg-info/PKG-INFO
+++ b/humanfriendly.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: humanfriendly
-Version: 2.4
+Version: 3.2
 Summary: Human friendly output for text interfaces using Python
 Home-page: https://humanfriendly.readthedocs.io
 Author: Peter Odding
@@ -31,8 +31,8 @@ Description: humanfriendly: Human friendly input/output in Python
           friendly rendering of usage messages and querying the terminal for its
           size.
         
-        The `humanfriendly` package is currently tested on Python 2.6, 2.7, 3.4, 3.5
-        and PyPy.
+        The `humanfriendly` package is currently tested on Python 2.6, 2.7, 3.4, 3.5,
+        3.6 and PyPy (2.7).
         
         .. contents::
            :local:
@@ -65,7 +65,8 @@ Description: humanfriendly: Human friendly input/output in Python
         
         **Usage:** `humanfriendly [OPTIONS]`
         
-        Human friendly input/output (text formatting) on the command line based on the Python package with the same name.
+        Human friendly input/output (text formatting) on the command
+        line based on the Python package with the same name.
         
         **Supported options:**
         
@@ -96,8 +97,7 @@ Description: humanfriendly: Human friendly input/output in Python
            number of bytes to standard output."
            ``--parse-length=VALUE``,"Parse a human readable length (given as the string ``VALUE``) and print the
            number of metres to standard output."
-           "``-h``, ``--help``","Show this message and exit.
-           "
+           "``-h``, ``--help``",Show this message and exit.
         
         .. [[[end]]]
         
@@ -168,6 +168,9 @@ Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Communications
 Classifier: Topic :: Scientific/Engineering :: Human Machine Interfaces
 Classifier: Topic :: Software Development
diff --git a/humanfriendly/__init__.py b/humanfriendly/__init__.py
index 50e1ae2..f60a3b0 100644
--- a/humanfriendly/__init__.py
+++ b/humanfriendly/__init__.py
@@ -1,7 +1,7 @@
 # Human friendly input/output in Python.
 #
 # Author: Peter Odding <peter at peterodding.com>
-# Last Change: February 13, 2017
+# Last Change: May 18, 2017
 # URL: https://humanfriendly.readthedocs.io
 
 """The main module of the `humanfriendly` package."""
@@ -39,7 +39,7 @@ from humanfriendly.prompts import prompt_for_choice  # NOQA
 from humanfriendly.compat import is_string, monotonic
 
 # Semi-standard module versioning.
-__version__ = '2.4'
+__version__ = '3.2'
 
 # Spinners are redrawn at most this many seconds.
 minimum_spinner_interval = 0.2
@@ -72,13 +72,13 @@ length_size_units = (dict(prefix='nm', divider=1e-09, singular='nm', plural='nm'
                      dict(prefix='km', divider=1000, singular='km', plural='km'))
 
 # Common time units, used for formatting of time spans.
-time_units = (dict(divider=1e-3, singular='millisecond', plural='milliseconds', abbreviation='ms'),
-              dict(divider=1, singular='second', plural='seconds', abbreviation='s'),
-              dict(divider=60, singular='minute', plural='minutes', abbreviation='m'),
-              dict(divider=60 * 60, singular='hour', plural='hours', abbreviation='h'),
-              dict(divider=60 * 60 * 24, singular='day', plural='days', abbreviation='d'),
-              dict(divider=60 * 60 * 24 * 7, singular='week', plural='weeks', abbreviation='w'),
-              dict(divider=60 * 60 * 24 * 7 * 52, singular='year', plural='years', abbreviation='y'))
+time_units = (dict(divider=1e-3, singular='millisecond', plural='milliseconds', abbreviations=['ms']),
+              dict(divider=1, singular='second', plural='seconds', abbreviations=['s', 'sec', 'secs']),
+              dict(divider=60, singular='minute', plural='minutes', abbreviations=['m', 'min', 'mins']),
+              dict(divider=60 * 60, singular='hour', plural='hours', abbreviations=['h']),
+              dict(divider=60 * 60 * 24, singular='day', plural='days', abbreviations=['d']),
+              dict(divider=60 * 60 * 24 * 7, singular='week', plural='weeks', abbreviations=['w']),
+              dict(divider=60 * 60 * 24 * 7 * 52, singular='year', plural='years', abbreviations=['y']))
 
 
 def coerce_boolean(value):
@@ -422,6 +422,16 @@ def parse_timespan(timespan):
     minimal amount of typing. It's very useful to accept easy to write time
     spans as e.g. command line arguments to programs.
 
+    The time units (and abbreviations) supported by this function are:
+
+    - ms, millisecond, milliseconds
+    - s, sec, secs, second, seconds
+    - m, min, mins, minute, minutes
+    - h, hour, hours
+    - d, day, days
+    - w, week, weeks
+    - y, year, years
+
     Some examples:
 
     >>> from humanfriendly import parse_timespan
@@ -445,7 +455,9 @@ def parse_timespan(timespan):
         if len(tokens) == 2 and is_string(tokens[1]):
             normalized_unit = tokens[1].lower()
             for unit in time_units:
-                if normalized_unit in (unit['singular'], unit['plural'], unit['abbreviation']):
+                if (normalized_unit == unit['singular'] or
+                        normalized_unit == unit['plural'] or
+                        normalized_unit in unit['abbreviations']):
                     return float(tokens[0]) * unit['divider']
     # We failed to parse the timespan specification.
     msg = "Failed to parse timespan! (input %r was tokenized as %r)"
diff --git a/humanfriendly/cli.py b/humanfriendly/cli.py
index fdd1f0c..ce0910d 100644
--- a/humanfriendly/cli.py
+++ b/humanfriendly/cli.py
@@ -1,7 +1,7 @@
 # Human friendly input/output in Python.
 #
 # Author: Peter Odding <peter at peterodding.com>
-# Last Change: May 27, 2015
+# Last Change: May 18, 2017
 # URL: https://humanfriendly.readthedocs.io
 
 """
@@ -85,7 +85,7 @@ from humanfriendly import (
     Spinner,
     Timer,
 )
-from humanfriendly.terminal import usage
+from humanfriendly.terminal import output, usage, warning
 
 
 def main():
@@ -96,8 +96,8 @@ def main():
             'format-table', 'format-timespan=', 'parse-length=',
             'parse-size=', 'run-command', 'help',
         ])
-    except getopt.GetoptError as e:
-        sys.stderr.write("Error: %s\n" % e)
+    except Exception as e:
+        warning("Error: %s", e)
         sys.exit(1)
     actions = []
     delimiter = None
@@ -150,19 +150,19 @@ def run_command(command_line):
 def print_formatted_length(value):
     """Print a human readable length."""
     if '.' in value:
-        print(format_length(float(value)))
+        output(format_length(float(value)))
     else:
-        print(format_length(int(value)))
+        output(format_length(int(value)))
 
 
 def print_formatted_number(value):
     """Print large numbers in a human readable format."""
-    print(format_number(float(value)))
+    output(format_number(float(value)))
 
 
 def print_formatted_size(value):
     """Print a human readable size."""
-    print(format_size(int(value)))
+    output(format_size(int(value)))
 
 
 def print_formatted_table(delimiter):
@@ -171,19 +171,19 @@ def print_formatted_table(delimiter):
     for line in sys.stdin:
         line = line.rstrip()
         data.append(line.split(delimiter))
-    print(format_table(data))
+    output(format_table(data))
 
 
 def print_formatted_timespan(value):
     """Print a human readable timespan."""
-    print(format_timespan(float(value)))
+    output(format_timespan(float(value)))
 
 
 def print_parsed_length(value):
     """Parse a human readable length and print the number of metres."""
-    print(parse_length(value))
+    output(parse_length(value))
 
 
 def print_parsed_size(value):
     """Parse a human readable data size and print the number of bytes."""
-    print(parse_size(value))
+    output(parse_size(value))
diff --git a/humanfriendly/prompts.py b/humanfriendly/prompts.py
index b14337d..5df4489 100644
--- a/humanfriendly/prompts.py
+++ b/humanfriendly/prompts.py
@@ -3,7 +3,7 @@
 # Human friendly input/output in Python.
 #
 # Author: Peter Odding <peter at peterodding.com>
-# Last Change: November 30, 2016
+# Last Change: May 4, 2017
 # URL: https://humanfriendly.readthedocs.io
 
 """
@@ -330,10 +330,13 @@ def prepare_friendly_prompts():
 
 def retry_limit():
     """
-    Generator for interactive prompts that repeat on invalid input.
+    Allow the user to provide valid input up to :data:`MAX_ATTEMPTS` times.
 
     :raises: :exc:`TooManyInvalidReplies` when an interactive prompt
              receives repeated invalid input (:data:`MAX_ATTEMPTS`).
+
+    This function returns a generator for interactive prompts that want to
+    repeat on invalid input without getting stuck in infinite loops.
     """
     for i in range(MAX_ATTEMPTS):
         yield i + 1
diff --git a/humanfriendly/terminal.py b/humanfriendly/terminal.py
index d97afd2..55927e8 100644
--- a/humanfriendly/terminal.py
+++ b/humanfriendly/terminal.py
@@ -1,7 +1,7 @@
 # Human friendly input/output in Python.
 #
 # Author: Peter Odding <peter at peterodding.com>
-# Last Change: February 14, 2017
+# Last Change: May 18, 2017
 # URL: https://humanfriendly.readthedocs.io
 
 """
@@ -17,6 +17,7 @@ escape sequences work.
 """
 
 # Standard library modules.
+import codecs
 import os
 import re
 import subprocess
@@ -36,7 +37,7 @@ except ImportError:
 # Modules included in our package. We import find_meta_variables() here to
 # preserve backwards compatibility with older versions of humanfriendly where
 # that function was defined in this module.
-from humanfriendly.compat import is_unicode
+from humanfriendly.compat import coerce_string, is_unicode
 from humanfriendly.text import concatenate, format
 from humanfriendly.usage import find_meta_variables, format_usage  # NOQA
 
@@ -82,6 +83,9 @@ DEFAULT_LINES = 25
 DEFAULT_COLUMNS = 80
 """The default number of columns in a terminal (an integer)."""
 
+DEFAULT_ENCODING = 'UTF-8'
+"""The output encoding for Unicode strings."""
+
 HIGHLIGHT_COLOR = os.environ.get('HUMANFRIENDLY_HIGHLIGHT_COLOR', 'green')
 """
 The color used to highlight important tokens in formatted text (e.g. the usage
@@ -91,36 +95,78 @@ message of the ``humanfriendly`` program). If the environment variable
 """
 
 
-def message(*args, **kw):
+def output(text, *args, **kw):
+    """
+    Print a formatted message to the standard output stream.
+
+    For details about argument handling please refer to
+    :func:`~humanfriendly.text.format()`.
+
+    Renders the message using :func:`~humanfriendly.text.format()` and writes
+    the resulting string (followed by a newline) to :data:`sys.stdout` using
+    :func:`auto_encode()`.
+    """
+    auto_encode(sys.stdout, coerce_string(text) + '\n', *args, **kw)
+
+
+def message(text, *args, **kw):
     """
-    Show an informational message on the terminal.
+    Print a formatted message to the standard error stream.
 
-    :param args: Any positional arguments are passed on to :func:`~humanfriendly.text.format()`.
-    :param kw: Any keyword arguments are passed on to :func:`~humanfriendly.text.format()`.
+    For details about argument handling please refer to
+    :func:`~humanfriendly.text.format()`.
 
     Renders the message using :func:`~humanfriendly.text.format()` and writes
-    the resulting string to :data:`sys.stderr` (followed by a newline).
+    the resulting string (followed by a newline) to :data:`sys.stderr` using
+    :func:`auto_encode()`.
     """
-    sys.stderr.write(format(*args, **kw) + '\n')
+    auto_encode(sys.stderr, coerce_string(text) + '\n', *args, **kw)
 
 
-def warning(*args, **kw):
+def warning(text, *args, **kw):
     """
     Show a warning message on the terminal.
 
-    :param args: Any positional arguments are passed on to :func:`~humanfriendly.text.format()`.
-    :param kw: Any keyword arguments are passed on to :func:`~humanfriendly.text.format()`.
+    For details about argument handling please refer to
+    :func:`~humanfriendly.text.format()`.
 
     Renders the message using :func:`~humanfriendly.text.format()` and writes
-    the resulting string to :data:`sys.stderr` (followed by a newline). If
-    :data:`sys.stderr` is connected to a terminal :func:`ansi_wrap()` is used
-    to color the message in a red font (to make the warning stand out from
-    surrounding text).
+    the resulting string (followed by a newline) to :data:`sys.stderr` using
+    :func:`auto_encode()`.
+
+    If :data:`sys.stderr` is connected to a terminal that supports colors,
+    :func:`ansi_wrap()` is used to color the message in a red font (to make
+    the warning stand out from surrounding text).
     """
-    text = format(*args, **kw)
+    text = coerce_string(text)
     if terminal_supports_colors(sys.stderr):
         text = ansi_wrap(text, color='red')
-    sys.stderr.write(text + '\n')
+    auto_encode(sys.stderr, text + '\n', *args, **kw)
+
+
+def auto_encode(stream, text, *args, **kw):
+    """
+    Reliably write Unicode strings to the terminal.
+
+    :param stream: The file-like object to write to (a value like
+                   :data:`sys.stdout` or :data:`sys.stderr`).
+    :param text: The text to write to the stream (a string).
+    :param args: Refer to :func:`~humanfriendly.text.format()`.
+    :param kw: Refer to :func:`~humanfriendly.text.format()`.
+
+    Renders the text using :func:`~humanfriendly.text.format()` and writes it
+    to the given stream. If an :exc:`~exceptions.UnicodeEncodeError` is
+    encountered in doing so, the text is encoded using :data:`DEFAULT_ENCODING`
+    and the write is retried. The reasoning behind this rather blunt approach
+    is that it's preferable to get output on the command line in the wrong
+    encoding then to have the Python program blow up with a
+    :exc:`~exceptions.UnicodeEncodeError` exception.
+    """
+    text = format(text, *args, **kw)
+    try:
+        stream.write(text)
+    except UnicodeEncodeError:
+        stream.write(codecs.encode(text, DEFAULT_ENCODING))
 
 
 def ansi_strip(text, readline_hints=True):
@@ -452,13 +498,14 @@ def usage(usage_text):
     show_pager(usage_text)
 
 
-def show_pager(formatted_text, encoding='UTF-8'):
+def show_pager(formatted_text, encoding=DEFAULT_ENCODING):
     """
     Print a large text to the terminal using a pager.
 
     :param formatted_text: The text to print to the terminal (a string).
     :param encoding: The name of the text encoding used to encode the formatted
-                     text if the formatted text is a Unicode string (a string).
+                     text if the formatted text is a Unicode string (a string,
+                     defaults to :data:`DEFAULT_ENCODING`).
 
     When :func:`connected_to_terminal()` returns :data:`True` a pager is used
     to show the text on the terminal, otherwise the text is printed directly
@@ -477,7 +524,7 @@ def show_pager(formatted_text, encoding='UTF-8'):
             formatted_text = formatted_text.encode(encoding)
         pager.communicate(input=formatted_text)
     else:
-        print(formatted_text)
+        output(formatted_text)
 
 
 def get_pager_command(text=None):
diff --git a/humanfriendly/tests.py b/humanfriendly/tests.py
index a0fcf66..cc93325 100644
--- a/humanfriendly/tests.py
+++ b/humanfriendly/tests.py
@@ -4,7 +4,7 @@
 # Tests for the `humanfriendly' package.
 #
 # Author: Peter Odding <peter.odding at paylogic.eu>
-# Last Change: February 13, 2017
+# Last Change: May 4, 2017
 # URL: https://humanfriendly.readthedocs.io
 
 """Test suite for the `humanfriendly` package."""
@@ -168,6 +168,8 @@ class HumanFriendlyTestCase(unittest.TestCase):
         self.assertEqual(5, humanfriendly.parse_timespan('5 seconds'))
         self.assertEqual(60 * 2, humanfriendly.parse_timespan('2m'))
         self.assertEqual(60 * 2, humanfriendly.parse_timespan('2 minutes'))
+        self.assertEqual(60 * 3, humanfriendly.parse_timespan('3 min'))
+        self.assertEqual(60 * 3, humanfriendly.parse_timespan('3 mins'))
         self.assertEqual(60 * 60 * 3, humanfriendly.parse_timespan('3 h'))
         self.assertEqual(60 * 60 * 3, humanfriendly.parse_timespan('3 hours'))
         self.assertEqual(60 * 60 * 24 * 4, humanfriendly.parse_timespan('4d'))
@@ -663,9 +665,21 @@ class HumanFriendlyTestCase(unittest.TestCase):
             sys.stdout = saved_stdout
             sys.stderr = saved_stderr
 
-    def test_connected_to_terminal(self):
-        """Test :func:`humanfriendly.terminal.connected_to_terminal()`."""
-        self.check_terminal_capabilities(connected_to_terminal)
+    def test_terminal_capabilities(self):
+        """Test the functions that check for terminal capabilities."""
+        for test_stream in connected_to_terminal, terminal_supports_colors:
+            # This test suite should be able to run interactively as well as
+            # non-interactively, so we can't expect or demand that standard streams
+            # will always be connected to a terminal. Fortunately Capturer enables
+            # us to fake it :-).
+            for stream in sys.stdout, sys.stderr:
+                with CaptureOutput():
+                    assert test_stream(stream)
+            # Test something that we know can never be a terminal.
+            with open(os.devnull) as handle:
+                assert not test_stream(handle)
+            # Verify that objects without isatty() don't raise an exception.
+            assert not test_stream(object())
 
     def test_show_pager(self):
         """Test :func:`humanfriendly.terminal.show_pager()`."""
@@ -717,25 +731,6 @@ class HumanFriendlyTestCase(unittest.TestCase):
                     # Clear the custom $PAGER value.
                     os.environ.pop('PAGER')
 
-    def test_terminal_supports_colors(self):
-        """Test :func:`humanfriendly.terminal.terminal_supports_colors()`."""
-        self.check_terminal_capabilities(terminal_supports_colors)
-
-    def check_terminal_capabilities(self, test_stream):
-        """Helper for :func:`test_connected_to_terminal()` and func:`test_terminal_supports_colors()`."""
-        # This test suite should be able to run interactively as well as
-        # non-interactively, so we can't expect or demand that standard streams
-        # will always be connected to a terminal. Fortunately Capturer enables
-        # us to fake it :-).
-        for stream in sys.stdout, sys.stderr:
-            with CaptureOutput():
-                assert test_stream(stream)
-        # Test something that we know can never be a terminal.
-        with open(os.devnull) as handle:
-            assert not test_stream(handle)
-        # Verify that objects without isatty() don't raise an exception.
-        assert not test_stream(object())
-
     def test_find_meta_variables(self):
         """Test :func:`humanfriendly.usage.find_meta_variables()`."""
         assert sorted(find_meta_variables("""
@@ -937,7 +932,7 @@ class HumanFriendlyTestCase(unittest.TestCase):
 
 
 def main(*args, **kw):
-    """Utility function to test the command line interface without invoking a subprocess."""
+    """Test the command line interface without invoking a subprocess."""
     returncode = 0
     input_buffer = StringIO(kw.get('input', ''))
     output_buffer = StringIO()
@@ -960,7 +955,7 @@ def main(*args, **kw):
 
 def normalize_timestamp(value, ndigits=1):
     """
-    Utility function to round timestamps to the given number of digits.
+    Round timestamps to the given number of digits.
 
     This helps to make the test suite less sensitive to timing issues caused by
     multitasking, processor scheduling, etc.
diff --git a/humanfriendly/usage.py b/humanfriendly/usage.py
index 9b5d440..7d7d04a 100644
--- a/humanfriendly/usage.py
+++ b/humanfriendly/usage.py
@@ -1,7 +1,7 @@
 # Human friendly input/output in Python.
 #
 # Author: Peter Odding <peter at peterodding.com>
-# Last Change: January 17, 2017
+# Last Change: May 6, 2017
 # URL: https://humanfriendly.readthedocs.io
 
 """
@@ -43,7 +43,7 @@ from importlib import import_module
 
 # Modules included in our package.
 from humanfriendly.compat import StringIO
-from humanfriendly.text import dedent, join_lines, split_paragraphs, trim_empty_lines
+from humanfriendly.text import dedent, split_paragraphs, trim_empty_lines
 
 # Public identifiers that require documentation (PEP-257).
 __all__ = (
@@ -205,7 +205,7 @@ def parse_usage(text):
         # Check whether we've found the end of the introduction.
         end_of_intro = (paragraphs[0] == START_OF_OPTIONS_MARKER)
         # Append the current paragraph to the introduction.
-        introduction.append(join_lines(paragraphs.pop(0)))
+        introduction.append(paragraphs.pop(0))
         # Stop after we've processed the complete introduction.
         if end_of_intro:
             break
@@ -255,7 +255,7 @@ def render_usage(text):
             description = options.pop(0)
             csv_writer.writerow([
                 render_paragraph(variants, meta_variables),
-                '\n\n'.join(render_paragraph(p, meta_variables) for p in split_paragraphs(description)),
+                ('\n\n'.join(render_paragraph(p, meta_variables) for p in split_paragraphs(description))).rstrip(),
             ])
         csv_lines = csv_buffer.getvalue().splitlines()
         output.append('\n'.join('   %s' % l for l in csv_lines))
diff --git a/setup.cfg b/setup.cfg
index 6c71b61..1e3eb36 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -4,5 +4,4 @@ universal = 1
 [egg_info]
 tag_build = 
 tag_date = 0
-tag_svn_revision = 0
 
diff --git a/setup.py b/setup.py
index c499e96..9bbd31a 100755
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@
 # Setup script for the `humanfriendly' package.
 #
 # Author: Peter Odding <peter at peterodding.com>
-# Last Change: January 17, 2017
+# Last Change: May 4, 2017
 # URL: https://humanfriendly.readthedocs.io
 
 """
@@ -129,6 +129,9 @@ setup(
         'Programming Language :: Python :: 3',
         'Programming Language :: Python :: 3.4',
         'Programming Language :: Python :: 3.5',
+        'Programming Language :: Python :: 3.6',
+        'Programming Language :: Python :: Implementation :: CPython',
+        'Programming Language :: Python :: Implementation :: PyPy',
         'Topic :: Communications',
         'Topic :: Scientific/Engineering :: Human Machine Interfaces',
         'Topic :: Software Development',

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



More information about the Python-modules-commits mailing list