Skip to main content

Struct to model (dataclass) for python

Project description

Welcome

Struct-Model - is an annotations based wrapper for python's built-in Struct module.

from struct_model import StructModel, String, uInt4

class Form(StructModel):
    username: String(16)
    balance: uInt4
    
print(Form("Adam Bright", 12).pack())
# b'Adam Bright\x00\x00\x00\x00\x00\x00\x00\x00\x0c'
print(Form.unpack(b'Adam Bright\x00\x00\x00\x00\x00\x00\x00\x00\x0c').json())
# {"username": "Adam Bright", "balance": 12}

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-model-python-0.1.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

struct_model_python-0.1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file struct-model-python-0.1.0.tar.gz.

File metadata

  • Download URL: struct-model-python-0.1.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.8 CPython/3.9.6 Darwin/20.6.0

File hashes

Hashes for struct-model-python-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bfafbbe5cd24ced85f1437295a5d47d0219eb8cdee47a72f5aa1313bbd1b4aa4
MD5 0765e532fd7417efc83472734b4a56be
BLAKE2b-256 02775b773124db9fa01b78d03db752670f3f6e4e2c94fb871af11ded6fd6a3c4

See more details on using hashes here.

File details

Details for the file struct_model_python-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for struct_model_python-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 65b259409d15df39c320030644fe42dfbec6355ccf3b597c22579400568590d5
MD5 587aaf2d33421ff716b9af165ba83109
BLAKE2b-256 85b50fae8cacdb4b54547e41039b8e5b24287f356900b391349c9106e30eaccd

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