Skip to main content

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

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 unpack packed 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

struct_parse-0.0.1.tar.gz (3.3 kB view details)

Uploaded Source

Built Distributions

struct_parse-0.0.1-py3.7.egg (4.4 kB view details)

Uploaded Egg

struct_parse-0.0.1-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file struct_parse-0.0.1.tar.gz.

File metadata

  • Download URL: struct_parse-0.0.1.tar.gz
  • Upload date:
  • Size: 3.3 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

Hashes for struct_parse-0.0.1.tar.gz
Algorithm Hash digest
SHA256 be9539451f34b15605dfe2c57b7005107f8838d4db7947d06e8e7d967f3fa13b
MD5 1f6fd109ca3dc092e6110e5310971686
BLAKE2b-256 5db656a056086c85d99e193028cbc0df8b9a61f69b8221cc3c94a7ca76f1d99a

See more details on using hashes here.

File details

Details for the file struct_parse-0.0.1-py3.7.egg.

File metadata

  • Download URL: struct_parse-0.0.1-py3.7.egg
  • Upload date:
  • Size: 4.4 kB
  • Tags: Egg
  • 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

Hashes for struct_parse-0.0.1-py3.7.egg
Algorithm Hash digest
SHA256 b4b2c57ffaa5540a8a04e2cc627eae7f6aab2ec3003256526c5945bb6b884ac9
MD5 ebbfb3599fa2623a3172f794464ae511
BLAKE2b-256 093489619cdfd94308fec865450269dc49594b834a92cafba8223109c1e88af2

See more details on using hashes here.

File details

Details for the file struct_parse-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: struct_parse-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.6 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

Hashes for struct_parse-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ab525f1fed48ebbe6eae02a49043a3891419d0febf1ca7843c87e95bbdfa112b
MD5 50b888d9a3a3f6df2a021a3e4a38d5bd
BLAKE2b-256 82625f842758dc0982215ff50b44d5ec882780ac0ac87d2f94574f902b1acd3f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page