hyphenfrac


Namehyphenfrac JSON
Version 2.0 PyPI version JSON
download
home_pagehttps://github.com/xyzpw/hyphenfrac/
SummaryA basic utility designed to prettify and visualize fractions.
upload_time2024-04-05 12:03:47
maintainerxyzpw
docs_urlNone
authorxyzpw
requires_python>=3.7
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # hyphenfrac
![Pepy Total Downlods](https://img.shields.io/pepy/dt/hyphenfrac)
![PyPI - Version](https://img.shields.io/pypi/v/hyphenfrac)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/hyphenfrac)

A basic utility designed to prettify and visualize fractions.

## Usage
### Prerequisites
- A terminal accepting ANSI codes

### Displaying Fractions
Displaying a prettified fraction from a number:
```python
>>> import hyphenfrac, random
>>> hyphenfrac.visualize_number(random.randint(1, 100)/random.randint(1, 100))
20
-- + 1
49
>>>
```
You may also assign this value to a variable:
```python
>>> import hyphenfrac
>>> foo = hyphenfrac.make_pretty(1, 10)
>>> print(foo)
1
--
10
>>>
```
You can optionally use a dash instead of a hyphen-minus character for a vinculum:
```python
>>> import hyphenfrac
>>> hyphenfrac.visualize("ln(x) - ln(y)", "x - y", hyphen=False)
ln(x) - ln(y)
―――――――――――――
    x - y
>>>
```

### Creating Fractions
Fractions could also be used as their own object:
```python
>>> from hyphenfrac import Fraction
>>> myFrac = Fraction(numerator="Vd", denominator="CL", operation="", whole="ln(2)", hyphen=False)
>>> myFrac.display()
Vd
――  ln(2)
CL
>>> isinstance(myFrac, Fraction)
True
>>>
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/xyzpw/hyphenfrac/",
    "name": "hyphenfrac",
    "maintainer": "xyzpw",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": null,
    "author": "xyzpw",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/75/f5/061c7dd4e81de235299bb28e0afa7f4be464f04739579a1052f634d91bf3/hyphenfrac-2.0.tar.gz",
    "platform": null,
    "description": "# hyphenfrac\n![Pepy Total Downlods](https://img.shields.io/pepy/dt/hyphenfrac)\n![PyPI - Version](https://img.shields.io/pypi/v/hyphenfrac)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/hyphenfrac)\n\nA basic utility designed to prettify and visualize fractions.\n\n## Usage\n### Prerequisites\n- A terminal accepting ANSI codes\n\n### Displaying Fractions\nDisplaying a prettified fraction from a number:\n```python\n>>> import hyphenfrac, random\n>>> hyphenfrac.visualize_number(random.randint(1, 100)/random.randint(1, 100))\n20\n-- + 1\n49\n>>>\n```\nYou may also assign this value to a variable:\n```python\n>>> import hyphenfrac\n>>> foo = hyphenfrac.make_pretty(1, 10)\n>>> print(foo)\n1\n--\n10\n>>>\n```\nYou can optionally use a dash instead of a hyphen-minus character for a vinculum:\n```python\n>>> import hyphenfrac\n>>> hyphenfrac.visualize(\"ln(x) - ln(y)\", \"x - y\", hyphen=False)\nln(x) - ln(y)\n\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\u2015\n    x - y\n>>>\n```\n\n### Creating Fractions\nFractions could also be used as their own object:\n```python\n>>> from hyphenfrac import Fraction\n>>> myFrac = Fraction(numerator=\"Vd\", denominator=\"CL\", operation=\"\", whole=\"ln(2)\", hyphen=False)\n>>> myFrac.display()\nVd\n\u2015\u2015  ln(2)\nCL\n>>> isinstance(myFrac, Fraction)\nTrue\n>>>\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A basic utility designed to prettify and visualize fractions.",
    "version": "2.0",
    "project_urls": {
        "Homepage": "https://github.com/xyzpw/hyphenfrac/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "df49eaae205eb7945d1d2c502963e13cff8e9d6a88e404af13325bac85da781c",
                "md5": "a0057c8b66dd30bce96d4fa65d448568",
                "sha256": "07c3dff74d45ddf7ef32720d8345d1df41765bac8f35ad17c7ab116510167480"
            },
            "downloads": -1,
            "filename": "hyphenfrac-2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a0057c8b66dd30bce96d4fa65d448568",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 3735,
            "upload_time": "2024-04-05T12:03:45",
            "upload_time_iso_8601": "2024-04-05T12:03:45.549302Z",
            "url": "https://files.pythonhosted.org/packages/df/49/eaae205eb7945d1d2c502963e13cff8e9d6a88e404af13325bac85da781c/hyphenfrac-2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "75f5061c7dd4e81de235299bb28e0afa7f4be464f04739579a1052f634d91bf3",
                "md5": "3be6f539f594eba5bd895b7c76ff3484",
                "sha256": "3ac8666d50b2a36d2338c26d35c0215a525b64fa8ec6280af24984f68b850150"
            },
            "downloads": -1,
            "filename": "hyphenfrac-2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "3be6f539f594eba5bd895b7c76ff3484",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 3430,
            "upload_time": "2024-04-05T12:03:47",
            "upload_time_iso_8601": "2024-04-05T12:03:47.034593Z",
            "url": "https://files.pythonhosted.org/packages/75/f5/061c7dd4e81de235299bb28e0afa7f4be464f04739579a1052f634d91bf3/hyphenfrac-2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-05 12:03:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "xyzpw",
    "github_project": "hyphenfrac",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "hyphenfrac"
}
        
Elapsed time: 0.21658s