# 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
[![MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE)
Raw data
{
"_id": null,
"home_page": "https://gitlab.com/flywheel-io/tools/lib/fw-utils",
"name": "fw-utils",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "Flywheel,helper,utility",
"author": "Flywheel",
"author_email": "support@flywheel.io",
"download_url": "",
"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[![MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Common Flywheel helper utilities.",
"version": "4.4.0",
"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": "619c6c291c5c0ef209a60ad72497cecbbabfcf6a18fbd8f3ef7e36cd701cb1f1",
"md5": "b0aaae20ff2cd98fc6f72976998c2471",
"sha256": "ee2022abc86143bd1169dea174003467949e1a86f2b64c31281bf922c5fbaeb2"
},
"downloads": -1,
"filename": "fw_utils-4.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b0aaae20ff2cd98fc6f72976998c2471",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 23044,
"upload_time": "2024-01-18T11:15:18",
"upload_time_iso_8601": "2024-01-18T11:15:18.593289Z",
"url": "https://files.pythonhosted.org/packages/61/9c/6c291c5c0ef209a60ad72497cecbbabfcf6a18fbd8f3ef7e36cd701cb1f1/fw_utils-4.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-18 11:15:18",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "flywheel-io",
"gitlab_project": "tools",
"lcname": "fw-utils"
}