Spec-driven minimalist parser for IHS 297 and 298 formats
Project description
ihs29x
A simple spec-driven streaming ("SAX-style") parser for IHS 297 and 298 files, based on the specifications provided by twoninetyex. It handles 297 and 298 files in either fixed or comma delimited format. In accordance with my reading of the spec, it even handles intermixed formats within a single file, based on (sub-)file headers.
The only interesting function is ihs29x.stream_records, which may be called on an open file-like object in text mode.
Live documentation is available at https://derrickturk.github.io/ihs29x-python/docs/ihs29x.html.
Available under the MIT license.
Usage
For example, try:
import sys
from ihs29x import stream_records
def main(argv: list[str]) -> int:
if len(argv) != 2:
print(f'Usage {argv[0]} <298-or-297-file>', file=sys.stderr)
return 2
with open(argv[1]) as f:
for r in stream_records(f):
print(r)
return 0
if __name__ == '__main__':
sys.exit(main(sys.argv))
(c) 2023 terminus, LLC
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ihs29x-0.1.0.tar.gz.
File metadata
- Download URL: ihs29x-0.1.0.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b5e385b3ec616f89ec062cb07ac28f43016edd4f1544adca811df4a1dc60022
|
|
| MD5 |
1e5b5a87d8d84605c91d50de59e24dad
|
|
| BLAKE2b-256 |
e9cbe98850c3d0cac1a1af9b1ad4038fdd2e217d90bbd9b2e411b08f3da31bc8
|
File details
Details for the file ihs29x-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ihs29x-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73778612a8a7c06d746298e8b108d7b2113a510a5f3961e1f26b55983115fac9
|
|
| MD5 |
3839dac36d6f711960238b54cd25e628
|
|
| BLAKE2b-256 |
e26b88edd1000ec3bd030e40e159628ac2883264009465879dab92b87530d0cb
|