digint


Namedigint JSON
Version 1.0.3.0 PyPI version JSON
download
home_pageNone
SummaryA python module for manipulating positional integers across any numerical base, providing advanced digit-level control.
upload_time2024-10-12 20:55:10
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseNone
keywords integer digit digitwise bitwise manipulation number numeric numerical bases positional number systems mathematics binary hexadecimal custom notation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # `digint`

> Base-Agnostic Integer Manipulation

`digint` is a module focused on easy high-level integer manipulation across any numerical base. Works with binary, decimal, or any other base. `digint` seeks to make complex digit-level and notation operations easy, just like they were `Collection`s.

[Documentation](https://MarkusHammer.github.io/digint)

## Setup

This module can be installed using:

```bash
pip install digint
```

## Usage

This module is intended to be used only as a module, and can be imported after installing using the traditional process:

```python
from digint import digitint
```

### Create an integer in any base

```python
# input integers as you would with `int()`,
# if the intiger is already in the base you wish to use
n1 = digitint(1234, base=10)
n2 = digitint("BASE36", base=36)
n3 = digitint(0xABCDEF, base=16)

# convert bases on initialization, if the input is a intiger type
n4 = digitint(255, base=2) # == 0b11111111
n5 = digitint(int("BASE36", 36), base=10) # == 683248722
n6 = digitint(0xABCDEF, base=10) # == 11259375
```

### Access and modify digits like a collection

```python
# get the digit at index 2
print(n1.get_digit(2)) # outputs "3"
num.set_digit(2, 5)
print(n1.get_digit(2)) # outputs "5"
```

### Easy notation

```python
print(str(n2)) # output "BASE36"
print(str(n3)) # output "ABCDEF"
print(str(n5)) # output "683248722", as the base is set to 10
```

### Full mutable collection implementation on integers

```python
print(n2.pop(-1)) #outputs "6"
print(n2.pop(-1)) #outputs "3"
n2.append(int("D", 36))
print(n2) #outputs "BASED"

# The sum of all digits
print(sum(n2)) #outputs "76"

# The average of all digits
print(sum(n2)/len(n2)) #outputs "15.2"
```

### Customizable Notation

```python
# same as str(n3) 
print(n3.notate()) # outputs "ABCDEF"

from digint import NotationFormat
fmt = NotationFormat(*tuple("0123456789ZYXWVU"))
print(n3.notate(fmt)) # outputs "ZYXWVU"
```

### And More

There are a handfull of other ease of use features that this module provides, feel free to reference the [documentation](https://MarkusHammer.github.io/digint) for more information.

## Licence

This is licensed under the Mozilla Public License 2.0 (MPL 2.0) Licence. See the Licence file in this repository for more information.

## Contribute

Contributions are always welcome!
Use the [github repository](https://github.com/MarkusHammer/digint) to report issues and contribute to this project.

## Credits

While not required, feel free to credit "Markus Hammer" (or just "Markus") if you find this code or script useful for whatever you may be doing with it.

# Security Policy

While the python source code will be actively maintained, any binary files (if at all provided) are in no way supported.
These are provided as a courtesy and are not intended to be the main usage of this software.
Please keep this in mind when choosing how you wish to use this software.

## Supported Versions

| Version     | Supported |
| ----------- | --------- |
| 1.0.0.0 >= | ✅        |
| 1.0.0.0 <  | ❌        |

## Reporting a Vulnerability

Please report any issues to the email 107761433+MarkusHammer(THEN THE @ SYMBOL HERE)users.noreply.github.com

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "digint",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "integer, digit, digitwise, bitwise, manipulation, number, numeric, numerical, bases, positional, number systems, mathematics, binary, hexadecimal, custom, notation",
    "author": null,
    "author_email": "Markus Hammer <107761433+MarkusHammer@users.noreply.github.com>",
    "download_url": "https://files.pythonhosted.org/packages/fd/86/e833cdfa17ddf246d4ed17347b0c01e0d640dd2f44b34b46105796101350/digint-1.0.3.0.tar.gz",
    "platform": null,
    "description": "# `digint`\r\n\r\n> Base-Agnostic Integer Manipulation\r\n\r\n`digint` is a module focused on easy high-level integer manipulation across any numerical base. Works with binary, decimal, or any other base. `digint` seeks to make complex digit-level and notation operations easy, just like they were `Collection`s.\r\n\r\n[Documentation](https://MarkusHammer.github.io/digint)\r\n\r\n## Setup\r\n\r\nThis module can be installed using:\r\n\r\n```bash\r\npip install digint\r\n```\r\n\r\n## Usage\r\n\r\nThis module is intended to be used only as a module, and can be imported after installing using the traditional process:\r\n\r\n```python\r\nfrom digint import digitint\r\n```\r\n\r\n### Create an integer in any base\r\n\r\n```python\r\n# input integers as you would with `int()`,\r\n# if the intiger is already in the base you wish to use\r\nn1 = digitint(1234, base=10)\r\nn2 = digitint(\"BASE36\", base=36)\r\nn3 = digitint(0xABCDEF, base=16)\r\n\r\n# convert bases on initialization, if the input is a intiger type\r\nn4 = digitint(255, base=2) # == 0b11111111\r\nn5 = digitint(int(\"BASE36\", 36), base=10) # == 683248722\r\nn6 = digitint(0xABCDEF, base=10) # == 11259375\r\n```\r\n\r\n### Access and modify digits like a collection\r\n\r\n```python\r\n# get the digit at index 2\r\nprint(n1.get_digit(2)) # outputs \"3\"\r\nnum.set_digit(2, 5)\r\nprint(n1.get_digit(2)) # outputs \"5\"\r\n```\r\n\r\n### Easy notation\r\n\r\n```python\r\nprint(str(n2)) # output \"BASE36\"\r\nprint(str(n3)) # output \"ABCDEF\"\r\nprint(str(n5)) # output \"683248722\", as the base is set to 10\r\n```\r\n\r\n### Full mutable collection implementation on integers\r\n\r\n```python\r\nprint(n2.pop(-1)) #outputs \"6\"\r\nprint(n2.pop(-1)) #outputs \"3\"\r\nn2.append(int(\"D\", 36))\r\nprint(n2) #outputs \"BASED\"\r\n\r\n# The sum of all digits\r\nprint(sum(n2)) #outputs \"76\"\r\n\r\n# The average of all digits\r\nprint(sum(n2)/len(n2)) #outputs \"15.2\"\r\n```\r\n\r\n### Customizable Notation\r\n\r\n```python\r\n# same as str(n3) \r\nprint(n3.notate()) # outputs \"ABCDEF\"\r\n\r\nfrom digint import NotationFormat\r\nfmt = NotationFormat(*tuple(\"0123456789ZYXWVU\"))\r\nprint(n3.notate(fmt)) # outputs \"ZYXWVU\"\r\n```\r\n\r\n### And More\r\n\r\nThere are a handfull of other ease of use features that this module provides, feel free to reference the [documentation](https://MarkusHammer.github.io/digint) for more information.\r\n\r\n## Licence\r\n\r\nThis is licensed under the Mozilla Public License 2.0 (MPL 2.0) Licence. See the Licence file in this repository for more information.\r\n\r\n## Contribute\r\n\r\nContributions are always welcome!\r\nUse the [github repository](https://github.com/MarkusHammer/digint) to report issues and contribute to this project.\r\n\r\n## Credits\r\n\r\nWhile not required, feel free to credit \"Markus Hammer\" (or just \"Markus\") if you find this code or script useful for whatever you may be doing with it.\r\n\r\n# Security Policy\r\n\r\nWhile the python source code will be actively maintained, any binary files (if at all provided) are in no way supported.\r\nThese are provided as a courtesy and are not intended to be the main usage of this software.\r\nPlease keep this in mind when choosing how you wish to use this software.\r\n\r\n## Supported Versions\r\n\r\n| Version     | Supported |\r\n| ----------- | --------- |\r\n| 1.0.0.0\u00a0>= | \u2705        |\r\n| 1.0.0.0\u00a0<  | \u274c        |\r\n\r\n## Reporting a Vulnerability\r\n\r\nPlease report any issues to the email 107761433+MarkusHammer(THEN THE @ SYMBOL HERE)users.noreply.github.com\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A python module for manipulating positional integers across any numerical base, providing advanced digit-level control.",
    "version": "1.0.3.0",
    "project_urls": {
        "Documentation": "https://MarkusHammer.github.io/digint",
        "Git": "https://github.com/MarkusHammer/digint.git",
        "Github": "https://github.com/MarkusHammer/digint",
        "Homepage": "https://github.com/MarkusHammer/digint",
        "Issues": "https://github.com/MarkusHammer/digint/issues",
        "Pull Requests": "https://github.com/MarkusHammer/digint/pulls"
    },
    "split_keywords": [
        "integer",
        " digit",
        " digitwise",
        " bitwise",
        " manipulation",
        " number",
        " numeric",
        " numerical",
        " bases",
        " positional",
        " number systems",
        " mathematics",
        " binary",
        " hexadecimal",
        " custom",
        " notation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fffd659537ad8fa8e074ff962423ef8e6e975dfea51efc96c8c3d2ba574801cd",
                "md5": "9db05ed278ac0ca1ad4f90e75ef0f08d",
                "sha256": "49fd1cc07678d96d859c8396846e345758d404f7b205b161937178a454470f2f"
            },
            "downloads": -1,
            "filename": "digint-1.0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9db05ed278ac0ca1ad4f90e75ef0f08d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 24197,
            "upload_time": "2024-10-12T20:55:08",
            "upload_time_iso_8601": "2024-10-12T20:55:08.139479Z",
            "url": "https://files.pythonhosted.org/packages/ff/fd/659537ad8fa8e074ff962423ef8e6e975dfea51efc96c8c3d2ba574801cd/digint-1.0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fd86e833cdfa17ddf246d4ed17347b0c01e0d640dd2f44b34b46105796101350",
                "md5": "715306419bc1cb67a29af227773baefb",
                "sha256": "03dbccda62ee7a22683c14dcdbf6f50debcba58ee045bfe6516c64e938bb8294"
            },
            "downloads": -1,
            "filename": "digint-1.0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "715306419bc1cb67a29af227773baefb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 24783,
            "upload_time": "2024-10-12T20:55:10",
            "upload_time_iso_8601": "2024-10-12T20:55:10.119868Z",
            "url": "https://files.pythonhosted.org/packages/fd/86/e833cdfa17ddf246d4ed17347b0c01e0d640dd2f44b34b46105796101350/digint-1.0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-12 20:55:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "MarkusHammer",
    "github_project": "digint",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "digint"
}
        
Elapsed time: 0.53893s