Skip to content

Commit

Permalink
docs: Update changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Apr 27, 2024
1 parent 907213f commit 4bfc33a
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ agate is made by a community. The following individuals have contributed code, d
* `Tim Gates <https://github.com/timgates42>`_
* `castorf <https://github.com/castorf>`_
* `Julien Enselme <https://github.com/Jenselme>`__

* `Scott Gigante <https://github.com/scottgigante>`__
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
1.10.0 - April 27. 2024
-----------------------

- feat: :meth:`.Table.from_csv` reads the file line by line. If ``sniff_limit=None``, it reads the file into memory once, instead of twice. If ``column_types`` is a :class:`.TypeTester`, it reads the file into memory. (#778)
- fix: Fix :meth:`.TableSet.print_structure` for nested tablesets. (#765)

.. code-block:: python
Expand Down
5 changes: 2 additions & 3 deletions agate/table/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def __init__(self, rows, column_names=None, column_types=None, row_names=None, _
try:
first_row = rows[0]
except TypeError:
# it's an iterator
# rows is an iterator.
first_row = next(rows)
rows = chain([first_row], rows)
self._column_names = tuple(utils.letter_name(i) for i in range(len(first_row)))
Expand All @@ -108,8 +108,7 @@ def __init__(self, rows, column_names=None, column_types=None, row_names=None, _
raise ValueError('Column types must be instances of DataType.')

if isinstance(column_types, TypeTester):
# if rows is streaming, we must bring it in-memory
# note: we could do better here.
# In case rows is an iterator, in which case need to read it all into memory.
rows = tuple(rows)
self._column_types = column_types.run(rows, self._column_names)
else:
Expand Down
5 changes: 2 additions & 3 deletions agate/table/from_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ def from_csv(cls, path, column_names=None, column_types=None, row_names=None, sk
handle = f

if sniff_limit is None:
# avoid reading the file twice
# Reads to the end of the tile, but avoid reading the file twice.
handle = StringIO(f.read())
kwargs['dialect'] = csv.Sniffer().sniff(handle.getvalue())
elif sniff_limit > 0:
# Reads only the start of the file.
kwargs['dialect'] = csv.Sniffer().sniff(f.read(sniff_limit))
# return to the start of the file
f.seek(0)

reader = csv.reader(handle, header=header, **kwargs)
Expand All @@ -84,7 +84,6 @@ def from_csv(cls, path, column_names=None, column_types=None, row_names=None, sk
rows = itertools.islice(reader, row_limit)

return Table(rows, column_names, column_types, row_names=row_names)

finally:
if close:
f.close()
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

project = 'agate'
copyright = '2017, Christopher Groskopf'
version = '1.9.1'
version = '1.10.0'
release = version

# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='agate',
version='1.9.1',
version='1.10.0',
description='A data analysis library that is optimized for humans instead of machines.',
long_description=long_description,
long_description_content_type='text/x-rst',
Expand Down

0 comments on commit 4bfc33a

Please sign in to comment.