{ "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, and Korean.\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.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{.po,.mo} # 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.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/jmoiron/humanize", "keywords": "humanize time size", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "humanize", "package_url": "https://pypi.org/project/humanize/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/humanize/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/jmoiron/humanize" }, "release_url": "https://pypi.org/project/humanize/0.5.1/", "requires_dist": null, "requires_python": null, "summary": "python humanize utilities", "version": "0.5.1" }, "last_serial": 1305697, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "95f5154b2ec9b520336287575e9fc691", "sha256": "8148550d84b2d88da38d215b60f06525e3a9b06fcefa6a90dd13eef700920879" }, "downloads": -1, "filename": "humanize-0.1.tar.gz", "has_sig": false, "md5_digest": "95f5154b2ec9b520336287575e9fc691", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5430, "upload_time": "2011-10-12T21:40:01", "url": "https://files.pythonhosted.org/packages/18/40/01f8478e99ef71c2f07eb1d937cd18eba45e1658f501d0ae529b5e0c5d3e/humanize-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "89aca8e1423d081c6df9137f116fc2db", "sha256": "fb84a13667c0d756fe6ec0ba5d290a4fd6757a5fb246acde48dc63f955bea289" }, "downloads": -1, "filename": "humanize-0.2.tar.gz", "has_sig": false, "md5_digest": "89aca8e1423d081c6df9137f116fc2db", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5693, "upload_time": "2012-01-19T03:48:12", "url": "https://files.pythonhosted.org/packages/56/c3/04ab9981c86beeed434c47732ade7bfe75b1f908f61f84d9fc9504ef3ca2/humanize-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "6e7cdb1b87fce2e8dbddbc938e53c466", "sha256": "cac4d900cbc7f6b07f71bef085a77e6fb0e3e477dcc8a07991d9b90d419c9ffc" }, "downloads": -1, "filename": "humanize-0.3.tar.gz", "has_sig": false, "md5_digest": "6e7cdb1b87fce2e8dbddbc938e53c466", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6145, "upload_time": "2012-12-21T16:17:46", "url": "https://files.pythonhosted.org/packages/05/eb/4a4a9cc6181be32a239bbbd0d7287b2ce0bccd7dedf17a38c7a14bbb2bba/humanize-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "097c744d978fb257e599418874e8ac8d", "sha256": "25dc96b456df0fe06b373671a9bca19aad3cbde26260a0439441dfeb468f87a2" }, "downloads": -1, "filename": "humanize-0.4.tar.gz", "has_sig": false, "md5_digest": "097c744d978fb257e599418874e8ac8d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10952, "upload_time": "2013-05-16T22:39:32", "url": "https://files.pythonhosted.org/packages/a8/aa/bd7bc1220b01dc99b3422fa49b30266f137c5d967e61d947e3e954ab81bb/humanize-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "2f00150400ae6a6e0e9767c18a3147cd", "sha256": "e51bf9956511e58693801fc8895c9b4012363bf9f0bca2f3c2777110b3ff68bc" }, "downloads": -1, "filename": "humanize-0.5.tar.gz", "has_sig": false, "md5_digest": "2f00150400ae6a6e0e9767c18a3147cd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13170, "upload_time": "2013-07-10T18:01:35", "url": "https://files.pythonhosted.org/packages/b3/01/083224e7ebffe0bc957fe2f83de04741eb2faea66b6e0659ad04a5ac4dc1/humanize-0.5.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "e8473d9dc1b220911cac2edd53b1d973", "sha256": "a43f57115831ac7c70de098e6ac46ac13be00d69abbf60bdcac251344785bb19" }, "downloads": -1, "filename": "humanize-0.5.1.tar.gz", "has_sig": false, "md5_digest": "e8473d9dc1b220911cac2edd53b1d973", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14250, "upload_time": "2014-11-13T16:43:12", "url": "https://files.pythonhosted.org/packages/8c/e0/e512e4ac6d091fc990bbe13f9e0378f34cf6eecd1c6c268c9e598dcf5bb9/humanize-0.5.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e8473d9dc1b220911cac2edd53b1d973", "sha256": "a43f57115831ac7c70de098e6ac46ac13be00d69abbf60bdcac251344785bb19" }, "downloads": -1, "filename": "humanize-0.5.1.tar.gz", "has_sig": false, "md5_digest": "e8473d9dc1b220911cac2edd53b1d973", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14250, "upload_time": "2014-11-13T16:43:12", "url": "https://files.pythonhosted.org/packages/8c/e0/e512e4ac6d091fc990bbe13f9e0378f34cf6eecd1c6c268c9e598dcf5bb9/humanize-0.5.1.tar.gz" } ] }