Skip to main content

raw-wrapper

A library for simple wrapping raw bytes to a class ✌️

Install

pip install raw-wrapper

Use

from dataclasses import dataclass
from raw_wrapper import RawWrapper


@dataclass
class SampleClass(RawWrapper):
    """Sample class"""
    sample_4b_int: int = 0
    sample_string: str = b''.ljust(12)

    @staticmethod
    def get_format():
        return '>i12s'

    @staticmethod
    def expected_size():
        return 16


data = b'\x00\x00\x00\x01Hello world!'

sample_class = SampleClass.wrap(data)

assert sample_class.sample_4b_int == 1
assert sample_class.sample_string == b'Hello world!'

Dev

More about format see https://docs.python.org/3/library/struct.html#format-characters

Metadata

Release files for raw-wrapper 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for raw-wrapper 1.0.0
File Interpreter ABI Platform Actions
raw_wrapper-1.0.0-py3-none-any.whl Python 3 none any Details for raw_wrapper-1.0.0-py3-none-any.whl

Release files / raw_wrapper-1.0.0-py3-none-any.whl

Download URL raw_wrapper-1.0.0-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a981fccdb236c34b16d078d19199dab9ad6a79f69bb5e4a705242786856eed64
BLAKE2b-256 checksum
How to use checksums
47b244ef5f7e49419a5e292be10e61fc3126564b43c5986e0cf9719092452956
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Security for raw-wrapper 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page