{ "info": { "author": "Stephan Richter and the Zope Community", "author_email": "zope-dev@zope.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Zope3", "Intended Audience :: Developers", "License :: OSI Approved :: Zope Public License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP" ], "description": "==============\nUnit Converter\n==============\n\nThe unit converter is a simple utility to convert units. While it may seem to\nbe a trivial task initially, there are many different conventions and\ncombinations. Instead of inventing yet another unit conversion utility, this\npackage reuses the `units` shell command, which has the best implementation\nthat I have found out there.\n\n >>> from keas.unit import unit\n\nThe first step is to instantiate the unit converter object:\n\n >>> converter = unit.UnitConverter()\n\nBy default the converter uses the following path for the `units` command:\n\n >>> converter.executable\n '/usr/bin/units'\n\nSo let's make a simple unit conversion:\n\n >>> converter.convert('atm', 'kPa')\n Decimal(\"101.325\")\n\nThere are several options that can be set on the conversion object. The first\none is the output format, which allows you to specify the precision on the\noutput. Of course, we then convert this output to a decimal:\n\n >>> converter.format\n >>> converter.format = '%.15g' # 15 decimal places\n >>> converter.convert('atm', 'kPa')\n Decimal(\"101.325\")\n\nNext you can specify additional unit conversion data filenames, so that custom\nconversions can be loaded:\n\n >>> import os\n >>> datafile = os.path.join(\n ... os.path.dirname(unit.__file__), 'test-conversions.dat')\n\n >>> converter.filenames\n >>> converter.filenames = ('', datafile)\n\n >>> converter.convert('keas', 'l')\n Decimal(\"0.54321\")\n\n >>> converter.filenames = None\n\nAn empty name means that the default data file should be loaded as well.\n\nThe final option allows you to set whether the '-' character should be treated\nas a multiplication operator, since it is used as such in some notations.\n\n >>> converter.minusAsProduct\n False\n >>> converter.minusAsProduct = True\n\n >>> converter.convert('m-m-m', 'l')\n Decimal(\"1000\")\n\nFinally, let's have a look at some error scenarios.\n\n1. There is no known conversion from one unit to another:\n\n >>> converter.convert('kg', 'm')\n Traceback (most recent call last):\n ...\n UnitConversionError: ('/usr/bin/units -t -o %.15g -p \"kg\" \"m\"',\n 'conformability error')\n\n2. One of the units is unknown:\n\n >>> converter.convert('kg', 'foo')\n Traceback (most recent call last):\n ...\n UnitConversionError: ('/usr/bin/units -t -o %.15g -p \"kg\" \"foo\"',\n \"Unknown unit 'foo'\")\n\n3. One of the units contains an invalid expression:\n\n >>> converter.convert('kg', 'm *')\n Traceback (most recent call last):\n ...\n UnitConversionError: ('/usr/bin/units -t -o %.15g -p \"kg\" \"m *\"',\n \"Error in 'm *': Parse error\")\n\n\n=======\nCHANGES\n=======\n\n1.0.0 (2009-07-26)\n------------------\n\n- Initial release.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/keas.unit", "keywords": "zope3 security key management infrastructure nist 800-57", "license": "ZPL 2.1", "maintainer": null, "maintainer_email": null, "name": "keas.unit", "package_url": "https://pypi.org/project/keas.unit/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/keas.unit/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://pypi.python.org/pypi/keas.unit" }, "release_url": "https://pypi.org/project/keas.unit/1.0.0/", "requires_dist": null, "requires_python": null, "summary": "A simple wrapper around the 'units' shell command", "version": "1.0.0" }, "last_serial": 683104, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "0d593ac639e5d5423d984c022bc8d681", "sha256": "5589ff39acfe8c6a52a75ad9d80ef05e680f30466d806a17665fa55b38b2c26b" }, "downloads": -1, "filename": "keas.unit-1.0.0.tar.gz", "has_sig": false, "md5_digest": "0d593ac639e5d5423d984c022bc8d681", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5289, "upload_time": "2009-07-27T04:17:15", "url": "https://files.pythonhosted.org/packages/79/99/436dd14158dc9c7a0bfd50acf802ac1c84216223bc95acf17d5b960b3c70/keas.unit-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0d593ac639e5d5423d984c022bc8d681", "sha256": "5589ff39acfe8c6a52a75ad9d80ef05e680f30466d806a17665fa55b38b2c26b" }, "downloads": -1, "filename": "keas.unit-1.0.0.tar.gz", "has_sig": false, "md5_digest": "0d593ac639e5d5423d984c022bc8d681", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5289, "upload_time": "2009-07-27T04:17:15", "url": "https://files.pythonhosted.org/packages/79/99/436dd14158dc9c7a0bfd50acf802ac1c84216223bc95acf17d5b960b3c70/keas.unit-1.0.0.tar.gz" } ] }