# Falconpunch
Rust bindings for Python [Overpunch](https://github.com/capitalrx/overpunch), a [signed overpunch](https://en.wikipedia.org/wiki/Signed_overpunch) support library suitable for interacting
with [Decimal](https://docs.python.org/3/library/decimal.html) values.
## Installing
```sh
$ pip install falconpunch
```
## Usage
To parse signed overpunch numbers:
```python
from decimal import Decimal
from falconpunch import convert_from_signed_format, extract
number = convert_from_signed_format("2258{", "s9(7)v99")
assert number == Decimal("225.80")
number = extract("2258{", 2)
assert number == Decimal("225.80")
```
To format values to signed overpunch:
```python
from decimal import Decimal
from falconpunch import convert_to_signed_format, format
formatted = convert_to_signed_format(Decimal("225.80"), "s9(7)v99")
assert formatted == "2258{"
formatted = format(Decimal("225.80"), 2)
assert formatted == "2258{"
```
Raw data
{
"_id": null,
"home_page": null,
"name": "falconpunch",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": "overpunch, cobol, ibm, mainframe",
"author": "Roman Sorin <romansorin@cap-rx.com>",
"author_email": "Roman Sorin <romansorin@cap-rx.com>",
"download_url": "https://files.pythonhosted.org/packages/de/0e/ea0750911d7d4866998ece8cbaf9908d5e19f25102d88353fc9ee530ed7d/falconpunch-1.0.tar.gz",
"platform": null,
"description": "# Falconpunch\n\nRust bindings for Python [Overpunch](https://github.com/capitalrx/overpunch), a [signed overpunch](https://en.wikipedia.org/wiki/Signed_overpunch) support library suitable for interacting\nwith [Decimal](https://docs.python.org/3/library/decimal.html) values.\n\n## Installing\n\n```sh\n$ pip install falconpunch\n```\n\n## Usage\n\nTo parse signed overpunch numbers:\n\n```python\nfrom decimal import Decimal\nfrom falconpunch import convert_from_signed_format, extract\n\nnumber = convert_from_signed_format(\"2258{\", \"s9(7)v99\")\nassert number == Decimal(\"225.80\")\n\nnumber = extract(\"2258{\", 2)\nassert number == Decimal(\"225.80\")\n```\n\nTo format values to signed overpunch:\n\n```python\nfrom decimal import Decimal\nfrom falconpunch import convert_to_signed_format, format\n\nformatted = convert_to_signed_format(Decimal(\"225.80\"), \"s9(7)v99\")\nassert formatted == \"2258{\"\n\nformatted = format(Decimal(\"225.80\"), 2)\nassert formatted == \"2258{\"\n```\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Rust bindings for Overpunch parsing/formatting",
"version": "1.0",
"project_urls": null,
"split_keywords": [
"overpunch",
" cobol",
" ibm",
" mainframe"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "de0eea0750911d7d4866998ece8cbaf9908d5e19f25102d88353fc9ee530ed7d",
"md5": "c44196196cfcb30b04c5a6ab20fb6fe7",
"sha256": "58d8bda0e08c4933a26a3f54710399853fda9622f2e3deae295cc1b1783938d3"
},
"downloads": -1,
"filename": "falconpunch-1.0.tar.gz",
"has_sig": false,
"md5_digest": "c44196196cfcb30b04c5a6ab20fb6fe7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 7383,
"upload_time": "2024-11-03T21:03:12",
"upload_time_iso_8601": "2024-11-03T21:03:12.443940Z",
"url": "https://files.pythonhosted.org/packages/de/0e/ea0750911d7d4866998ece8cbaf9908d5e19f25102d88353fc9ee530ed7d/falconpunch-1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-03 21:03:12",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "falconpunch"
}