# PyTomUtil
A collection of helpful utilties in Python.
Similar to the `tecoradors-elunico` package I have but that is just for useful decorators. This is any useful utility: function or class or other
## PyPI
Not yet published to PyPI but coming soon.
## Content
`frange` class works like `range` but allows floating point values. Requires `start`, `stop`, and `step` to always be specified
```python
class frange:
def __init__(self, start: float, stop: float, step: float) -> None:
...
def __iter__(self):
...
def __next__(self):
...
```
---
`lerp` is a function for linearly interpolating between two values according to a percentage between 0.0 and 1.0.
[Linear Interpolation in Wikipedia](https://en.wikipedia.org/wiki/Linear_interpolation)
```python
def lerp(a: float, b: float, t: float) -> float:
return (1 - t) * a + t * b
```
---
`SRGBColor` is a class for managing colors in SRGB color space. Works with linear interpolation between colors and `luminance` values. The class accepts r, g, b and optionally an alpha channel in the range 0.0 to 1.0.
```python
class SRGBColor:
def __init__(self, r: float, g: float, b: float, a: float = 1.0):
...
def lerp(self, other: "SRGBColor", percent: float) -> "SRGBColor":
...
@property
def luminance(self) -> float:
"""Given an sRGB color as 3 RGB values between 0 and 1, return their relative luminance"""
...
```
Raw data
{
"_id": null,
"home_page": "https://github.com/elunico/pytomutil",
"name": "pytomutil-elunico",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": null,
"author": "Thomas Povinelli",
"author_email": "tompov227@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/1a/8b/91420715830e1d564d7bde2de8e0bbe0604df5f847c05a092c5e92067535/pytomutil_elunico-0.0.8.tar.gz",
"platform": null,
"description": "# PyTomUtil\n\nA collection of helpful utilties in Python.\n\nSimilar to the `tecoradors-elunico` package I have but that is just for useful decorators. This is any useful utility: function or class or other\n\n## PyPI\n\nNot yet published to PyPI but coming soon.\n\n## Content\n\n`frange` class works like `range` but allows floating point values. Requires `start`, `stop`, and `step` to always be specified\n\n```python\nclass frange:\n def __init__(self, start: float, stop: float, step: float) -> None:\n ...\n\n def __iter__(self):\n ...\n\n def __next__(self):\n ...\n```\n\n---\n\n`lerp` is a function for linearly interpolating between two values according to a percentage between 0.0 and 1.0.\n\n[Linear Interpolation in Wikipedia](https://en.wikipedia.org/wiki/Linear_interpolation)\n\n```python\ndef lerp(a: float, b: float, t: float) -> float:\n return (1 - t) * a + t * b\n```\n\n---\n\n`SRGBColor` is a class for managing colors in SRGB color space. Works with linear interpolation between colors and `luminance` values. The class accepts r, g, b and optionally an alpha channel in the range 0.0 to 1.0.\n\n```python\nclass SRGBColor:\n def __init__(self, r: float, g: float, b: float, a: float = 1.0):\n ...\n\n def lerp(self, other: \"SRGBColor\", percent: float) -> \"SRGBColor\":\n ...\n\n @property\n def luminance(self) -> float:\n \"\"\"Given an sRGB color as 3 RGB values between 0 and 1, return their relative luminance\"\"\"\n ...\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "Library for parsing and writing Simple Property List (SPL) files",
"version": "0.0.8",
"project_urls": {
"Homepage": "https://github.com/elunico/pytomutil"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4be33183571b098c2d6fa5ddaa85f48eb22d005dfd4ce798375a7644df8d6342",
"md5": "9b40e56aa601875fae86ed373d1297c8",
"sha256": "2104289aa62eba7b5b7b254797286d10790febb3659df2a55721dce3d236967a"
},
"downloads": -1,
"filename": "pytomutil_elunico-0.0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9b40e56aa601875fae86ed373d1297c8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 10954,
"upload_time": "2024-11-21T04:38:20",
"upload_time_iso_8601": "2024-11-21T04:38:20.318785Z",
"url": "https://files.pythonhosted.org/packages/4b/e3/3183571b098c2d6fa5ddaa85f48eb22d005dfd4ce798375a7644df8d6342/pytomutil_elunico-0.0.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1a8b91420715830e1d564d7bde2de8e0bbe0604df5f847c05a092c5e92067535",
"md5": "eee0d116ed3e6c69c635e5c754a43263",
"sha256": "5e8076a022dd6d05e9b6d5f931297c464ee90540c415c60b6df630c661989a19"
},
"downloads": -1,
"filename": "pytomutil_elunico-0.0.8.tar.gz",
"has_sig": false,
"md5_digest": "eee0d116ed3e6c69c635e5c754a43263",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 10027,
"upload_time": "2024-11-21T04:38:21",
"upload_time_iso_8601": "2024-11-21T04:38:21.797811Z",
"url": "https://files.pythonhosted.org/packages/1a/8b/91420715830e1d564d7bde2de8e0bbe0604df5f847c05a092c5e92067535/pytomutil_elunico-0.0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-21 04:38:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "elunico",
"github_project": "pytomutil",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pytomutil-elunico"
}