[![Coverage Status](https://coveralls.io/repos/github/i386x/vutils-python/badge.svg?branch=main)](https://coveralls.io/github/i386x/vutils-python?branch=main)
![CodeQL](https://github.com/i386x/vutils-python/actions/workflows/codeql.yml/badge.svg)
# vutils-python: Python Language Tools
This package provides a set of tools to deal with tasks related to Python
language environment, like copying data to or from objects, importing, object
analysis etc.
## Installation
To get `vutils-python`, just type
```sh
$ pip install vutils-python
```
## How To Use
Functions and classes provided by `vutils-python` can be accessed by importing
following submodules:
* `vutils.python.objects`
Each of these submodules is described in the following subsections.
### Objects Manipulation
Functions and classes that deals with Python objects, defined in
`vutils.python.objects` submodule, are
* `merge_data(dest, src)` merges data from `src` to `dest`. `src` and `dest`
must be of the same type. Examples:
```python
src = [1, 2, 3]
dest = [1, 2]
merge_data(dest, src)
# dest will be [1, 2, 1, 2, 3]
src = {1, 2, 3}
dest = {2, 4}
merge_data(dest, src)
# dest will be {1, 2, 3, 4}
src = {"a": "bc", 1: 2}
dest = {1: "a", "b": "c"}
merge_data(dest, src)
# dest will be {1: 2, "a": "bc", "b": "c"}
merge_data({}, [1]) # TypeError
```
* `ensure_key(mapping, key, default)` ensures `mapping` has a `key` of the same
type a `default`. If `key` is not in `mapping`, store `default` to `mapping`
under it.
* `ensure_no_key(mapping, key)` ensures `key` is not present in `mapping`.
* `flatten(obj)` flattens `obj` recursively if it is `list` or `tuple`.
Raw data
{
"_id": null,
"home_page": "https://github.com/i386x/vutils-python",
"name": "vutils-python",
"maintainer": "",
"docs_url": null,
"requires_python": "<4,>=3.7",
"maintainer_email": "",
"keywords": "python,utilities",
"author": "Ji\u0159\u00ed Ku\u010dera",
"author_email": "sanczes@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/4a/2e/90725233f98fa8d8c9aef381100c811772e0777c5fecb5391c5e6dde7caa/vutils-python-0.2.1.tar.gz",
"platform": "any",
"description": "[![Coverage Status](https://coveralls.io/repos/github/i386x/vutils-python/badge.svg?branch=main)](https://coveralls.io/github/i386x/vutils-python?branch=main)\n![CodeQL](https://github.com/i386x/vutils-python/actions/workflows/codeql.yml/badge.svg)\n\n# vutils-python: Python Language Tools\n\nThis package provides a set of tools to deal with tasks related to Python\nlanguage environment, like copying data to or from objects, importing, object\nanalysis etc.\n\n## Installation\n\nTo get `vutils-python`, just type\n```sh\n$ pip install vutils-python\n```\n\n## How To Use\n\nFunctions and classes provided by `vutils-python` can be accessed by importing\nfollowing submodules:\n* `vutils.python.objects`\n\nEach of these submodules is described in the following subsections.\n\n### Objects Manipulation\n\nFunctions and classes that deals with Python objects, defined in\n`vutils.python.objects` submodule, are\n* `merge_data(dest, src)` merges data from `src` to `dest`. `src` and `dest`\n must be of the same type. Examples:\n ```python\n src = [1, 2, 3]\n dest = [1, 2]\n merge_data(dest, src)\n # dest will be [1, 2, 1, 2, 3]\n\n src = {1, 2, 3}\n dest = {2, 4}\n merge_data(dest, src)\n # dest will be {1, 2, 3, 4}\n\n src = {\"a\": \"bc\", 1: 2}\n dest = {1: \"a\", \"b\": \"c\"}\n merge_data(dest, src)\n # dest will be {1: 2, \"a\": \"bc\", \"b\": \"c\"}\n\n merge_data({}, [1]) # TypeError\n ```\n* `ensure_key(mapping, key, default)` ensures `mapping` has a `key` of the same\n type a `default`. If `key` is not in `mapping`, store `default` to `mapping`\n under it.\n* `ensure_no_key(mapping, key)` ensures `key` is not present in `mapping`.\n* `flatten(obj)` flattens `obj` recursively if it is `list` or `tuple`.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python language tools",
"version": "0.2.1",
"split_keywords": [
"python",
"utilities"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ec9a89969640af5ae85d1061fb96c9d7fa1fff5403dc9d1a5a3db646c2c1c03f",
"md5": "38421a0c30d273f7fa60f858a464cc1a",
"sha256": "6beac9a71fd9e8962f738ddc8e64a697ad693c4953c6d44063d7e7fa948515ea"
},
"downloads": -1,
"filename": "vutils_python-0.2.1-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "38421a0c30d273f7fa60f858a464cc1a",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": "<4,>=3.7",
"size": 5537,
"upload_time": "2023-04-18T23:15:24",
"upload_time_iso_8601": "2023-04-18T23:15:24.259311Z",
"url": "https://files.pythonhosted.org/packages/ec/9a/89969640af5ae85d1061fb96c9d7fa1fff5403dc9d1a5a3db646c2c1c03f/vutils_python-0.2.1-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4a2e90725233f98fa8d8c9aef381100c811772e0777c5fecb5391c5e6dde7caa",
"md5": "04849e8210e577dbe5be907e9ce1ea7a",
"sha256": "9a847cb4a93a453c36c26798e9e9f1fdfcf963b617b109dd79aa0cda7c92a2ce"
},
"downloads": -1,
"filename": "vutils-python-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "04849e8210e577dbe5be907e9ce1ea7a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=3.7",
"size": 7626,
"upload_time": "2023-04-18T23:15:26",
"upload_time_iso_8601": "2023-04-18T23:15:26.548284Z",
"url": "https://files.pythonhosted.org/packages/4a/2e/90725233f98fa8d8c9aef381100c811772e0777c5fecb5391c5e6dde7caa/vutils-python-0.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-18 23:15:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "i386x",
"github_project": "vutils-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "vutils-python"
}