{ "info": { "author": "Tabish Mir", "author_email": "taabishm2@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# Arbitrary Base to Arbitrary Base Converter\n\n***Allows the conversion of a value in a given `base(a)` to the corresponding value in some other `base(b)`.*** The symbols used in both the base-systems can be provided by the user.\n\n### Usage:\n`change_base.change_base(value, initial_base, final_base, initial_base_symbols, final_base_symbols)`\n\n### Description:\nA value from a given set with `base = a` is converted to the equivalent value in some other `base = b`. \n*For example*, decimal values ***(Base10)*** can be transformed into Hex ***(Base16)*** or Octal ***(Base8)*** values.\n\nTransformation is achieved by first converting to decimal equivalent and then to the final base version through the following 2 functions:\n1. `base_to_decimal(val, base = 73, symbols = None)`\n2. `decimal_to_base(d, base, symbols = None)`\n\nIn the `base_to_decimal` function, `val` is the original value (*inputted as a string*) with base = `base`. `symbols` is a list to pass custom symbols for the system.\n\nIn the `decimal_to_base` function, `d` represents the original decimal value and `symbols` list stores the symbols used for this system with base = `base`\n\nThe symbols used to represent the system can be provided as custom input e.g. a value `$$&$##` may belong to a system with base = *3* and symbols `#, &, $`. This value can be converted to a decimal equivalent by calling:\n>`base_to_decimal(\"$$&$##\", 3, ['#', '&', '$'])`\n\nIn case the symbol list is not provided, the default ordered symbol list is used up to maximum of ***(Base73)***. The 73 symbols used are (*in this order*):\n***Digits* `(0-9)`, *Lowercase-Letters* `(a-z)`, *Uppercase-letters* `(A-Z)`, *Safe-symbols*** `[ $, -, _, ., +, !, *, ', (, ), , ]`\n\nThus, each of these symbols have a decimal equivalent = list index from *0* to *73* that is used for base conversion.\n\nThe two functions are combined in the definition of function `base_change`. Thus, to change some value *`'val'`* with base *`'ibase'`* and symbol set (in order) *`'isymbols'`* (***optional argument***) into the equivalent value in some base *'`fbase`'* and symbol set *'`fsymbols`'* (***optional argument***), call the function:\n- `base_change(val, ibase, fbase, isymbols, fsymbols)` \n\n#### Example Usages:\n- Converting from **Decimal** to **Binary**: `base_change('123',10,2)` -> `'1111011' #Output`\n- Converting from **Binary** to **Decimal**: `base_change('1111011',2,10)` -> `'123' #Output`\n- Converting from **Decimal** to **Hex**: `base_change('123',10,16)` -> `'7b'`\n- Converting from ***Base5*** (with default symbols `[0,1,2,3,4]`) to ***Base5*** (custom symbols `['t','w','i','s','t']`): `base_change('123',5,5,None,['t','w','i','s','t'])` -> `'wis'`\n- Converting from ***Base5*** (with custom symbols `['t','w','i','s','t']`) to ***Base10*** (default symbols): `base_change('witsittitsisits',5,10,['t','w','i','s','t'],None)` -> `'9697104823'`\n- Inverse of the last example: `base_change('9697104823',10,5,None,['t','w','i','s','t'])` -> `'witsittitsisits'`\n\n**Note**:\n- *The position of symbol in custom symbol list decides its decimal equivalent*\n- *Default symbol list consists of only 73 symbols. Thus maximum base conversion with default symbols is upto Base73*\n- *Since the apostrophe `'` sign is also usable as a default symbol, the input value strings should be enclosed with double quotes*\n- *All outputs are generated as strings*\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "change-base", "package_url": "https://pypi.org/project/change-base/", "platform": "", "project_url": "https://pypi.org/project/change-base/", "project_urls": { "Homepage": "https://github.com/" }, "release_url": "https://pypi.org/project/change-base/0.0.1/", "requires_dist": null, "requires_python": "", "summary": "Allows the conversion of a value with any base to the corresponding value in any other base-system", "version": "0.0.1" }, "last_serial": 5207925, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "34f8245fcfc8597068eb22eb92555461", "sha256": "79b9cfc02ea2bfa56ddf31e4ec3104a3d7470da9aaae4dbf0bd8874465b6b82a" }, "downloads": -1, "filename": "change_base-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "34f8245fcfc8597068eb22eb92555461", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5779, "upload_time": "2019-04-30T12:02:57", "url": "https://files.pythonhosted.org/packages/c6/cb/22809d4649221238bd0e8e761b8293689304c267da1d99f2dddb745c78e3/change_base-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f28fd60dfe9b4114d2e21b4d889b0c2c", "sha256": "83de4613ccd7c3a9220b5678890e51a88b6b493aaf2b699a8eb9c6d1b098a878" }, "downloads": -1, "filename": "change_base-0.0.1.tar.gz", "has_sig": false, "md5_digest": "f28fd60dfe9b4114d2e21b4d889b0c2c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3463, "upload_time": "2019-04-30T12:03:34", "url": "https://files.pythonhosted.org/packages/7b/e1/aea9c339ffb4d08ec1d3fb8944c1d9ee3190eaf8885bc468409bba42e4aa/change_base-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "34f8245fcfc8597068eb22eb92555461", "sha256": "79b9cfc02ea2bfa56ddf31e4ec3104a3d7470da9aaae4dbf0bd8874465b6b82a" }, "downloads": -1, "filename": "change_base-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "34f8245fcfc8597068eb22eb92555461", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5779, "upload_time": "2019-04-30T12:02:57", "url": "https://files.pythonhosted.org/packages/c6/cb/22809d4649221238bd0e8e761b8293689304c267da1d99f2dddb745c78e3/change_base-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f28fd60dfe9b4114d2e21b4d889b0c2c", "sha256": "83de4613ccd7c3a9220b5678890e51a88b6b493aaf2b699a8eb9c6d1b098a878" }, "downloads": -1, "filename": "change_base-0.0.1.tar.gz", "has_sig": false, "md5_digest": "f28fd60dfe9b4114d2e21b4d889b0c2c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3463, "upload_time": "2019-04-30T12:03:34", "url": "https://files.pythonhosted.org/packages/7b/e1/aea9c339ffb4d08ec1d3fb8944c1d9ee3190eaf8885bc468409bba42e4aa/change_base-0.0.1.tar.gz" } ] }