py-utls


Namepy-utls JSON
Version 0.3.0 PyPI version JSON
download
home_pagehttps://github.com/cyrildever/py-utls
SummaryUtilities for Python
upload_time2024-12-19 15:10:09
maintainerNone
docs_urlNone
authorCyril Dever
requires_python>=3.6
licenseNone
keywords python utils chunks flatten hexadecimal euclidean division
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # py-utls
_Utilities for Python_

![PyPI](https://img.shields.io/pypi/v/py-utls)
![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/cyrildever/py-utls)
![GitHub last commit](https://img.shields.io/github/last-commit/cyrildever/py-utls)
![GitHub issues](https://img.shields.io/github/issues/cyrildever/py-utls)
![GitHub](https://img.shields.io/github/license/cyrildever/py-utls)

`py-utls` is a small Python repository where I put all the useful stuff I regularly need in my projects. \
Feel free to use at your discretion with the appropriate license mentions.

_NB: I've developed the same kind of libraries for both [Go](https://github.com/cyrildever/go-utls) and [TypeScript](https://www.npmjs.com/package/ts-utls)._

### Usage

```console
pip install py-utls
```

This repository contains the following modules:
* `hex`:
  - `from_hex`: builds the byte array from a string;
  - `to_hex`: creates the hexadecimal representation of a byte array;
* `list`:
  - `chunk`: split a list into chunks of a maximum size;
  - `flatten`: transforms a list of list of items to a list of items;
* `number`:
  - `euclidean_division`: compute the euclidean division of the passed integers.


```python
from pyutls.hex import from_hex, to_hex
from pyutls.list import chunk, flatten
from pyutls.number import euclidean_division

# Hex utilities
barray = from_hex('1234abcd')
hex_string = to_hex(barray)
assertEqual(hex_string == '1234abcd')

# Flatten a list of list
chunks = chunk(some_list, size)
flat_list = flatten(chunks)
assertListEqual(flat_list == some_list)

# Euclidean division
quotient, remainder = euclidean_division(numerator, denominator)
assertEqual(quotient * denominator + remainder == numerator)
```


### Tests

```console
$ python3 -m unittest discover
```


### License

These modules are distributed under a MIT license. \
See the [LICENSE](LICENSE) file.


<hr />
&copy; 2022-2024 Cyril Dever. All rights reserved.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/cyrildever/py-utls",
    "name": "py-utls",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "python, utils, chunks, flatten, hexadecimal, euclidean division",
    "author": "Cyril Dever",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/d3/2b/31031e440630d8094c354d3833697c633e3e8605ab9c56e23f5bfbee6be7/py_utls-0.3.0.tar.gz",
    "platform": null,
    "description": "# py-utls\n_Utilities for Python_\n\n![PyPI](https://img.shields.io/pypi/v/py-utls)\n![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/cyrildever/py-utls)\n![GitHub last commit](https://img.shields.io/github/last-commit/cyrildever/py-utls)\n![GitHub issues](https://img.shields.io/github/issues/cyrildever/py-utls)\n![GitHub](https://img.shields.io/github/license/cyrildever/py-utls)\n\n`py-utls` is a small Python repository where I put all the useful stuff I regularly need in my projects. \\\nFeel free to use at your discretion with the appropriate license mentions.\n\n_NB: I've developed the same kind of libraries for both [Go](https://github.com/cyrildever/go-utls) and [TypeScript](https://www.npmjs.com/package/ts-utls)._\n\n### Usage\n\n```console\npip install py-utls\n```\n\nThis repository contains the following modules:\n* `hex`:\n  - `from_hex`: builds the byte array from a string;\n  - `to_hex`: creates the hexadecimal representation of a byte array;\n* `list`:\n  - `chunk`: split a list into chunks of a maximum size;\n  - `flatten`: transforms a list of list of items to a list of items;\n* `number`:\n  - `euclidean_division`: compute the euclidean division of the passed integers.\n\n\n```python\nfrom pyutls.hex import from_hex, to_hex\nfrom pyutls.list import chunk, flatten\nfrom pyutls.number import euclidean_division\n\n# Hex utilities\nbarray = from_hex('1234abcd')\nhex_string = to_hex(barray)\nassertEqual(hex_string == '1234abcd')\n\n# Flatten a list of list\nchunks = chunk(some_list, size)\nflat_list = flatten(chunks)\nassertListEqual(flat_list == some_list)\n\n# Euclidean division\nquotient, remainder = euclidean_division(numerator, denominator)\nassertEqual(quotient * denominator + remainder == numerator)\n```\n\n\n### Tests\n\n```console\n$ python3 -m unittest discover\n```\n\n\n### License\n\nThese modules are distributed under a MIT license. \\\nSee the [LICENSE](LICENSE) file.\n\n\n<hr />\n&copy; 2022-2024 Cyril Dever. All rights reserved.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Utilities for Python",
    "version": "0.3.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/cyrildever/py-utls/issues",
        "Homepage": "https://github.com/cyrildever/py-utls"
    },
    "split_keywords": [
        "python",
        " utils",
        " chunks",
        " flatten",
        " hexadecimal",
        " euclidean division"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "29fcbffac75abc95d8182ece6c954eaca9697b74869505429aeb962e126b3e12",
                "md5": "114fa1472c321b56920afcd5bd7e36b5",
                "sha256": "0e2339d609bd04bd7bcad29e1ff9788867df84fa8a3b00d880d7a01f6ee6e850"
            },
            "downloads": -1,
            "filename": "py_utls-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "114fa1472c321b56920afcd5bd7e36b5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 4110,
            "upload_time": "2024-12-19T15:10:07",
            "upload_time_iso_8601": "2024-12-19T15:10:07.223205Z",
            "url": "https://files.pythonhosted.org/packages/29/fc/bffac75abc95d8182ece6c954eaca9697b74869505429aeb962e126b3e12/py_utls-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d32b31031e440630d8094c354d3833697c633e3e8605ab9c56e23f5bfbee6be7",
                "md5": "efaf5a8d82cec3bbe27446130892b7a1",
                "sha256": "d70f22a3875ff9589a245bb711e87d617f3418732270560c0762571ed993d947"
            },
            "downloads": -1,
            "filename": "py_utls-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "efaf5a8d82cec3bbe27446130892b7a1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 4194,
            "upload_time": "2024-12-19T15:10:09",
            "upload_time_iso_8601": "2024-12-19T15:10:09.532131Z",
            "url": "https://files.pythonhosted.org/packages/d3/2b/31031e440630d8094c354d3833697c633e3e8605ab9c56e23f5bfbee6be7/py_utls-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-19 15:10:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cyrildever",
    "github_project": "py-utls",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "py-utls"
}
        
Elapsed time: 0.42186s