# fw-utils
Helper utilities for common tasks including pluralization, formatting and
parsing human-readable file-sizes/time-deltas, creating attribute-accessible
dictionaries and opening files.
## Installation
Add as a `poetry` dependency to your project:
```bash
poetry add fw-utils
```
## Usage
```python
import fw_utils
# common string formatters
fw_utils.pluralize("file") == "files"
fw_utils.quantify(3, "file") == "3 files"
fw_utils.hrsize(1024) == "1.0K"
fw_utils.hrtime(90) == "1h 30m"
# get a dictionary with keys accessible as attrs
data = fw_utils.attrify({"key": "value"})
data.key == "value"
# File works with str|Path|file-like objects alike
with fw_utils.BinFile("/tmp/test.txt", write=True) as file:
file.write(b"text")
```
## Development
Install the project using `poetry` and enable `pre-commit`:
```bash
poetry install
pre-commit install
```
## License
[](LICENSE)
Raw data
{
"_id": null,
"home_page": "https://gitlab.com/flywheel-io/tools/lib/fw-utils",
"name": "fw-utils",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "Flywheel, helper, utility",
"author": "Flywheel",
"author_email": "support@flywheel.io",
"download_url": null,
"platform": null,
"description": "# fw-utils\n\nHelper utilities for common tasks including pluralization, formatting and\nparsing human-readable file-sizes/time-deltas, creating attribute-accessible\ndictionaries and opening files.\n\n## Installation\n\nAdd as a `poetry` dependency to your project:\n\n```bash\npoetry add fw-utils\n```\n\n## Usage\n\n```python\nimport fw_utils\n\n# common string formatters\nfw_utils.pluralize(\"file\") == \"files\"\nfw_utils.quantify(3, \"file\") == \"3 files\"\nfw_utils.hrsize(1024) == \"1.0K\"\nfw_utils.hrtime(90) == \"1h 30m\"\n\n# get a dictionary with keys accessible as attrs\ndata = fw_utils.attrify({\"key\": \"value\"})\ndata.key == \"value\"\n\n# File works with str|Path|file-like objects alike\nwith fw_utils.BinFile(\"/tmp/test.txt\", write=True) as file:\n file.write(b\"text\")\n```\n\n## Development\n\nInstall the project using `poetry` and enable `pre-commit`:\n\n```bash\npoetry install\npre-commit install\n```\n\n## License\n\n[](LICENSE)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Common Flywheel helper utilities.",
"version": "5.0.5",
"project_urls": {
"Documentation": "https://gitlab.com/flywheel-io/tools/lib/fw-utils",
"Homepage": "https://gitlab.com/flywheel-io/tools/lib/fw-utils",
"Repository": "https://gitlab.com/flywheel-io/tools/lib/fw-utils"
},
"split_keywords": [
"flywheel",
" helper",
" utility"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "47c814091e1bcc3b76920541fb16f4507248d0bdf6072a43d469760507997764",
"md5": "bd5fcf7f13ba6819ae5bea85cca73298",
"sha256": "adf1469c26738bd395e18810c67902cdeb202e49701fad77c60dcc021952adea"
},
"downloads": -1,
"filename": "fw_utils-5.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bd5fcf7f13ba6819ae5bea85cca73298",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 24570,
"upload_time": "2025-02-17T22:31:26",
"upload_time_iso_8601": "2025-02-17T22:31:26.128246Z",
"url": "https://files.pythonhosted.org/packages/47/c8/14091e1bcc3b76920541fb16f4507248d0bdf6072a43d469760507997764/fw_utils-5.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-17 22:31:26",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "flywheel-io",
"gitlab_project": "tools",
"lcname": "fw-utils"
}