Name | magic-list JSON |
Version |
2.4.0
JSON |
| download |
home_page | None |
Summary | Magic List is a module that extends the built-in list type. |
upload_time | 2024-04-23 20:54:47 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | MIT License Copyright (c) 2024 Qexat Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
collections
list
built-in
extension
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
<!-- markdownlint-disable MD028 -->
# Magic List
![Logo](./docs/magic_list_banner.png)
[![Palestine support banner](https://raw.githubusercontent.com/Safouene1/support-palestine-banner/master/banner-support.svg)](https://irusa.org/middle-east/palestine/)
[![PyPI badge](https://img.shields.io/pypi/v/magic-list)](<https://pypi.org/project/magic-list/>)
[![Downloads](https://static.pepy.tech/badge/magic-list)](https://pepy.tech/project/magic-list)
[![Tests](https://github.com/qexat/magic-list/actions/workflows/tests.yml/badge.svg)](https://github.com/qexat/magic-list/actions)
[![Ruff](https://github.com/qexat/magic-list/actions/workflows/ruff.yml/badge.svg)](https://github.com/qexat/magic-list/actions)
[![Typechecking](https://github.com/qexat/magic-list/actions/workflows/typechecking.yml/badge.svg)](https://github.com/qexat/magic-list/actions)
[![License: MIT](https://img.shields.io/badge/License-MIT-purple.svg)](https://opensource.org/licenses/MIT)
Magic List is a module that extends the built-in list type.
[Documentation](https://qexat.github.io/magic-list/) 路 [PyPI package](https://pypi.org/project/magic-list/) 路 [How to install](#installation) 路 [Notes for contributors and maintainers](./README-dev.md)
> [!NOTE]
> Its development is entirely test-driven: it is battery-tested and requires a
> test coverage of 100%. It also provides type stubs.
## Installation
```sh
pip install magic-list
```
## Examples
### Fibonacci sequence
Let's write a function that given an integer `n`, returns the fibonacci sequence up to the `n`-th member.
For example, `fibonacci_sequence(10)` would return `[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]`.
```py
import operator
from magic_list import L, list
def fibonacci_sequence(n: int) -> list[int]:
# let's start by creating a list with the first two members, 0 and 1.
base = L[0, 1]
# we define a function that we will use to generate the next members of
# the sequence
def next_member(current: list[int]) -> int:
return current.take_right(2).sum()
return base.fill_right(next_member, n - 1)
```
> [!NOTE]
> The `L[0, 1]` notation is a way to construct magic lists nicely.
## Contributing
First of all, thank you for taking your time to participate in this project! 馃挄
You might want to check those:
- [Code of Conduct](./CODE_OF_CONDUCT.md) 路 a document to set standards for respectful and inclusive behavior within the community
- [README-dev.md](./README-dev.md) 路 documentation to help you familiarize with Magic List's workflow
- [Feature proposals](https://github.com/qexat/magic-list/issues/50) 路 a list of the proposed features in the past, present and future
Raw data
{
"_id": null,
"home_page": null,
"name": "magic-list",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "collections, list, built-in, extension",
"author": null,
"author_email": "Qexat <contact@qexat.com>",
"download_url": "https://files.pythonhosted.org/packages/84/ea/f6abff0c396aac58f754551f099a57a2e995cc3358c81cd41ec0f6f71b8f/magic_list-2.4.0.tar.gz",
"platform": null,
"description": "<!-- markdownlint-disable MD028 -->\n\n# Magic List\n\n![Logo](./docs/magic_list_banner.png)\n\n[![Palestine support banner](https://raw.githubusercontent.com/Safouene1/support-palestine-banner/master/banner-support.svg)](https://irusa.org/middle-east/palestine/)\n\n[![PyPI badge](https://img.shields.io/pypi/v/magic-list)](<https://pypi.org/project/magic-list/>)\n[![Downloads](https://static.pepy.tech/badge/magic-list)](https://pepy.tech/project/magic-list)\n[![Tests](https://github.com/qexat/magic-list/actions/workflows/tests.yml/badge.svg)](https://github.com/qexat/magic-list/actions)\n[![Ruff](https://github.com/qexat/magic-list/actions/workflows/ruff.yml/badge.svg)](https://github.com/qexat/magic-list/actions)\n[![Typechecking](https://github.com/qexat/magic-list/actions/workflows/typechecking.yml/badge.svg)](https://github.com/qexat/magic-list/actions)\n[![License: MIT](https://img.shields.io/badge/License-MIT-purple.svg)](https://opensource.org/licenses/MIT)\n\nMagic List is a module that extends the built-in list type.\n\n[Documentation](https://qexat.github.io/magic-list/) \u00b7 [PyPI package](https://pypi.org/project/magic-list/) \u00b7 [How to install](#installation) \u00b7 [Notes for contributors and maintainers](./README-dev.md)\n\n> [!NOTE]\n> Its development is entirely test-driven: it is battery-tested and requires a\n> test coverage of 100%. It also provides type stubs.\n\n## Installation\n\n```sh\npip install magic-list\n```\n\n## Examples\n\n### Fibonacci sequence\n\nLet's write a function that given an integer `n`, returns the fibonacci sequence up to the `n`-th member.\n\nFor example, `fibonacci_sequence(10)` would return `[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]`.\n\n```py\nimport operator\n\nfrom magic_list import L, list\n\ndef fibonacci_sequence(n: int) -> list[int]:\n # let's start by creating a list with the first two members, 0 and 1.\n base = L[0, 1]\n\n # we define a function that we will use to generate the next members of\n # the sequence\n def next_member(current: list[int]) -> int:\n return current.take_right(2).sum()\n\n return base.fill_right(next_member, n - 1)\n```\n\n> [!NOTE]\n> The `L[0, 1]` notation is a way to construct magic lists nicely.\n\n## Contributing\n\nFirst of all, thank you for taking your time to participate in this project! \ud83d\udc95\n\nYou might want to check those:\n\n- [Code of Conduct](./CODE_OF_CONDUCT.md) \u00b7 a document to set standards for respectful and inclusive behavior within the community\n- [README-dev.md](./README-dev.md) \u00b7 documentation to help you familiarize with Magic List's workflow\n- [Feature proposals](https://github.com/qexat/magic-list/issues/50) \u00b7 a list of the proposed features in the past, present and future\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 Qexat Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "Magic List is a module that extends the built-in list type.",
"version": "2.4.0",
"project_urls": {
"documentation": "https://qexat.github.io/magic-list/",
"repository": "https://github.com/qexat/magic-list"
},
"split_keywords": [
"collections",
" list",
" built-in",
" extension"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fda9156b0773f6c717f60138096ea6e9a0a06501f0ff6eaba38708f434df16d7",
"md5": "6b11e14af388799dbadbb861c500db06",
"sha256": "c9b45988049b93c6d3705b9c438a2fdde35ff6651ac7c4bd4e57f6be8a251131"
},
"downloads": -1,
"filename": "magic_list-2.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6b11e14af388799dbadbb861c500db06",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 12629,
"upload_time": "2024-04-23T20:54:45",
"upload_time_iso_8601": "2024-04-23T20:54:45.424337Z",
"url": "https://files.pythonhosted.org/packages/fd/a9/156b0773f6c717f60138096ea6e9a0a06501f0ff6eaba38708f434df16d7/magic_list-2.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "84eaf6abff0c396aac58f754551f099a57a2e995cc3358c81cd41ec0f6f71b8f",
"md5": "56fd14d7052c323b883fa6f224c78b2d",
"sha256": "63e202e0bd373cd4ecf2b56706121ff366ca3f1aef14d6966e1a5ce58cb75d80"
},
"downloads": -1,
"filename": "magic_list-2.4.0.tar.gz",
"has_sig": false,
"md5_digest": "56fd14d7052c323b883fa6f224c78b2d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 13163,
"upload_time": "2024-04-23T20:54:47",
"upload_time_iso_8601": "2024-04-23T20:54:47.177857Z",
"url": "https://files.pythonhosted.org/packages/84/ea/f6abff0c396aac58f754551f099a57a2e995cc3358c81cd41ec0f6f71b8f/magic_list-2.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-23 20:54:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "qexat",
"github_project": "magic-list",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "magic-list"
}