splurge-dsv 2025.2.0__py3-none-any.whl → 2025.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- splurge_dsv/__init__.py +1 -1
- splurge_dsv/cli.py +1 -1
- splurge_dsv/dsv.py +26 -2
- splurge_dsv/dsv_helper.py +51 -2
- {splurge_dsv-2025.2.0.dist-info → splurge_dsv-2025.2.1.dist-info}/METADATA +1 -1
- {splurge_dsv-2025.2.0.dist-info → splurge_dsv-2025.2.1.dist-info}/RECORD +10 -10
- {splurge_dsv-2025.2.0.dist-info → splurge_dsv-2025.2.1.dist-info}/WHEEL +0 -0
- {splurge_dsv-2025.2.0.dist-info → splurge_dsv-2025.2.1.dist-info}/entry_points.txt +0 -0
- {splurge_dsv-2025.2.0.dist-info → splurge_dsv-2025.2.1.dist-info}/licenses/LICENSE +0 -0
- {splurge_dsv-2025.2.0.dist-info → splurge_dsv-2025.2.1.dist-info}/top_level.txt +0 -0
splurge_dsv/__init__.py
CHANGED
@@ -60,7 +60,7 @@ from splurge_dsv.path_validator import PathValidator
|
|
60
60
|
from splurge_dsv.string_tokenizer import StringTokenizer
|
61
61
|
from splurge_dsv.text_file_helper import TextFileHelper
|
62
62
|
|
63
|
-
__version__ = "2025.2.
|
63
|
+
__version__ = "2025.2.1"
|
64
64
|
__author__ = "Jim Schilling"
|
65
65
|
__license__ = "MIT"
|
66
66
|
|
splurge_dsv/cli.py
CHANGED
splurge_dsv/dsv.py
CHANGED
@@ -17,6 +17,7 @@ Copyright (c) 2025 Jim Schilling
|
|
17
17
|
"""
|
18
18
|
|
19
19
|
# Standard library imports
|
20
|
+
import warnings
|
20
21
|
from collections.abc import Iterator
|
21
22
|
from dataclasses import dataclass, fields
|
22
23
|
from os import PathLike
|
@@ -230,7 +231,7 @@ class Dsv:
|
|
230
231
|
skip_footer_rows=self.config.skip_footer_rows,
|
231
232
|
)
|
232
233
|
|
233
|
-
def
|
234
|
+
def parse_file_stream(self, file_path: PathLike[str] | str) -> Iterator[list[list[str]]]:
|
234
235
|
"""Stream-parse a DSV file, yielding chunks of parsed rows.
|
235
236
|
|
236
237
|
The method yields lists of parsed rows (each row itself is a list of
|
@@ -243,7 +244,7 @@ class Dsv:
|
|
243
244
|
Yields:
|
244
245
|
Lists of parsed rows, each list containing up to ``chunk_size`` rows.
|
245
246
|
"""
|
246
|
-
return DsvHelper.
|
247
|
+
return DsvHelper.parse_file_stream(
|
247
248
|
file_path,
|
248
249
|
delimiter=self.config.delimiter,
|
249
250
|
strip=self.config.strip,
|
@@ -254,3 +255,26 @@ class Dsv:
|
|
254
255
|
skip_footer_rows=self.config.skip_footer_rows,
|
255
256
|
chunk_size=self.config.chunk_size,
|
256
257
|
)
|
258
|
+
|
259
|
+
def parse_stream(self, file_path: PathLike[str] | str) -> Iterator[list[list[str]]]:
|
260
|
+
"""Stream-parse a DSV file, yielding chunks of parsed rows.
|
261
|
+
|
262
|
+
The method yields lists of parsed rows (each row itself is a list of
|
263
|
+
strings). Chunk sizing is controlled by the bound configuration's
|
264
|
+
``chunk_size`` value.
|
265
|
+
|
266
|
+
Args:
|
267
|
+
file_path: Path to the file to parse.
|
268
|
+
|
269
|
+
Yields:
|
270
|
+
Lists of parsed rows, each list containing up to ``chunk_size`` rows.
|
271
|
+
|
272
|
+
Deprecated: Use `parse_file_stream` instead. This method will be removed in a future release.
|
273
|
+
"""
|
274
|
+
# Emit a DeprecationWarning to signal removal in a future release
|
275
|
+
warnings.warn(
|
276
|
+
"Dsv.parse_stream() is deprecated and will be removed in a future release; use Dsv.parse_file_stream() instead.",
|
277
|
+
DeprecationWarning,
|
278
|
+
stacklevel=2,
|
279
|
+
)
|
280
|
+
return Dsv.parse_file_stream(self, file_path)
|
splurge_dsv/dsv_helper.py
CHANGED
@@ -9,6 +9,7 @@ This module is licensed under the MIT License.
|
|
9
9
|
"""
|
10
10
|
|
11
11
|
# Standard library imports
|
12
|
+
import warnings
|
12
13
|
from collections.abc import Iterator
|
13
14
|
from os import PathLike
|
14
15
|
|
@@ -199,7 +200,7 @@ class DsvHelper:
|
|
199
200
|
return cls.parses(chunk, delimiter=delimiter, strip=strip, bookend=bookend, bookend_strip=bookend_strip)
|
200
201
|
|
201
202
|
@classmethod
|
202
|
-
def
|
203
|
+
def parse_file_stream(
|
203
204
|
cls,
|
204
205
|
file_path: PathLike[str] | str,
|
205
206
|
*,
|
@@ -213,7 +214,7 @@ class DsvHelper:
|
|
213
214
|
chunk_size: int = DEFAULT_CHUNK_SIZE,
|
214
215
|
) -> Iterator[list[list[str]]]:
|
215
216
|
"""
|
216
|
-
Stream-parse a DSV file
|
217
|
+
Stream-parse a DSV file into chunks of lines.
|
217
218
|
|
218
219
|
Args:
|
219
220
|
file_path (PathLike[str] | str): The path to the file to parse.
|
@@ -255,3 +256,51 @@ class DsvHelper:
|
|
255
256
|
chunk_size=chunk_size,
|
256
257
|
)
|
257
258
|
)
|
259
|
+
|
260
|
+
@classmethod
|
261
|
+
def parse_stream(
|
262
|
+
cls,
|
263
|
+
file_path: PathLike[str] | str,
|
264
|
+
*,
|
265
|
+
delimiter: str,
|
266
|
+
strip: bool = DEFAULT_STRIP,
|
267
|
+
bookend: str | None = None,
|
268
|
+
bookend_strip: bool = DEFAULT_BOOKEND_STRIP,
|
269
|
+
encoding: str = DEFAULT_ENCODING,
|
270
|
+
skip_header_rows: int = DEFAULT_SKIP_HEADER_ROWS,
|
271
|
+
skip_footer_rows: int = DEFAULT_SKIP_FOOTER_ROWS,
|
272
|
+
chunk_size: int = DEFAULT_CHUNK_SIZE,
|
273
|
+
) -> Iterator[list[list[str]]]:
|
274
|
+
"""
|
275
|
+
Stream-parse a DSV file, yielding chunks of parsed rows.
|
276
|
+
|
277
|
+
The method yields lists of parsed rows (each row itself is a list of
|
278
|
+
strings). Chunk sizing is controlled by the bound configuration's
|
279
|
+
``chunk_size`` value.
|
280
|
+
|
281
|
+
Args:
|
282
|
+
file_path: Path to the file to parse.
|
283
|
+
|
284
|
+
Yields:
|
285
|
+
Lists of parsed rows, each list containing up to ``chunk_size`` rows.
|
286
|
+
|
287
|
+
Deprecated: Use `parse_file_stream` instead. This method will be removed in a future release.
|
288
|
+
"""
|
289
|
+
# Emit a DeprecationWarning to signal removal in a future release
|
290
|
+
warnings.warn(
|
291
|
+
"DsvHelper.parse_stream() is deprecated and will be removed in a future release; use DsvHelper.parse_file_stream() instead.",
|
292
|
+
DeprecationWarning,
|
293
|
+
stacklevel=2,
|
294
|
+
)
|
295
|
+
|
296
|
+
return cls.parse_file_stream(
|
297
|
+
file_path,
|
298
|
+
delimiter=delimiter,
|
299
|
+
strip=strip,
|
300
|
+
bookend=bookend,
|
301
|
+
bookend_strip=bookend_strip,
|
302
|
+
encoding=encoding,
|
303
|
+
skip_header_rows=skip_header_rows,
|
304
|
+
skip_footer_rows=skip_footer_rows,
|
305
|
+
chunk_size=chunk_size,
|
306
|
+
)
|
@@ -1,17 +1,17 @@
|
|
1
|
-
splurge_dsv/__init__.py,sha256=
|
1
|
+
splurge_dsv/__init__.py,sha256=5TfARRtn0dMytGL4TnlEOWBon3HJiwN8MKEdHMItPZI,3337
|
2
2
|
splurge_dsv/__main__.py,sha256=6dpfX_96hEpOqxv5X4bK73xX86YTgK0Adad1uTWSABM,426
|
3
|
-
splurge_dsv/cli.py,sha256=
|
4
|
-
splurge_dsv/dsv.py,sha256=
|
5
|
-
splurge_dsv/dsv_helper.py,sha256=
|
3
|
+
splurge_dsv/cli.py,sha256=qm7ZwgkUjMW5ASj14kWFyXrXY2T-MGhiCFHh8XUHi38,7605
|
4
|
+
splurge_dsv/dsv.py,sha256=5wDtHDk8Iio2SAIPO7Ce01dGhzH3fv12by8hQcPkJVI,9873
|
5
|
+
splurge_dsv/dsv_helper.py,sha256=ppFVZ4LNSepWbVJtYMQvsZGmMBDr6nbP4yKZettWczk,12060
|
6
6
|
splurge_dsv/exceptions.py,sha256=hefUTjk3ULca5TdXoKe5L-cME7SU1RFcWVHxNpZ_w-Y,5274
|
7
7
|
splurge_dsv/path_validator.py,sha256=r08PkuMdL0eBY_iao00_irBMdT6ORJ2-cNK5AUssEKs,10681
|
8
8
|
splurge_dsv/safe_text_file_reader.py,sha256=9GCOGCTDDP5FJD0u2wZ107SQNEIj9Rm1zN6shYiKq7g,6659
|
9
9
|
splurge_dsv/safe_text_file_writer.py,sha256=zQIsDZ6jRN_ZWwLX4dpUZI35iudxzuv1Gjv7K1vSFJk,4562
|
10
10
|
splurge_dsv/string_tokenizer.py,sha256=jFgkqeGx5PnmKAvu7sn3xxHcQklZTZUy8x_eo5e6TWI,4497
|
11
11
|
splurge_dsv/text_file_helper.py,sha256=2SxbYtZtpMtHQ-5g1aQzgvQobBrlQH4EsrhBY5t3Xx4,10362
|
12
|
-
splurge_dsv-2025.2.
|
13
|
-
splurge_dsv-2025.2.
|
14
|
-
splurge_dsv-2025.2.
|
15
|
-
splurge_dsv-2025.2.
|
16
|
-
splurge_dsv-2025.2.
|
17
|
-
splurge_dsv-2025.2.
|
12
|
+
splurge_dsv-2025.2.1.dist-info/licenses/LICENSE,sha256=fPgtg-tIFHinQvJH0arRfv50AuxikD5eHw6rrPy2A5w,1091
|
13
|
+
splurge_dsv-2025.2.1.dist-info/METADATA,sha256=V1gWLbEKupAzTYWWvgx1UviuOtkjEhAYuPQ6pwOsDYM,8518
|
14
|
+
splurge_dsv-2025.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
15
|
+
splurge_dsv-2025.2.1.dist-info/entry_points.txt,sha256=QmGyc3qHYtY61uanRxNOXw-waSJ01qypSCI8Kb3zgsU,56
|
16
|
+
splurge_dsv-2025.2.1.dist-info/top_level.txt,sha256=D6Si3FTfpRYqH7kzM7tSQAyaKbbraO6UPLpcqcY4XXM,12
|
17
|
+
splurge_dsv-2025.2.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|