{ "info": { "author": "Jason Moiron", "author_email": "jmoiron@jmoiron.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 3" ], "description": "humanize\n--------\n\n.. image:: https://secure.travis-ci.org/jmoiron/humanize.png?branch=master\n :target: http://travis-ci.org/jmoiron/humanize\n\nThis modest package contains various common humanization utilities, like turning\na number into a fuzzy human readable duration ('3 minutes ago') or into a human\nreadable size or throughput. It works with python 2.7 and 3.3 and is localized\nto Russian, French, Korean and Slovak.\n\nusage\n-----\n\nInteger humanization::\n\n >>> import humanize\n >>> humanize.intcomma(12345)\n '12,345'\n >>> humanize.intword(123455913)\n '123.5 million'\n >>> humanize.intword(12345591313)\n '12.3 billion'\n >>> humanize.apnumber(4)\n 'four'\n >>> humanize.apnumber(41)\n '41'\n\nDate & time humanization::\n\n >>> import datetime\n >>> humanize.naturalday(datetime.datetime.now())\n 'today'\n >>> humanize.naturaldelta(datetime.timedelta(seconds=1001))\n '16 minutes'\n >>> humanize.naturalday(datetime.datetime.now() - datetime.timedelta(days=1))\n 'yesterday'\n >>> humanize.naturalday(datetime.date(2007, 6, 5))\n 'Jun 05'\n >>> humanize.naturaldate(datetime.date(2007, 6, 5))\n 'Jun 05 2007'\n >>> humanize.naturaltime(datetime.datetime.now() - datetime.timedelta(seconds=1))\n 'a second ago'\n >>> humanize.naturaltime(datetime.datetime.now() - datetime.timedelta(seconds=3600))\n 'an hour ago'\n\nFilesize humanization::\n\n >>> humanize.naturalsize(1000000)\n '1.0 MB'\n >>> humanize.naturalsize(1000000, binary=True)\n '976.6 KiB'\n >>> humanize.naturalsize(1000000, gnu=True)\n '976.6K'\n\n\nHuman readable floating point numbers::\n\n >>> humanize.fractional(1/3)\n '1/3'\n >>> humanize.fractional(1.5)\n '1 1/2'\n >>> humanize.fractional(0.3)\n '3/10'\n >>> humanize.fractional(0.333)\n '1/3'\n >>> humanize.fractional(1)\n '1'\n\nLocalization\n------------\n\nHow to change locale in runtime ::\n\n >>> print humanize.naturaltime(datetime.timedelta(seconds=3))\n 3 seconds ago\n >>> _t = humanize.i18n.activate('ru_RU')\n >>> print humanize.naturaltime(datetime.timedelta(seconds=3))\n 3 \u0441\u0435\u043a\u0443\u043d\u0434\u044b \u043d\u0430\u0437\u0430\u0434\n >>> humanize.i18n.deactivate()\n >>> print humanize.naturaltime(datetime.timedelta(seconds=3))\n 3 seconds ago\n\nYou can pass additional parameter *path* to :func:`activate` to specify a path to\nsearch locales in. ::\n\n >>> humanize.i18n.activate('pt_BR')\n IOError: [Errno 2] No translation file found for domain: 'humanize'\n >>> humanize.i18n.activate('pt_BR', path='path/to/my/portuguese/translation/')\n \n\nHow to add new phrases to existing locale files ::\n\n $ xgettext -o humanize.pot -k'_' -k'N_' -k'P_:1c,2' -l python humanize/*.py # extract new phrases\n $ msgmerge -U humanize/locale/ru_RU/LC_MESSAGES/humanize.po humanize.pot # add them to locale files\n $ msgfmt --check -o humanize/locale/ru_RU/LC_MESSAGES/humanize{.mo,.po} # compile to binary .mo\n\nHow to add new locale ::\n\n $ msginit -i humanize.pot -o humanize/locale//LC_MESSAGES/humanize.po --locale \n\nWhere is locale abbreviation, eg 'en_GB', 'pt_BR' or just 'ru', 'fr' etc.\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/jmoiron/humanize", "keywords": "humanize time size", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "humanize-k", "package_url": "https://pypi.org/project/humanize-k/", "platform": "", "project_url": "https://pypi.org/project/humanize-k/", "project_urls": { "Homepage": "http://github.com/jmoiron/humanize" }, "release_url": "https://pypi.org/project/humanize-k/0.5.2/", "requires_dist": null, "requires_python": "", "summary": "python humanize utilities", "version": "0.5.2" }, "last_serial": 2958812, "releases": { "0.5.2": [ { "comment_text": "", "digests": { "md5": "94316d9a648d5fd254c1b75d72954cef", "sha256": "04b3d589e2e45e69bc9c564bbf2dfbe7f7215a19bed7fb8c0ca4bc287ddd4573" }, "downloads": -1, "filename": "humanize_k-0.5.2-py2-none-any.whl", "has_sig": false, "md5_digest": "94316d9a648d5fd254c1b75d72954cef", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 32950, "upload_time": "2017-06-19T06:48:28", "url": "https://files.pythonhosted.org/packages/15/b8/cf3f918644482f10df7ce5fb67a04b894e95b0024aaa50a930aa97260b4e/humanize_k-0.5.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2c0732e325488eb39b1301d1edb3398b", "sha256": "bf9cb0ce7d3a5d1f39c65bb684165c88858feeffa848c11e00eea0820ce4a492" }, "downloads": -1, "filename": "humanize-k-0.5.2.tar.gz", "has_sig": false, "md5_digest": "2c0732e325488eb39b1301d1edb3398b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18666, "upload_time": "2017-06-19T06:55:40", "url": "https://files.pythonhosted.org/packages/07/a0/dc9bd45a37738f3b3b703dd1ae99ca54670d4a357cab433e5325ff54cf5b/humanize-k-0.5.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "94316d9a648d5fd254c1b75d72954cef", "sha256": "04b3d589e2e45e69bc9c564bbf2dfbe7f7215a19bed7fb8c0ca4bc287ddd4573" }, "downloads": -1, "filename": "humanize_k-0.5.2-py2-none-any.whl", "has_sig": false, "md5_digest": "94316d9a648d5fd254c1b75d72954cef", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 32950, "upload_time": "2017-06-19T06:48:28", "url": "https://files.pythonhosted.org/packages/15/b8/cf3f918644482f10df7ce5fb67a04b894e95b0024aaa50a930aa97260b4e/humanize_k-0.5.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2c0732e325488eb39b1301d1edb3398b", "sha256": "bf9cb0ce7d3a5d1f39c65bb684165c88858feeffa848c11e00eea0820ce4a492" }, "downloads": -1, "filename": "humanize-k-0.5.2.tar.gz", "has_sig": false, "md5_digest": "2c0732e325488eb39b1301d1edb3398b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18666, "upload_time": "2017-06-19T06:55:40", "url": "https://files.pythonhosted.org/packages/07/a0/dc9bd45a37738f3b3b703dd1ae99ca54670d4a357cab433e5325ff54cf5b/humanize-k-0.5.2.tar.gz" } ] }