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

fw_utils-5.0.3-py3-none-any.whl (24.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fw_utils-5.0.3-py3-none-any.whl
  • Upload date:
  • Size: 24.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/5.15.154+

File hashes

Hashes for fw_utils-5.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0c7fae1e97bb92052a47f24c83edf294dbcd695d96547f44345d824d08336b46
MD5 9df80f3a9e53a99ad2c6165d22d8c17b
BLAKE2b-256 0a18e87cdae8f8821a5f9684facf7e6ad116d826cac673700d0edc112778dae2

See more details on using hashes here.

Supported by

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