{ "info": { "author": "Thomas Woolford", "author_email": "woolford.thomas@gmail.com", "bugtrack_url": null, "classifiers": [], "description": " Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n\nDescription: This is a Named Binary Tag parser based upon the specification by Markus Persson.\n \n From The spec:\n \"NBT (Named Binary Tag) is a tag based binary format designed to carry large\n amounts of binary data with smaller amounts of additional data.\n An NBT file consists of a single GZIPped Named Tag of type TAG_Compound.\"\n \n read the full spec at http://www.minecraft.net/docs/NBT.txt\n \n Usage:\n 1) Reading files.\n \n The easiest way to read an nbt file is to instantiate an NBTFile object e.g.\n \n >>> import nbt\n >>> nbtfile = nbt.NBTFile(\"bigtest.nbt\",'rb')\n >>> nbtfile.name\n u'Level'\n >>> nbtfile[\"nested compound test\"].tag_info()\n TAG_Compound(\"nested compound test\"): 2 Entries\n >>> for tag in nbtfile[\"nested compound test\"][\"ham\"].tags:\n ... print(tag.tag_info())\n ...\n TAG_String(\"name\"): Hampus\n TAG_Float(\"value\"): 0.75\n >>> [tag.value for tag in nbtfile[\"listTest (long)\"].value]\n [11, 12, 13, 14, 15]\n \n Files can also be read from a fileobj (file-like object that contains a compressed\n stream) or a buffer (file-like object that contains an uncompressed stream of NBT\n Tags) which can be accomplished thusly:\n \n >>> import nbt\n >>> nbtfile = NBTFile(fileobj=previously_opened_file)\n # or....\n >>> nbtfile = NBTFile(buffer=net_socket.makefile())\n \n 2) Writing files.\n \n Writing files is easy too! if you have a NBTFile object, simply call it's\n write_file() method. If the NBTFile was instantiated with a filename, then\n write_file needs no extra arguments. It just works. If however you created a new\n file object from scratch (or even if you just want to save it somewhere else)\n call write_file('path\\to\\new\\file.nbt')\n \n >>> import nbt\n >>> nbtfile = nbt.NBTFile(\"bigtest.nbt\",'rb')\n >>> nbtfile[\"listTest (compound)\"].tags[0][\"name\"].value = \"Different name\"\n >>> nbtfile.write_file(\"newnbtfile.nbt\")\n \n It is also possible to write to a buffer or fileobj using the same keyword args.\n \n >>> nbtfile.write_file(fileobj = my_file) #compressed\n >>> nbtfile.write_file(buffer = sock.makefile()) #uncompressed\n \n 3) Creating files\n \n Creating files is trickier but ultimately should give you no issue, as long as\n you have read the NBT spec (hint.. it's very short). Also be sure to note that\n the NBTFile object is actually a TAG_Compound with some wrapper features, so\n you can use all the standard tag features\n \n >>> from nbt import *\n >>> nbtfile = NBTFile()\n \n first, don't forget to name the top level tag\n \n >>> nbtfile.name = \"My Top Level Tag\"\n >>> nbtfile.tags.append(TAG_Float(name=\"My Float Name\", value=3.152987593947))\n >>> mylist = TAG_List(name=\"TestList\", type=TAG_Long) #type needs to be pre-declared!\n >>> mylist.tags.append(TAG_Long(100))\n >>> mylist.tags.extend([TAG_Long(120),TAG_Long(320),TAG_Long(19)])\n >>> nbtfile.tags.append(mylist)\n >>> print(nbtfile.pretty_tree())\n TAG_Compound(\"My Top Level Tag\"): 2 Entries\n {\n TAG_Float(\"My Float Name\"): 3.15298759395\n TAG_List(\"TestList\"): 4 entries of type TAG_Long\n {\n TAG_Long: 100\n TAG_Long: 120\n TAG_Long: 320\n TAG_Long: 19\n }\n }\n >>> nbtfile[\"TestList\"].tags.sort(key = lambda tag: tag.value)\n >>> print(nbtfile.pretty_tree())\n TAG_Compound(\"My Top Level Tag\"): 2 Entries\n {\n TAG_Float(\"My FloatName\"): 3.15298759395\n TAG_List(\"TestList\"): 4 entries of type TAG_Long\n {\n TAG_Long: 19\n TAG_Long: 100\n TAG_Long: 120\n TAG_Long: 320\n }\n }\n >>> nbtfile.write_file(\"mynbt.dat\")\n \nPlatform: UNKNOWN\nClassifier: Development Status :: 5 - Production/Stable\nClassifier: Intended Audience :: Developers\nClassifier: License :: OSI Approved :: MIT License\nClassifier: Operating System :: OS Independent\nClassifier: Programming Language :: Python\nClassifier: Programming Language :: Python :: 2.7\nClassifier: Programming Language :: Python :: 3.3\nClassifier: Programming Language :: Python :: 3.4\nClassifier: Programming Language :: Python :: 3.5\nClassifier: Programming Language :: Python :: 3.6\nClassifier: Topic :: Games/Entertainment\nClassifier: Topic :: Software Development :: Libraries :: Python Modules\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/twoolie/NBT", "keywords": "", "license": "Copyright (c) 2010-2013 Thomas Woolford and contributors", "maintainer": "", "maintainer_email": "", "name": "NBT", "package_url": "https://pypi.org/project/NBT/", "platform": "", "project_url": "https://pypi.org/project/NBT/", "project_urls": { "Homepage": "http://github.com/twoolie/NBT" }, "release_url": "https://pypi.org/project/NBT/1.5.0/", "requires_dist": null, "requires_python": "", "summary": "Named Binary Tag Reader/Writer", "version": "1.5.0" }, "last_serial": 3864935, "releases": { "0.6": [ { "comment_text": "", "digests": { "md5": "34a1797f08b41a85f76080fd6f30cbde", "sha256": "edd7188b6c206260b3ea7869eef8b4f81b968b2a671de44772c6f1deeb44d1be" }, "downloads": -1, "filename": "NBT-0.6.zip", "has_sig": false, "md5_digest": "34a1797f08b41a85f76080fd6f30cbde", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7956, "upload_time": "2010-10-29T16:36:59", "url": "https://files.pythonhosted.org/packages/92/57/fcd53b248ca5ee7bc76a58fc2841dd58bedc154a776d99a31744dd24b0b8/NBT-0.6.zip" } ], "0.7": [ { "comment_text": "", "digests": { "md5": "71b286b4db77acf5b1a07430735552e4", "sha256": "622b389a7937cf2fb0f74a92ae8c5b4aa4512bdab619566d0b72eeabfe4cd325" }, "downloads": -1, "filename": "NBT-0.7.zip", "has_sig": false, "md5_digest": "71b286b4db77acf5b1a07430735552e4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8364, "upload_time": "2010-11-02T16:58:13", "url": "https://files.pythonhosted.org/packages/b3/93/6e6ca83dd42cd4cfe273bde172813443bef4472aa8eda3cfcd0805095670/NBT-0.7.zip" } ], "0.8": [ { "comment_text": "", "digests": { "md5": "09fefe607bf9181c97f0e3756a1738a6", "sha256": "fa3fc39adddb6cd4391a3eba2921ba95ed753a616d28bb15de236177f2c36c83" }, "downloads": -1, "filename": "NBT-0.8.zip", "has_sig": false, "md5_digest": "09fefe607bf9181c97f0e3756a1738a6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9603, "upload_time": "2010-11-27T12:58:24", "url": "https://files.pythonhosted.org/packages/bc/21/be92fbebcd397b01b4cec1cff6e40c1cb4c1d0dcf383c8a2f5b84f2d2a61/NBT-0.8.zip" } ], "0.9": [ { "comment_text": "", "digests": { "md5": "2f83778dee5376de9015902dbb8b846d", "sha256": "0482f14179ca7d6c70e3e0c78c3750a23a135b48ca25e3ebe5d91ea931f9a3e8" }, "downloads": -1, "filename": "NBT-0.9.zip", "has_sig": false, "md5_digest": "2f83778dee5376de9015902dbb8b846d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10020, "upload_time": "2010-12-15T08:03:50", "url": "https://files.pythonhosted.org/packages/e8/b1/a67cfec61610fd5851f8327facbec46be55ffa8baa1fb2a61114a3122eff/NBT-0.9.zip" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "15582da258601f3858abda7f9286037c", "sha256": "4b1bb815c753de5b675eeaa2cf047dd7679bdd8be184485756bd317f848e4685" }, "downloads": -1, "filename": "NBT-1.0.zip", "has_sig": false, "md5_digest": "15582da258601f3858abda7f9286037c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10760, "upload_time": "2011-02-27T15:33:57", "url": "https://files.pythonhosted.org/packages/b7/ad/f718fcb96e7daa849270d5f8c4eee181dbec9f65e1c44ea81b18115ab3e9/NBT-1.0.zip" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "24b61b0c7a350569633221f7d6f18d45", "sha256": "e7fe53ac4a5f71804638495901a3d8d77c3d0c3ade25a77611601bd437aa561f" }, "downloads": -1, "filename": "NBT-1.1.zip", "has_sig": false, "md5_digest": "24b61b0c7a350569633221f7d6f18d45", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24141, "upload_time": "2011-09-24T05:15:30", "url": "https://files.pythonhosted.org/packages/7e/06/5a2e39ceb5f927fb86904c5b4abc89d60391b2ef01ed756bb63564c2f52a/NBT-1.1.zip" } ], "1.3": [ { "comment_text": "", "digests": { "md5": "981164efdc54263e14b1b8ca080bba81", "sha256": "32cd64ba98a35d52c38469a1df3c68453fb2de04adc234b1ada388ee7c420b6e" }, "downloads": -1, "filename": "NBT-1.3.tar.gz", "has_sig": false, "md5_digest": "981164efdc54263e14b1b8ca080bba81", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13543, "upload_time": "2012-05-21T16:56:22", "url": "https://files.pythonhosted.org/packages/ac/31/2c9b253ebdee58d6255fa43baf7fb7d71dffddc688f959d221cbd1d58cc6/NBT-1.3.tar.gz" } ], "1.4.0": [ { "comment_text": "", "digests": { "md5": "56705fb49a76b2e3082bf8b229a0a587", "sha256": "c845ad4869bcbc6ce0aa2204bf663db6f8f6172d63fb66cdbd4015a7839e3af3" }, "downloads": -1, "filename": "NBT-1.4.0.tar.gz", "has_sig": false, "md5_digest": "56705fb49a76b2e3082bf8b229a0a587", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 108807, "upload_time": "2013-10-27T10:24:41", "url": "https://files.pythonhosted.org/packages/e6/cd/6d67337a7b6cc222bc74b4713497bd46bc6f949df9477dc8c770aaf0b0ea/NBT-1.4.0.tar.gz" } ], "1.4.1": [ { "comment_text": "", "digests": { "md5": "6b3eb062cf99b1ad529c6263adf9bfdb", "sha256": "a37cfce0029a61fd3d6d9cd51b49a23a59e07f98d160b3b99714f188c92abefd" }, "downloads": -1, "filename": "NBT-1.4.1.tar.gz", "has_sig": false, "md5_digest": "6b3eb062cf99b1ad529c6263adf9bfdb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 109692, "upload_time": "2013-10-27T10:46:39", "url": "https://files.pythonhosted.org/packages/f7/f7/11a7b399c7e0f9cf374ef9480d16f830b3900341b30f130339e8d6d610d5/NBT-1.4.1.tar.gz" } ], "1.5.0": [ { "comment_text": "", "digests": { "md5": "71780f7ff7084ed3303e258ffc58bb58", "sha256": "77dcf9d3fcb41a04fe7f407e902cf78c1dadc589d2e68d0a77e1b62b64a9be7e" }, "downloads": -1, "filename": "NBT-1.5.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "71780f7ff7084ed3303e258ffc58bb58", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 22190, "upload_time": "2018-05-15T15:04:42", "url": "https://files.pythonhosted.org/packages/35/76/87c76e0e4d5a5e2429054a52205e0089ab219189c1be68d8a343021d3d8d/NBT-1.5.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3b648e229251e3295fc10b1138c3b810", "sha256": "834505e9137d00ab5b098979b4e1d383a14061e80364a7f1b9587839b2743f5e" }, "downloads": -1, "filename": "NBT-1.5.0-py3-none-any.whl", "has_sig": false, "md5_digest": "3b648e229251e3295fc10b1138c3b810", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 22186, "upload_time": "2018-05-15T15:03:31", "url": "https://files.pythonhosted.org/packages/d4/e4/d9837cf560f1a5000b1b1263028ddf5d93cc73d128ca558f55f31d1e7f90/NBT-1.5.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "71b447a1a7687adffb2f38f476db5654", "sha256": "f3585248e6747c6ede39be49a9d54ade8f63ce9beb42a6682c0323d32073c7f9" }, "downloads": -1, "filename": "NBT-1.5.0.tar.gz", "has_sig": false, "md5_digest": "71b447a1a7687adffb2f38f476db5654", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 121299, "upload_time": "2018-05-15T15:02:58", "url": "https://files.pythonhosted.org/packages/94/7e/d722409e8a9a1434bccbd8868c9aa471da29a6ea1b14abaf567f9c2036a8/NBT-1.5.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "71780f7ff7084ed3303e258ffc58bb58", "sha256": "77dcf9d3fcb41a04fe7f407e902cf78c1dadc589d2e68d0a77e1b62b64a9be7e" }, "downloads": -1, "filename": "NBT-1.5.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "71780f7ff7084ed3303e258ffc58bb58", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 22190, "upload_time": "2018-05-15T15:04:42", "url": "https://files.pythonhosted.org/packages/35/76/87c76e0e4d5a5e2429054a52205e0089ab219189c1be68d8a343021d3d8d/NBT-1.5.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3b648e229251e3295fc10b1138c3b810", "sha256": "834505e9137d00ab5b098979b4e1d383a14061e80364a7f1b9587839b2743f5e" }, "downloads": -1, "filename": "NBT-1.5.0-py3-none-any.whl", "has_sig": false, "md5_digest": "3b648e229251e3295fc10b1138c3b810", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 22186, "upload_time": "2018-05-15T15:03:31", "url": "https://files.pythonhosted.org/packages/d4/e4/d9837cf560f1a5000b1b1263028ddf5d93cc73d128ca558f55f31d1e7f90/NBT-1.5.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "71b447a1a7687adffb2f38f476db5654", "sha256": "f3585248e6747c6ede39be49a9d54ade8f63ce9beb42a6682c0323d32073c7f9" }, "downloads": -1, "filename": "NBT-1.5.0.tar.gz", "has_sig": false, "md5_digest": "71b447a1a7687adffb2f38f476db5654", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 121299, "upload_time": "2018-05-15T15:02:58", "url": "https://files.pythonhosted.org/packages/94/7e/d722409e8a9a1434bccbd8868c9aa471da29a6ea1b14abaf567f9c2036a8/NBT-1.5.0.tar.gz" } ] }