# Collections Utilities
### Collections utilities in Python.
![PyPI](https://img.shields.io/pypi/v/nrt-collections-utils?color=blueviolet&style=plastic)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/nrt-collections-utils?color=greens&style=plastic)
![PyPI - License](https://img.shields.io/pypi/l/nrt-collections-utils?color=blue&style=plastic)
![PyPI - Downloads](https://img.shields.io/pypi/dd/nrt-collections-utils?style=plastic)
![PyPI - Downloads](https://img.shields.io/pypi/dm/nrt-collections-utils?color=yellow&style=plastic)
[![Coverage Status](https://coveralls.io/repos/github/etuzon/python-nrt-collections-utils/badge.svg)](https://coveralls.io/github/etuzon/pytohn-nrt-collections-utils)
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/etuzon/python-nrt-collections-utils?style=plastic)
![GitHub last commit](https://img.shields.io/github/last-commit/etuzon/python-nrt-collections-utils?style=plastic)
[![DeepSource](https://app.deepsource.com/gh/etuzon/python-nrt-collections-utils.svg/?label=active+issues&show_trend=false&token=6DkafEgUmnMb_ExVLT-07eDM)](https://app.deepsource.com/gh/etuzon/python-nrt-collections-utils/)
## CollectionsUtil class
### Methods
| **Method** | **Description** | **Parameters** | **Returns** |
|-----------------------------|----------------------------------------|---------------------------------------|---------------------------------------------|
| `deep_args_to_list` | Flat deep structure arguments to list. | `args (tuple)` The arguments to flat. | `list` A flatten list. |
| `is_iter` | Check if object is iterable. | `obj` The object to check. | `bool` True if iterable, False otherwise. |
| `object_to_deep_collection` | Convert object to deep collection. | `obj` The object to convert. | `dict, list, set, tuple` A deep collection. |
### Examples:
- #### CollectionsUtil.deep_args_to_list
**Code**
```python
from collections_utils import CollectionsUtil
# Flat deep structure arguments to list
flat_args = CollectionsUtil.deep_args_to_list(1, 2, (3, 4, (5, 6, (7, 8, 9))))
print(flat_args)
```
**Output**
```
[1, 2, 3, 4, 5, 6, 7, 8, 9]
```
- #### CollectionsUtil.is_iter
**Code**
```python
from collections_utils import CollectionsUtil
# Check if object is iterable
print(CollectionsUtil.is_iter(1))
print(CollectionsUtil.is_iter([1, 2, 3]))
```
**Output**
```
False
True
```
## ListUtil class
### Methods
| **Method** | **Description** | **Parameters** | **Returns** |
|---------------------|---------------------|-----------------------------------------------------|--------------------------------------------------|
| `compare_lists` | Compare two lists. | `list_1 (list)` List 1.<br>`list_2 (list)` List 2. | `bool` True if lists are equal, False otherwise. |
| `remove_none` | Remove None values. | `list_ (list)` The list to remove None values from. | `list` The list without None values. |
| `remove_duplicates` | Remove duplicates. | `list_ (list)` The list to remove duplicates from. | `list` The list without duplicates. |
### Examples:
- #### ListUtil.compare_lists
**Code**
```python
from collections_utils import ListUtil
# Compare two lists
print(ListUtil.compare_lists([1, 3, 2], [1, 2, 3]))
print(ListUtil.compare_lists([1, 2, 3], [1, 2, 4]))
```
**Output**
```
True
False
```
- #### ListUtil.remove_none
**Code**
```python
from collections_utils import ListUtil
# Remove None values
print(ListUtil.remove_none([1, None, 2, None, 3]))
```
**Output**
```
[1, 2, 3]
```
- #### ListUtil.remove_duplicates
**Code**
```python
from collections_utils import ListUtil
# Remove duplicates
print(ListUtil.remove_duplicates([1, 2, 3, 1, 2, 3]))
```
**Output**
```
[1, 2, 3]
```
Raw data
{
"_id": null,
"home_page": "https://github.com/etuzon/python-nrt-collections-utils",
"name": "nrt-collections-utils",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "python, python3, python-3, tool, tools, collection, collections, utilities, utils, util, nrt, nrt-utils, collections-utils, collections-utilities, nrt-collections-utils, nrt-collections-utilities, list, list-utils, list-utilities, nrt-list-utils, nrt-list-utilities",
"author": "Eyal Tuzon",
"author_email": "Eyal Tuzon <eyal.tuzon.dev@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/fb/81/8fc9f053420379dd62177ce387c0bc381c7e284d9513c0c5596ae3ebc12d/nrt_collections_utils-1.0.1.tar.gz",
"platform": null,
"description": "# Collections Utilities\r\n\r\n### Collections utilities in Python.\r\n\r\n![PyPI](https://img.shields.io/pypi/v/nrt-collections-utils?color=blueviolet&style=plastic)\r\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/nrt-collections-utils?color=greens&style=plastic)\r\n![PyPI - License](https://img.shields.io/pypi/l/nrt-collections-utils?color=blue&style=plastic)\r\n![PyPI - Downloads](https://img.shields.io/pypi/dd/nrt-collections-utils?style=plastic)\r\n![PyPI - Downloads](https://img.shields.io/pypi/dm/nrt-collections-utils?color=yellow&style=plastic)\r\n[![Coverage Status](https://coveralls.io/repos/github/etuzon/python-nrt-collections-utils/badge.svg)](https://coveralls.io/github/etuzon/pytohn-nrt-collections-utils)\r\n![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/etuzon/python-nrt-collections-utils?style=plastic)\r\n![GitHub last commit](https://img.shields.io/github/last-commit/etuzon/python-nrt-collections-utils?style=plastic)\r\n[![DeepSource](https://app.deepsource.com/gh/etuzon/python-nrt-collections-utils.svg/?label=active+issues&show_trend=false&token=6DkafEgUmnMb_ExVLT-07eDM)](https://app.deepsource.com/gh/etuzon/python-nrt-collections-utils/)\r\n\r\n## CollectionsUtil class\r\n\r\n### Methods\r\n\r\n| **Method** | **Description** | **Parameters** | **Returns** |\r\n|-----------------------------|----------------------------------------|---------------------------------------|---------------------------------------------|\r\n| `deep_args_to_list` | Flat deep structure arguments to list. | `args (tuple)` The arguments to flat. | `list` A flatten list. |\r\n| `is_iter` | Check if object is iterable. | `obj` The object to check. | `bool` True if iterable, False otherwise. |\r\n| `object_to_deep_collection` | Convert object to deep collection. | `obj` The object to convert. | `dict, list, set, tuple` A deep collection. |\r\n### Examples:\r\n\r\n- #### CollectionsUtil.deep_args_to_list\r\n\r\n **Code**\r\n ```python\r\n from collections_utils import CollectionsUtil\r\n\r\n # Flat deep structure arguments to list\r\n flat_args = CollectionsUtil.deep_args_to_list(1, 2, (3, 4, (5, 6, (7, 8, 9))))\r\n print(flat_args)\r\n ```\r\n **Output**\r\n ```\r\n [1, 2, 3, 4, 5, 6, 7, 8, 9]\r\n ```\r\n- #### CollectionsUtil.is_iter\r\n\r\n **Code**\r\n ```python\r\n from collections_utils import CollectionsUtil\r\n\r\n # Check if object is iterable\r\n print(CollectionsUtil.is_iter(1))\r\n print(CollectionsUtil.is_iter([1, 2, 3]))\r\n ```\r\n **Output**\r\n ```\r\n False\r\n True\r\n ```\r\n\r\n## ListUtil class\r\n\r\n### Methods\r\n\r\n| **Method** | **Description** | **Parameters** | **Returns** |\r\n|---------------------|---------------------|-----------------------------------------------------|--------------------------------------------------|\r\n| `compare_lists` | Compare two lists. | `list_1 (list)` List 1.<br>`list_2 (list)` List 2. | `bool` True if lists are equal, False otherwise. |\r\n| `remove_none` | Remove None values. | `list_ (list)` The list to remove None values from. | `list` The list without None values. |\r\n| `remove_duplicates` | Remove duplicates. | `list_ (list)` The list to remove duplicates from. | `list` The list without duplicates. |\r\n\r\n### Examples:\r\n\r\n- #### ListUtil.compare_lists\r\n\r\n **Code**\r\n ```python\r\n from collections_utils import ListUtil\r\n\r\n # Compare two lists\r\n print(ListUtil.compare_lists([1, 3, 2], [1, 2, 3]))\r\n print(ListUtil.compare_lists([1, 2, 3], [1, 2, 4]))\r\n ```\r\n **Output**\r\n ```\r\n True\r\n False\r\n ```\r\n \r\n- #### ListUtil.remove_none\r\n\r\n **Code**\r\n ```python\r\n from collections_utils import ListUtil\r\n\r\n # Remove None values\r\n print(ListUtil.remove_none([1, None, 2, None, 3]))\r\n ```\r\n **Output**\r\n ```\r\n [1, 2, 3]\r\n ```\r\n \r\n- #### ListUtil.remove_duplicates\r\n\r\n **Code**\r\n ```python\r\n from collections_utils import ListUtil\r\n\r\n # Remove duplicates\r\n print(ListUtil.remove_duplicates([1, 2, 3, 1, 2, 3]))\r\n ```\r\n **Output**\r\n ```\r\n [1, 2, 3]\r\n ```\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Collections utilities in Python",
"version": "1.0.1",
"project_urls": {
"Bug Tracker": "https://github.com/etuzon/python-nrt-collections-utils/issues",
"Homepage": "https://github.com/etuzon/python-nrt-collections-utils",
"documentation": "https://github.com/etuzon/python-nrt-collections-utils/wiki"
},
"split_keywords": [
"python",
" python3",
" python-3",
" tool",
" tools",
" collection",
" collections",
" utilities",
" utils",
" util",
" nrt",
" nrt-utils",
" collections-utils",
" collections-utilities",
" nrt-collections-utils",
" nrt-collections-utilities",
" list",
" list-utils",
" list-utilities",
" nrt-list-utils",
" nrt-list-utilities"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "65f0ebd14d635f6d09ee254da9389d4b83ad2cad41eede052bf308eeda61fe78",
"md5": "6fa40c3e7aa72b15537e327765fc146c",
"sha256": "e72b619589dffda9ced78b03b5ed7c6b3e145e95389005784749345499bd4a22"
},
"downloads": -1,
"filename": "nrt_collections_utils-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6fa40c3e7aa72b15537e327765fc146c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 4831,
"upload_time": "2024-07-27T17:33:52",
"upload_time_iso_8601": "2024-07-27T17:33:52.825706Z",
"url": "https://files.pythonhosted.org/packages/65/f0/ebd14d635f6d09ee254da9389d4b83ad2cad41eede052bf308eeda61fe78/nrt_collections_utils-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "fb818fc9f053420379dd62177ce387c0bc381c7e284d9513c0c5596ae3ebc12d",
"md5": "21dc284eaaac216137298cded0ca0a46",
"sha256": "1259e5d415ebc15b8d7621ae8d0223d8bec643c636d470eff13fc73e9f515f3e"
},
"downloads": -1,
"filename": "nrt_collections_utils-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "21dc284eaaac216137298cded0ca0a46",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 4816,
"upload_time": "2024-07-27T17:33:55",
"upload_time_iso_8601": "2024-07-27T17:33:55.589092Z",
"url": "https://files.pythonhosted.org/packages/fb/81/8fc9f053420379dd62177ce387c0bc381c7e284d9513c0c5596ae3ebc12d/nrt_collections_utils-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-27 17:33:55",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "etuzon",
"github_project": "python-nrt-collections-utils",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [],
"lcname": "nrt-collections-utils"
}