Parse struct definitions like those used in the struct module
Project description
struct-parse
struct_parse builds on the struct_ module in the standard library.
struct lets you parse buffers by describing the format similarly to C struct
definitions. struct_parse aims to comply with the struct module's format
strings, but instead returns a (very flat) abstract syntax tree (AST).
Example
.. code-block:: python
import struct_parse
field_list = struct_parse.parse('hhl') print(field_list.fields)
This will print::
[<FieldType.FLOAT: 16>, <FieldType.FLOAT: 16>, <FieldType.LONG: 9>]
Use cases
For simply unpacking packed binary data, the struct module does the trick.
The goal of this module is to enable the user to do other stuff with the format
string--we return a sequence of types instead of a sequence of values.
Compatibility
This library supports only Python 3.
.. _struct: https://docs.python.org/3/library/struct.html
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 struct_parse-0.0.2.tar.gz.
File metadata
- Download URL: struct_parse-0.0.2.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a867c2cadb28bd101fb1f918587c264d5814d937b17b482e37e1e50b7917c7db
|
|
| MD5 |
8af7a1bc17f0ade4fe691f14a9404700
|
|
| BLAKE2b-256 |
dc521eb184a5c2395e33b007411634d6db7fbf6742dab859886754018d7e8b67
|
File details
Details for the file struct_parse-0.0.2-py3-none-any.whl.
File metadata
- Download URL: struct_parse-0.0.2-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8fa2043a222734929afa22b31ffa350ac44b1132eec1254302b9765dfef19dee
|
|
| MD5 |
1f81b1c0588a29db9dea85904c1a151a
|
|
| BLAKE2b-256 |
6817f89d87fde91d382ef5d0ede347dff0e44f43a783ac46837a83d00c7e16bd
|