/usr/lib/python2.7/dist-packages/humanize-0.5.1.egg-info/PKG-INFO is in python-humanize 0.5.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | Metadata-Version: 1.1
Name: humanize
Version: 0.5.1
Summary: python humanize utilities
Home-page: http://github.com/jmoiron/humanize
Author: Jason Moiron
Author-email: jmoiron@jmoiron.net
License: MIT
Description: humanize
--------
.. image:: https://secure.travis-ci.org/jmoiron/humanize.png?branch=master
:target: http://travis-ci.org/jmoiron/humanize
This modest package contains various common humanization utilities, like turning
a number into a fuzzy human readable duration ('3 minutes ago') or into a human
readable size or throughput. It works with python 2.7 and 3.3 and is localized
to Russian, French, and Korean.
usage
-----
Integer humanization::
>>> import humanize
>>> humanize.intcomma(12345)
'12,345'
>>> humanize.intword(123455913)
'123.5 million'
>>> humanize.intword(12345591313)
'12.3 billion'
>>> humanize.apnumber(4)
'four'
>>> humanize.apnumber(41)
'41'
Date & time humanization::
>>> import datetime
>>> humanize.naturalday(datetime.datetime.now())
'today'
>>> humanize.naturalday(datetime.datetime.now() - datetime.timedelta(days=1))
'yesterday'
>>> humanize.naturalday(datetime.date(2007, 6, 5))
'Jun 05'
>>> humanize.naturaldate(datetime.date(2007, 6, 5))
'Jun 05 2007'
>>> humanize.naturaltime(datetime.datetime.now() - datetime.timedelta(seconds=1))
'a second ago'
>>> humanize.naturaltime(datetime.datetime.now() - datetime.timedelta(seconds=3600))
'an hour ago'
Filesize humanization::
>>> humanize.naturalsize(1000000)
'1.0 MB'
>>> humanize.naturalsize(1000000, binary=True)
'976.6 KiB'
>>> humanize.naturalsize(1000000, gnu=True)
'976.6K'
Human readable floating point numbers::
>>> humanize.fractional(1/3)
'1/3'
>>> humanize.fractional(1.5)
'1 1/2'
>>> humanize.fractional(0.3)
'3/10'
>>> humanize.fractional(0.333)
'1/3'
>>> humanize.fractional(1)
'1'
Localization
------------
How to change locale in runtime ::
>>> print humanize.naturaltime(datetime.timedelta(seconds=3))
3 seconds ago
>>> _t = humanize.i18n.activate('ru_RU')
>>> print humanize.naturaltime(datetime.timedelta(seconds=3))
3 секунды назад
>>> humanize.i18n.deactivate()
>>> print humanize.naturaltime(datetime.timedelta(seconds=3))
3 seconds ago
You can pass additional parameter *path* to :func:`activate` to specify a path to
search locales in. ::
>>> humanize.i18n.activate('pt_BR')
IOError: [Errno 2] No translation file found for domain: 'humanize'
>>> humanize.i18n.activate('pt_BR', path='path/to/my/portuguese/translation/')
<gettext.GNUTranslations instance ...>
How to add new phrases to existing locale files ::
$ xgettext -o humanize.pot -k'_' -k'N_' -k'P_:1c,2' -l python humanize/*.py # extract new phrases
$ msgmerge -U humanize/locale/ru_RU/LC_MESSAGES/humanize.po humanize.pot # add them to locale files
$ msgfmt --check -o humanize/locale/ru_RU/LC_MESSAGES/humanize{.po,.mo} # compile to binary .mo
How to add new locale ::
$ msginit -i humanize.pot -o humanize/locale/<locale name>/LC_MESSAGES/humanize.po --locale <locale name>
Where <locale name> is locale abbreviation, eg 'en_GB', 'pt_BR' or just 'ru', 'fr' etc.
Keywords: humanize time size
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python
|