pydrew


Namepydrew JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryA set of utilities for Python
upload_time2024-08-27 21:25:06
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pydrew
A set of tool for python projects

## Custom List Implementation

This repository contains a custom generic list implementation called `List`, which provides additional functionality beyond the built-in Python list. This class is designed using Python's type hinting capabilities to support type safety and offers various utility methods for list manipulation.

## Features

- Generic list implementation capable of handling any type `T`.
- Additional methods for enhanced list operations such as `concat`, `removeAt`, `where`, `group_by`, and more.
- Magic methods to support intuitive Pythonic operations like indexing, iteration, and concatenation.
- Ability to convert the list to different formats such as Python's native list or a dictionary.
- Includes methods to sort, filter, map, and group list elements based on conditions or properties.

## Usage

### Initialization

You can initialize a `List` in a few different ways:
```python
from your_module import List

# Initialize an empty list
my_list = List()

# Initialize from a Python list
my_list = List([1, 2, 3])

# Initialize from an iterator
my_list = List(iter([1, 2, 3]))
```

### Basic Operations
```python
my_list.add(4)          # Add 4 to the list
my_list.add(5, index=1) # Add 5 at index 1

my_list.remove(4)       # Remove the first occurrence of 4
my_list.remove_at(1)    # Remove element at index 1

first_item = my_list.first()  # Get the first element
last_item = my_list.last()    # Get the last element
item = my_list.at_index(2)    # Get element at index 2
```

### Advanced Operations
```python
even_numbers = my_list.where(lambda x: x % 2 == 0) # Filter even numbers
squares = my_list.select(lambda x: x ** 2)         # Square each element

sorted_list = my_list.sort(lambda x: x)            # Sort ascending
grouped = my_list.group_by('attribute')            # Group by object attribute

my_list.reverse()      # Reverse the list
my_list.clear()        # Clear all elements from the list
length = my_list.count() # Get the number of elements
python_list = my_list.to_list() # Convert to Python list

### Magic Methods
```python
another_list = List([6, 7, 8])
combined_list = my_list + another_list
difference_list = my_list - List([3, 4])
````


This README provides a comprehensive overview of the class, including initialization, basic and advanced operations, usage examples, and contribution guidelines. If the code is part of a larger module, you should replace `your_module` with the actual module name when importing.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pydrew",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Andrea Vincenzo Abbondanza <andreabbondanza@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/e4/ec/544f131256667cb4ad338e620db466e0aa106513a63b921c5a2659f2e1f8/pydrew-0.1.0.tar.gz",
    "platform": null,
    "description": "# pydrew\nA set of tool for python projects\n\n## Custom List Implementation\n\nThis repository contains a custom generic list implementation called `List`, which provides additional functionality beyond the built-in Python list. This class is designed using Python's type hinting capabilities to support type safety and offers various utility methods for list manipulation.\n\n## Features\n\n- Generic list implementation capable of handling any type `T`.\n- Additional methods for enhanced list operations such as `concat`, `removeAt`, `where`, `group_by`, and more.\n- Magic methods to support intuitive Pythonic operations like indexing, iteration, and concatenation.\n- Ability to convert the list to different formats such as Python's native list or a dictionary.\n- Includes methods to sort, filter, map, and group list elements based on conditions or properties.\n\n## Usage\n\n### Initialization\n\nYou can initialize a `List` in a few different ways:\n```python\nfrom your_module import List\n\n# Initialize an empty list\nmy_list = List()\n\n# Initialize from a Python list\nmy_list = List([1, 2, 3])\n\n# Initialize from an iterator\nmy_list = List(iter([1, 2, 3]))\n```\n\n### Basic Operations\n```python\nmy_list.add(4)          # Add 4 to the list\nmy_list.add(5, index=1) # Add 5 at index 1\n\nmy_list.remove(4)       # Remove the first occurrence of 4\nmy_list.remove_at(1)    # Remove element at index 1\n\nfirst_item = my_list.first()  # Get the first element\nlast_item = my_list.last()    # Get the last element\nitem = my_list.at_index(2)    # Get element at index 2\n```\n\n### Advanced Operations\n```python\neven_numbers = my_list.where(lambda x: x % 2 == 0) # Filter even numbers\nsquares = my_list.select(lambda x: x ** 2)         # Square each element\n\nsorted_list = my_list.sort(lambda x: x)            # Sort ascending\ngrouped = my_list.group_by('attribute')            # Group by object attribute\n\nmy_list.reverse()      # Reverse the list\nmy_list.clear()        # Clear all elements from the list\nlength = my_list.count() # Get the number of elements\npython_list = my_list.to_list() # Convert to Python list\n\n### Magic Methods\n```python\nanother_list = List([6, 7, 8])\ncombined_list = my_list + another_list\ndifference_list = my_list - List([3, 4])\n````\n\n\nThis README provides a comprehensive overview of the class, including initialization, basic and advanced operations, usage examples, and contribution guidelines. If the code is part of a larger module, you should replace `your_module` with the actual module name when importing.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A set of utilities for Python",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/andreabbondanza/pydrew",
        "Issues": "https://github.com/andreabbondanza/pydrew/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2330ae143da6c660c82cd2956712c6aea269da08729373197cc79e3576a68f55",
                "md5": "dbe1947809c801d18dfcd0ce97913771",
                "sha256": "a4914b948f7d71a1755c448a787f0dff3005a0ce0490e673589ecca3e324c797"
            },
            "downloads": -1,
            "filename": "pydrew-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dbe1947809c801d18dfcd0ce97913771",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 8021,
            "upload_time": "2024-08-27T21:25:05",
            "upload_time_iso_8601": "2024-08-27T21:25:05.209468Z",
            "url": "https://files.pythonhosted.org/packages/23/30/ae143da6c660c82cd2956712c6aea269da08729373197cc79e3576a68f55/pydrew-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e4ec544f131256667cb4ad338e620db466e0aa106513a63b921c5a2659f2e1f8",
                "md5": "db48b1507af3358fd34caf9d4507a86e",
                "sha256": "7f7e6ecb5aafc4f4d51c21069c0ad2d97bbfb026a350edc8657896c805820a50"
            },
            "downloads": -1,
            "filename": "pydrew-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "db48b1507af3358fd34caf9d4507a86e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 9672,
            "upload_time": "2024-08-27T21:25:06",
            "upload_time_iso_8601": "2024-08-27T21:25:06.812491Z",
            "url": "https://files.pythonhosted.org/packages/e4/ec/544f131256667cb4ad338e620db466e0aa106513a63b921c5a2659f2e1f8/pydrew-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-27 21:25:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "andreabbondanza",
    "github_project": "pydrew",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "pydrew"
}
        
Elapsed time: 0.32765s