Qtils - pronounces as `cuteels` - is a syntactic sugar library to make sweet Python coding even sweeter.
Project description
Overview
Qtils - pronounces as cuteels - is a syntactic sugar library to make sweet Python coding even sweeter.
Dedication
This library is dedicated to Pál Hubai a.k.a. Surfy my programming Master, who thought me how to code when I was a child.
Documentation
Documentation is available at https://qtils.readthedocs.io/en/latest/
Features
Self-formatting object in PrettyObject
Two-way formatter/parser for file sizes, for example ‘5.4 GB’) in DataSize
Weak reference property decorator weakproperty
Cached property decorator cachedproperty
Class logger decorator logged
Common string transformations in qtils.string_utils
Installation
$ pip install qtils
Quick Examples
>>> from qtils import *
>>> d = qdict()
>>> d.hello = "world"
>>> d.hello
'world'
>>> class MyObject(PrettyObject):
... __pretty_format__ = PRETTY_FORMAT.BRIEF
... __pretty_fields__ = [
... 'hello',
... 'answer',
... ]
... def __init__(self, hello, answer):
... self.hello = hello
... self.answer = answer
>>> obj = MyObject('world', 42)
>>> print(obj)
<MyObject object at ... hello='world', answer=42>
>>> print(DataSize(123000))
123 k
>>> DataSize('1.45 megabytes')
1450000
See more examples and usage in examples and tutorials <https://qtils.readthedocs.io/en/latest/tutorial/index.html>.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.