Name | leb128 JSON |
Version |
1.0.8
JSON |
| download |
home_page | None |
Summary | LEB128(Little Endian Base 128) |
upload_time | 2024-06-28 05:48:31 |
maintainer | None |
docs_url | None |
author | None |
requires_python | None |
license | MIT License Copyright (c) 2021 Mohanson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# LEB128
LEB128 or Little Endian Base 128 is a form of variable-length code compression used to store an arbitrarily large integer in a small number of bytes. LEB128 is used in the DWARF debug file format and the WebAssembly binary encoding for all integer literals.
```sh
$ pip3 install leb128
```
`leb128` has been used in [pywasm](https://github.com/mohanson/pywasm) and [emscripten](https://github.com/emscripten-core/emscripten).
# Example
```py
import io
import leb128
# unsigned leb128
assert leb128.u.encode(624485) == bytearray([0xe5, 0x8e, 0x26])
assert leb128.u.decode(bytearray([0xe5, 0x8e, 0x26])) == 624485
assert leb128.u.decode_reader(io.BytesIO(bytearray([0xe5, 0x8e, 0x26]))) == (624485, 3)
# signed leb128
assert leb128.i.encode(-12345) == bytearray([0xc7, 0x9f, 0x7f])
assert leb128.i.decode(bytearray([0xc7, 0x9f, 0x7f])) == -12345
assert leb128.i.decode_reader(io.BytesIO(bytearray([0xc7, 0x9f, 0x7f]))) == (-12345, 3)
```
# License
MIT
Raw data
{
"_id": null,
"home_page": null,
"name": "leb128",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "Mohanson <mohanson@outlook.com>",
"download_url": "https://files.pythonhosted.org/packages/43/3b/476c8bcb181abb060e45bca5ce9b5ba055ea9e2ed3fac6c25b2fe7b9f16b/leb128-1.0.8.tar.gz",
"platform": null,
"description": "# LEB128\n\nLEB128 or Little Endian Base 128 is a form of variable-length code compression used to store an arbitrarily large integer in a small number of bytes. LEB128 is used in the DWARF debug file format and the WebAssembly binary encoding for all integer literals.\n\n```sh\n$ pip3 install leb128\n```\n\n`leb128` has been used in [pywasm](https://github.com/mohanson/pywasm) and [emscripten](https://github.com/emscripten-core/emscripten).\n\n# Example\n\n```py\nimport io\nimport leb128\n\n# unsigned leb128\nassert leb128.u.encode(624485) == bytearray([0xe5, 0x8e, 0x26])\nassert leb128.u.decode(bytearray([0xe5, 0x8e, 0x26])) == 624485\nassert leb128.u.decode_reader(io.BytesIO(bytearray([0xe5, 0x8e, 0x26]))) == (624485, 3)\n\n# signed leb128\nassert leb128.i.encode(-12345) == bytearray([0xc7, 0x9f, 0x7f])\nassert leb128.i.decode(bytearray([0xc7, 0x9f, 0x7f])) == -12345\nassert leb128.i.decode_reader(io.BytesIO(bytearray([0xc7, 0x9f, 0x7f]))) == (-12345, 3)\n```\n\n# License\n\nMIT\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2021 Mohanson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "LEB128(Little Endian Base 128)",
"version": "1.0.8",
"project_urls": {
"homepage": "https://github.com/mohanson/leb128"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "099745ab4bab1a89e6fdbc822f818bb18b39eed0dd7ed1faac8b89bc6b49a9ed",
"md5": "478a104ca1e56a2bc18e48e990183508",
"sha256": "76cd271e75ea91aa2fbf7783d60cb7d667b62143d544bcee59159ff258bf4523"
},
"downloads": -1,
"filename": "leb128-1.0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "478a104ca1e56a2bc18e48e990183508",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 3778,
"upload_time": "2024-06-28T05:48:29",
"upload_time_iso_8601": "2024-06-28T05:48:29.398596Z",
"url": "https://files.pythonhosted.org/packages/09/97/45ab4bab1a89e6fdbc822f818bb18b39eed0dd7ed1faac8b89bc6b49a9ed/leb128-1.0.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "433b476c8bcb181abb060e45bca5ce9b5ba055ea9e2ed3fac6c25b2fe7b9f16b",
"md5": "96d7fc6e95af1e8448763153b8567da1",
"sha256": "3a52dca242f93f87a3d766380a93a3fad53ef4044f03018d21705d3b2d9021ee"
},
"downloads": -1,
"filename": "leb128-1.0.8.tar.gz",
"has_sig": false,
"md5_digest": "96d7fc6e95af1e8448763153b8567da1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3361,
"upload_time": "2024-06-28T05:48:31",
"upload_time_iso_8601": "2024-06-28T05:48:31.697933Z",
"url": "https://files.pythonhosted.org/packages/43/3b/476c8bcb181abb060e45bca5ce9b5ba055ea9e2ed3fac6c25b2fe7b9f16b/leb128-1.0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-28 05:48:31",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mohanson",
"github_project": "leb128",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "leb128"
}