bit-common


Namebit-common JSON
Version 0.1.15 PyPI version JSON
download
home_pageNone
SummaryBit common types and utilities.
upload_time2024-04-01 23:43:13
maintainerNone
docs_urlNone
authorYury Sokov
requires_python<4.0,>=3.12
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # README.md

## bit-common

`bit-common` is a Python library that provides types and utilities for working with bits. It allows you to easily convert data to and from bits, making it a handy tool for low-level programming, data analysis, and more.

### Installation

You can install `bit-common` using pip or poetry.

#### Using pip

```bash
pip install bit-common
```

#### Using poetry

```bash
poetry add bit-common
```

### Usage

Here are some examples of how you can use `bit-common`.

#### Converting data to bits

```python
from bit.type import int8, UTF8StringWithPrefix

# Converting data to bits
data = int8(3)
bits = data.to_bits()
print(bits)  # Output: [1, 1, 0, 0, 0, 0, 0, 0]

# Converting bits to data
bits = [1, 1, 0, 0, 0, 0, 0, 0]
data = int8.from_bits(bits)
print(data)  # Output: 3

# Converting string to bits
string = UTF8StringWithPrefix("Hello")
bits = string.to_bits()
print(bits)  # Output: [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0]

# Converting bits to string
bits = [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0]
string = UTF8StringWithPrefix.from_bits(bits)
print(string)  # Output: "Hello"
```


### License

`bit-common` is licensed under the MIT License.
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "bit-common",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.12",
    "maintainer_email": null,
    "keywords": null,
    "author": "Yury Sokov",
    "author_email": "me@yurzs.dev",
    "download_url": "https://files.pythonhosted.org/packages/b2/43/48a05fb28933934ac87febad438b12e5d042533e49d8aec0d20c2026e553/bit_common-0.1.15.tar.gz",
    "platform": null,
    "description": "# README.md\n\n## bit-common\n\n`bit-common` is a Python library that provides types and utilities for working with bits. It allows you to easily convert data to and from bits, making it a handy tool for low-level programming, data analysis, and more.\n\n### Installation\n\nYou can install `bit-common` using pip or poetry.\n\n#### Using pip\n\n```bash\npip install bit-common\n```\n\n#### Using poetry\n\n```bash\npoetry add bit-common\n```\n\n### Usage\n\nHere are some examples of how you can use `bit-common`.\n\n#### Converting data to bits\n\n```python\nfrom bit.type import int8, UTF8StringWithPrefix\n\n# Converting data to bits\ndata = int8(3)\nbits = data.to_bits()\nprint(bits)  # Output: [1, 1, 0, 0, 0, 0, 0, 0]\n\n# Converting bits to data\nbits = [1, 1, 0, 0, 0, 0, 0, 0]\ndata = int8.from_bits(bits)\nprint(data)  # Output: 3\n\n# Converting string to bits\nstring = UTF8StringWithPrefix(\"Hello\")\nbits = string.to_bits()\nprint(bits)  # Output: [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0]\n\n# Converting bits to string\nbits = [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0]\nstring = UTF8StringWithPrefix.from_bits(bits)\nprint(string)  # Output: \"Hello\"\n```\n\n\n### License\n\n`bit-common` is licensed under the MIT License.",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Bit common types and utilities.",
    "version": "0.1.15",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "baa6f96181c0f4a3a86b2e9310403a2fbc23c8821978ab3ea73e92857c2b7f02",
                "md5": "3302156f78bffbf6a91d274a81553c03",
                "sha256": "0b1631f20a24fc2dc5449f64e6b4bacca46a6d512e90db10aab4dc928f8b99ca"
            },
            "downloads": -1,
            "filename": "bit_common-0.1.15-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3302156f78bffbf6a91d274a81553c03",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.12",
            "size": 13448,
            "upload_time": "2024-04-01T23:43:11",
            "upload_time_iso_8601": "2024-04-01T23:43:11.676870Z",
            "url": "https://files.pythonhosted.org/packages/ba/a6/f96181c0f4a3a86b2e9310403a2fbc23c8821978ab3ea73e92857c2b7f02/bit_common-0.1.15-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b24348a05fb28933934ac87febad438b12e5d042533e49d8aec0d20c2026e553",
                "md5": "e138e507125b8cd98f4350951a9e20c7",
                "sha256": "4cecdaabe01e542f7a1dd0bbf85a839ed8a1b77f481135fef76d2fe863b6679e"
            },
            "downloads": -1,
            "filename": "bit_common-0.1.15.tar.gz",
            "has_sig": false,
            "md5_digest": "e138e507125b8cd98f4350951a9e20c7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.12",
            "size": 9751,
            "upload_time": "2024-04-01T23:43:13",
            "upload_time_iso_8601": "2024-04-01T23:43:13.259719Z",
            "url": "https://files.pythonhosted.org/packages/b2/43/48a05fb28933934ac87febad438b12e5d042533e49d8aec0d20c2026e553/bit_common-0.1.15.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-01 23:43:13",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "bit-common"
}
        
Elapsed time: 0.72813s