Commit f8a5556b authored by Sandro Tosi's avatar Sandro Tosi

Imported Debian patch 0.6.1-1

########## PrettyTable 0.6.1 - June 03, 2012 ##########
* Unicode encoding scheme can now be set by user
* __str__ now uses user-specified encoding instead of ASCII. This
fixes a bug where tables with non-ASCII characters would print
correctly with "print x.get_string()" but not "print x" in 2.x
(thanks to Google Code user kevincobain2000 for reporting this
bug!)
* Fixed an incompatibility with 3.0 and 3.1 (html.escape was new
in 3.2)
########## PrettyTable 0.6 - April 05, 2012 ##########
* Code is now simultaneously compatible with Python 2 and 3
* Replaced all setter methods with managed attributes
* All styling options can now be set persistently as managed attributes
* Added "add_style" method to make setting style options easily
* Added "del_row", "clear_rows" and "clear" methods to facilitate
removal of data from table.
* Added "copy" method to facilitate cloning of a table.
* Removed caching functionality, which added complexity and fragility
for relatively little gain
* Removed methods that just printed strings produced by get_string and
get_html_string - just use inbuilt print!
* Improved unicode support (thanks to Google Code user ru.w31rd0 for
patch!)
* Added support for decimal and floating point number formatting
support (thanks to Google Code user willfurnass for the suggestion!)
* Added support for using a custom key sorting methods (thanks to
Google Code user amannijhawan for the suggestion!)
* Added support for line breaks in data (suggested and implemented by
Klein Stephane)
* Added support for max column widths (thanks to Tibor Arpas for the
suggestion!)
* Fixed table slicing
* Fixed bug where closing <tr/> tags in HTML tables were not printed
(thanks to Google Code user kehander for reporting this bug!)
* Fixed HTML table sorting bug (thanks to Google Code user dougbeal
for reporting this bug!)
* Fixed bug whereby changing field_names did not recompute widths
(thanks to Google Code user denilsonsa for reporting this bug!)
########## PrettyTable 0.5 - May 26, 2009 ##########
* Fixed a bug whereby printing with headers=False and border=False
would introduce an extraneous newline. Thanks to Alexander Lamaison
for reporting this bug.
* When printing with headers=False, column widths will now be reduced
as appropriate in columns where the field name is wider than the
data. Thanks to Alexander Lamaison for suggesting this behaviour.
* Support for Unicode has improved. Thanks to Chris Clark for
submitting this improvement.
* The value of the "border" argument now correctly controls the
presence of a border when printing HTML tables with print_html or
get_html_string, instead of being incorrectly ignored. Thanks to
Chris Clark for fixing this.
* The print_html and get_html_string methods now accept an
"attributes" argument which is a dictionary of name/value pairs to be
placed inside the <table> tag (so you can, e.g. set class, name or id
values in order to style your table with CSS). Thanks to Chris Clark
for submitting this feature.
* The print_html and get_html_string methods now, by default, do their
best to match the various formatting options in their HTML output.
They use inline CSS to adjust the alignment of data in columns, the
padding widths of columns and in some cases the border settings. You
can give either method a "format=False" attribute to turn this
behaviour off if you want to do your own styling. With "format=False"
the methods print a "bare bones" table, similar to the default
behaviour in 0.4.
########## PrettyTable 0.4 - May 13, 2009 ##########
* Added "add_column" method to enable building tables up column-by-column.
* Added "print_HTML" and "get_HTML_string" methods to enable HTML table
production.
* Added "set_border_chars" method to enable control over characters used to
draw the table border.
* Added "set_left_padding" and "set_right_padding" methods to allow
independent padding control for both sides of a column.
* Added "sortby" option to enable column sorting.
* Added "header" option to enable switching off field name printing at top of
table.
* Modified "hrules" option to enable greater control over presence of
horizontal lines.
* Added "border" option to enable switching off all line printing.
Thanks to Tim Cera, Chris Clark, Alexander Lamaison for suggesting and helping
to test many of the new features in this release.
########## PrettyTable 0.3 - May 01, 2009 ##########
* Added "padding_width" option to control the number of spaces between the
vertical line rules at the edges of a column and its content. This can be
set as a keyword argument to the constructor or after instantiation using
the "set_padding_width" method. The value is set to 1 by defaut. If your
table is too wide for a small screen with this value, setting it to 0 might
help you squeeze it in.
Thanks to Chris Clark for contributing a patch against 0.2.1 to add this
feature!
########## PrettyTable 0.2.1 - April 29, 2009 ##########
* Caching no longer breaks when using the "printt(fields=[...])" syntax. The
list of fields was not hashable and hence could not be used as a dictionary
key. I fixed this using the output of the "cPickle" module's "dumps"
function as the dictionary key instead.
* Horizontal lines are now the appropriate length when the above syntax is
used.
Thanks to Julien Koesten for reporting these bugs and testing the fixes almost
immediately after the release of 0.2!
########## PrettyTable 0.2 - April 29, 2009 ##########
* Added "get_string" method.
* Added "__str__" method (which just calls "get_string") to enable nice
"print x" syntax.
* Can now pass field names as a constructor argument.
* Return values of "get_string" are cached in a dictionary that is only
cleared after a call to "add_row" or something else which invalidates the
cache.
########## PrettyTable 0.1 - February 26, 2009 #########
* Original release
# Copyright (c) 2009-2012 Luke Maurits <luke@maurits.id.au>
# All rights reserved.
# With contributions from:
# * Chris Clark
# * Klein Stephane
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
include COPYING
include CHANGELOG
include README
include prettytable_test.py
Metadata-Version: 1.1
Metadata-Version: 1.0
Name: prettytable
Version: 0.6
Version: 0.6.1
Summary: A simple Python library for easily displaying tabular data in a visually appealing ASCII table format
Home-page: http://code.google.com/p/prettytable
Author: Luke Maurits
Author-email: luke@maurits.id.au
License: UNKNOWN
License: BSD (3 clause)
Description: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python
......
prettytable (0.6.1-1) unstable; urgency=low
* New upstream release
* debian/prettytable-example.py
- update for new 0.6 release
* Run tests at build-time with "python setup.py test"
* debian/rules
- install README
-- Sandro Tosi <morph@debian.org> Wed, 06 Jun 2012 19:30:29 +0200
prettytable (0.6-1) unstable; urgency=low
* New upstream release
......
......@@ -6,9 +6,13 @@ from prettytable import PrettyTable
def main():
x = PrettyTable(["City name", "Area", "Population", "Annual Rainfall"])
x.set_field_align("City name", "l") # Left align city names
x.add_row(["Adelaide",1295, 1158259, 600.5])
x.add_row(["Brisbane",5905, 1857594, 1146.4])
x.sortby = "Population"
x.reversesort = True
x.int_format["Area"] = "04"
x.float_format = "6.1"
x.align["City name"] = "l" # Left align city names
x.add_row(["Adelaide", 1295, 1158259, 600.5])
x.add_row(["Brisbane", 5905, 1857594, 1146.4])
x.add_row(["Darwin", 112, 120900, 1714.7])
x.add_row(["Hobart", 1357, 205556, 619.5])
x.add_row(["Sydney", 2058, 4336374, 1214.8])
......
......@@ -37,6 +37,9 @@ override_dh_auto_test:
ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
set -e ; \
for python in $(PY2VERS) $(PY3VERS); do \
PYTHONPATH=. $$python debian/prettytable_test.py ; \
PYTHONPATH=. $$python setup.py test ; \
done
endif
override_dh_installdocs:
dh_installdocs -A README
Metadata-Version: 1.1
Metadata-Version: 1.0
Name: prettytable
Version: 0.6
Version: 0.6.1
Summary: A simple Python library for easily displaying tabular data in a visually appealing ASCII table format
Home-page: http://code.google.com/p/prettytable
Author: Luke Maurits
Author-email: luke@maurits.id.au
License: UNKNOWN
License: BSD (3 clause)
Description: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python
......
CHANGELOG
COPYING
MANIFEST.in
README
prettytable.py
prettytable_test.py
setup.py
prettytable.egg-info/PKG-INFO
prettytable.egg-info/SOURCES.txt
......
......@@ -29,7 +29,7 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
__version__ = "0.6"
__version__ = "0.6.1"
import sys
import copy
......@@ -40,6 +40,7 @@ py3k = sys.version_info[0] >= 3
if py3k:
unicode = str
basestring = str
if py3k and sys.version_info[1] >= 2:
from html import escape
else:
from cgi import escape
......@@ -75,13 +76,14 @@ def _unicode(value, encoding="UTF-8"):
class PrettyTable(object):
def __init__(self, field_names=None, **kwargs):
def __init__(self, field_names=None, encoding="UTF-8", **kwargs):
"""Return a new PrettyTable instance
Arguments:
field_names - list or tuple of field names
encoding - Unicode encoding scheme to use
fields - list or tuple of field names to include in displays
start - index of first data row to include in output
end - index of last data row to include in output PLUS ONE (list slice style)
......@@ -101,6 +103,8 @@ class PrettyTable(object):
sort_key - sorting key function, applied to data points before sorting
reversesort - True or False to sort in descending or ascending order"""
self.encoding = encoding
# Data
self._field_names = []
self._align = {}
......@@ -177,7 +181,7 @@ class PrettyTable(object):
if py3k:
return self.get_string()
else:
return self.get_string().encode("ascii","replace")
return self.get_string().encode(self.encoding)
def __unicode__(self):
return self.get_string()
......
......@@ -13,9 +13,11 @@ setup(
'License :: OSI Approved :: BSD License',
'Topic :: Text Processing'
],
license="BSD (3 clause)",
description='A simple Python library for easily displaying tabular data in a visually appealing ASCII table format',
author='Luke Maurits',
author_email='luke@maurits.id.au',
url='http://code.google.com/p/prettytable',
py_modules=['prettytable']
py_modules=['prettytable'],
test_suite = "prettytable_test"
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment