Name | fntypes JSON |
Version |
0.1.4.post3
JSON |
| download |
home_page | None |
Summary | None |
upload_time | 2024-09-06 15:02:45 |
maintainer | None |
docs_url | None |
author | timoniq |
requires_python | <4.0,>=3.11 |
license | None |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# fntypes
Functional typing in Python!
See [examples](/examples/)
See [documentation](/docs/index.md)
fntypes is based on the belief that raising exceptions **should be avoided**. Therefore, it offers a set of functional types needed to write better code. This type strategy grants your project with higher control over type system - improves control flow
Contributions are welcome
```python
@unwrapping
def send_funds(
sender_id: int,
receiver_id: int,
amount: decimal.Decimal,
) -> Result[TransactionID, str]:
sender = get_user(sender_id).expect("Sender is undefined")
receiver = get_user(receiver_id).expect("Receiver is undefined")
if sender.get_balance().unwrap() < amount:
return Error("Sender has not enough funds to complete transaction")
return Ok(
create_transaction(sender, receiver, amount)
.unwrap()
.transaction_id
)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "fntypes",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.11",
"maintainer_email": null,
"keywords": null,
"author": "timoniq",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/0c/d0/20c11b86f20442e64d2dabb9342525a041561130e81ad71cfc309f1d155e/fntypes-0.1.4.post3.tar.gz",
"platform": null,
"description": "# fntypes\n\nFunctional typing in Python!\n\nSee [examples](/examples/)\n\nSee [documentation](/docs/index.md)\n\nfntypes is based on the belief that raising exceptions **should be avoided**. Therefore, it offers a set of functional types needed to write better code. This type strategy grants your project with higher control over type system - improves control flow\n\nContributions are welcome\n\n\n```python\n@unwrapping\ndef send_funds(\n sender_id: int, \n receiver_id: int, \n amount: decimal.Decimal,\n) -> Result[TransactionID, str]:\n sender = get_user(sender_id).expect(\"Sender is undefined\")\n receiver = get_user(receiver_id).expect(\"Receiver is undefined\")\n if sender.get_balance().unwrap() < amount:\n return Error(\"Sender has not enough funds to complete transaction\")\n \n return Ok(\n create_transaction(sender, receiver, amount)\n .unwrap()\n .transaction_id\n )\n```",
"bugtrack_url": null,
"license": null,
"summary": null,
"version": "0.1.4.post3",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ed372fb47ec4d531cfca52bf7b18379eee3c418d789b230b0cf182331a30b1c2",
"md5": "541c289c8601726d55486c6d150b575b",
"sha256": "ea67b65d1f528de742f91cea433aaccb6f6dabfbe8ea2c579878388e7c1b3b3e"
},
"downloads": -1,
"filename": "fntypes-0.1.4.post3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "541c289c8601726d55486c6d150b575b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.11",
"size": 8766,
"upload_time": "2024-09-06T15:02:44",
"upload_time_iso_8601": "2024-09-06T15:02:44.175903Z",
"url": "https://files.pythonhosted.org/packages/ed/37/2fb47ec4d531cfca52bf7b18379eee3c418d789b230b0cf182331a30b1c2/fntypes-0.1.4.post3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0cd020c11b86f20442e64d2dabb9342525a041561130e81ad71cfc309f1d155e",
"md5": "270b3103f1964416705e88825e9c96dd",
"sha256": "da0b40925039ac98bff11b3f902cb1380c32671737ebc42014e26a327bd96811"
},
"downloads": -1,
"filename": "fntypes-0.1.4.post3.tar.gz",
"has_sig": false,
"md5_digest": "270b3103f1964416705e88825e9c96dd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.11",
"size": 5702,
"upload_time": "2024-09-06T15:02:45",
"upload_time_iso_8601": "2024-09-06T15:02:45.171383Z",
"url": "https://files.pythonhosted.org/packages/0c/d0/20c11b86f20442e64d2dabb9342525a041561130e81ad71cfc309f1d155e/fntypes-0.1.4.post3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-06 15:02:45",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "fntypes"
}