Littletable

Latest version: v2.2.5

Safety actively analyzes 630450 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 4 of 7

1.4.1

-------------
- Fixed bug when present() failed if a Table contained a field named 'default'
(would also have failed with a field named 'table'). Issue 1 (!!!) reported
by edp-penso, thanks!

- Add optional 'force' argument to create_search_index to regenerate a search
index if the contents of a searchable attribute changed.

- Some small optimizations to `Table.remove_many` and additional unit tests.

1.4.0

---------------
- Added `Table.create_search_index()' and `Table.search.<attribute>` for full text
searching in a text attribute. Search terms may be prefixed with
'+' and '-' flags, to qualify the required or excluded nature of matching
for that term:

. + strong preference
. - strong anti-preference
. ++ required
. -- excluded

Example::

recipe_data = textwrap.dedent("""\
title,ingredients
Tuna casserole,tuna noodles cream of mushroom soup
Hawaiian pizza,pizza dough pineapple ham tomato sauce
BLT,bread bacon lettuce tomato mayonnaise
Bacon cheeseburger,ground beef bun lettuce ketchup mustard pickle cheese bacon
""")
recipes = lt.Table().csv_import(recipe_data)

recipes.create_search_index("ingredients")
matches = recipes.search.ingredients("+bacon tomato --pineapple")

The search index is valid only so long as no items are added or removed from the
table, and if the indexed attribute values stay unchanged; if a search is run on a
modified table, `littletable.SearchIndexInconsistentError` exception is raised.

1.3.0

---------------
_(Sorry, it looks like I rushed the Table.join() changes for outer

1.2.0

---------------
- Import directly from simple .zip, .gz, or .xz/.lzma archives,
such as `data.csv.gz` or `data.csv.zip`. (For zip archives, the zip
file name must be the same as the compressed file with ".zip" added.)

- Add `join` argument to `Table.join()` to indicate whether an
"inner" join or "outer" join is to be performed. Accepted values
are "inner", "left outer", "right outer", "full outer", and "outer"
(synonym for "right outer"). Default join type is "inner".

- Fixed bug preventing joining on more than one field.

- Added `filters` argument to csv_import, to screen records as they
are read from the input file *before* they are added to the table. Can
be useful when dealing with large input files, to pre-screen data
before it is added to the table.

- Added tsv_export, analogous to csv_export, but using <TAB> character
as a value separator.

- Added comparators `Table.is_in` and `Table.not_in` to support filtering
by presence in or absence from a given collection of values. (For best
performance, if there are more than 4 values to be tested, convert the
collection to a Python `set` to optimize "in" testing.)

- For Python versions that support it, `types.SimpleNamespace` is now used
as the default row_class for dynamically created tables, instead of
`littletable.DataObject`. (This gives a significant performance boost.)

- Converted HowToUseLittletable.txt to Markdown how_to_use_littletable.md.

1.1.0

---------------
- Added the `Table.present()` method, using the `rich` module to format
table contents into a clean tabular format. Also added notes in the
"How to Use Littletable.txt" file on creating nice tabular output with
`rich`, Jupyter Notebook, and `tabulate`. (Note: `rich` only supports
Python versions 3.6 and later.)

- Added `head(n)` and `tail(n)` methods for easy slicing of the first
or last `n` items in a Table (`n` defaults to 10).

- Added `Table.clear()` method to clear all contents of a Table, but
leaving any index definitions intact.

- Added comparators `Table.between(a, b)`, `Table.within(a, b)`, and
`Table.in_range(a, b)` for easy range testing:

`Table.between(a, b)` matches `a < x < b` exclusive match
`Table.within(a, b)` matches `a <= x <= b` inclusive match
`Table.in_range(a, b)` matches `a <= x < b`, range check, similar
to testing `x in range(a, b)` in Python

- Updated `Table.stats()` to use the Python statistics module for those
versions of Python that support it. The Tables returned from this
method now also include unique indexes to support `.by.name[field_name]`
access to the stats for a particular field, or `.by.stat[stat_name]`
access to a particular stat for all fields, if `Table.stats` is called
with `by_field=False`.

- Fixed `Table.stats()`` to return `None` for `min` and `max` values if
source table is empty. `Table.stats()` also defaults to using all
field names if a list is not given, and guards against non-numeric
data. If `stats()` is called on an empty Table, an empty Table of
statistics is returned.

- Removed sorting of field names in `table.info()["fields"]` so that
attribute names are kept in default order for tabular output.

- Proper definition of `table.all.x` iterators so that `iter(table.all.x)`
returns self. (Necessary for modules like statistics that check
if an iterator is passed by testing `if iter(data) is data`.)

- Added support for a `formats` named argument to `Table.as_html()`.
`formats` takes a dict that maps field names or field data types to
string formats or callables. If a string format, the string should
be of the form used to format a placeholder in the str.format method
(such as "{:5.2f}" for a real value formatted to two decimal places).
If a callable is passed, it should take a single value argument and
return a str.

- Fixed unit tests that fail under Python versions pre-3.6 that do not
preserve dict insertion order. (This was a bug in the unit test, not in
the littletable core code.)

1.0.1

---------------
- Add support for optional .unique modifier for .all.<attr> value accessor.

for postal_code in customers.all.postal_code.unique:
...

- Added .all optimization when getting values for an indexed attribute.

- Added **kwargs support for csv_export, to permit passing arguments through
to the csv.DictWriter (such as `dialect`).

- Implemented `limit` named argument in csv_import.

- Closed issues when importing/exporting empty tables.

Page 4 of 7

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.