Skip to content

Commit

Permalink
fix: Seek to the original offset 1db7277
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Apr 28, 2024
1 parent 4c1d47c commit be4fa7d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
1.10.1 - April 27, 2024
-----------------------

- fix: Version 1.10.0 seeks to the file's beginning, instead of to the original offset.
- fix: :meth:`.Number.csvify` returns a ``Decimal`` (or ``None``), instead of ``str``. :meth:`.Table.to_csv` with ``quoting=csv.QUOTE_NONNUMERIC`` now works.

1.10.0 - April 27, 2024
Expand Down
4 changes: 3 additions & 1 deletion agate/table/from_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ def from_csv(cls, path, column_names=None, column_types=None, row_names=None, sk
handle = StringIO(f.read())
kwargs['dialect'] = csv.Sniffer().sniff(handle.getvalue())
elif sniff_limit > 0:
offset = f.tell()

# Reads only the start of the file.
kwargs['dialect'] = csv.Sniffer().sniff(f.read(sniff_limit))
f.seek(0)
f.seek(offset)

reader = csv.reader(handle, header=header, **kwargs)

Expand Down

0 comments on commit be4fa7d

Please sign in to comment.