Skip to main content

Common Flywheel helper utilities.

Project description

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:

poetry add fw-utils

Usage

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:

poetry install
pre-commit install

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fw_utils-5.1.1-py3-none-any.whl (26.1 kB view details)

Uploaded Python 3

File details

Details for the file fw_utils-5.1.1-py3-none-any.whl.

File metadata

  • Download URL: fw_utils-5.1.1-py3-none-any.whl
  • Upload date:
  • Size: 26.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for fw_utils-5.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9c0a9df01bd438deaa4c0f8c977c50410293771b5223e4464ebf3f780e93afca
MD5 5f6cca005b6910bd0013e920c8681ecd
BLAKE2b-256 5b9407fb3e55b057a33ba9670c5e18339b3d453b1b8f57a3e9954eb5d7bb171f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page