-
Notifications
You must be signed in to change notification settings - Fork 74
Handle the NBT (Named Binary Tag) data format
exception nbt.nbt.MalformedFileError
Bases:
Exception
Exception raised on parse error.
class nbt.nbt.TAG(value=None, name=None)
Bases:
object
TAG, a variable with an intrinsic name.
id = None
__init__(value=None, name=None)
Initialize self. See help(type(self)) for accurate signature.tag_info()
Return Unicode string with class, name and unnested value.valuestr()
Return Unicode string of unnested value. For iterators, this returns a summary.pretty_tree(indent=0)
Return formated Unicode string of self, where iterable items are recursively listed in detail.__unicode__()
Return a unicode string with the result in human readable format. Unlike valuestr(), the result is recursive for iterators till at least one level deep.__str__()
Return a string (ascii formated for Python 2, unicode for Python 3) with the result in human readable format. Unlike valuestr(), the result
is recursive for iterators till at least one level deep.__repr__()
Return a string (ascii formated for Python 2, unicode for Python 3) describing the class, name and id for debugging purposes.
class nbt.nbt.TAG_Byte(value=None, name=None, buffer=None)
Bases:
nbt.nbt._TAG_Numeric
Represent a single tag storing 1 byte.
id = 1
fmt = <Struct object>
class nbt.nbt.TAG_Short(value=None, name=None, buffer=None)
Bases:
nbt.nbt._TAG_Numeric
Represent a single tag storing 1 short.
id = 2
fmt = <Struct object>
class nbt.nbt.TAG_Int(value=None, name=None, buffer=None)
Bases:
nbt.nbt._TAG_Numeric
Represent a single tag storing 1 int.
id = 3
fmt = <Struct object>
Struct(“>i”), 32-bits integer, big-endian
class nbt.nbt.TAG_Long(value=None, name=None, buffer=None)
Bases:
nbt.nbt._TAG_Numeric
Represent a single tag storing 1 long.
id = 4
fmt = <Struct object>
class nbt.nbt.TAG_Float(value=None, name=None, buffer=None)
Bases:
nbt.nbt._TAG_Numeric
Represent a single tag storing 1 IEEE-754 floating point number.
id = 5
fmt = <Struct object>
class nbt.nbt.TAG_Double(value=None, name=None, buffer=None)
Bases:
nbt.nbt._TAG_Numeric
Represent a single tag storing 1 IEEE-754 double precision floating point number.
id = 6
fmt = <Struct object>
class nbt.nbt.TAG_Byte_Array(name=None, buffer=None)
Bases:
nbt.nbt.TAG
,collections.abc.MutableSequence
TAG_Byte_Array, comparable to a collections.UserList with an intrinsic name whose values must be bytes
id = 7
__init__(name=None, buffer=None)
Initialize self. See help(type(self)) for accurate signature.__len__()
__iter__()
__contains__(item)
__getitem__(key)
__setitem__(key, value)
__delitem__(key)
insert(key, value)
S.insert(index, value) – insert value before indexvaluestr()
Return Unicode string of unnested value. For iterators, this returns a summary.__unicode__()
Return a unicode string with the result in human readable format. Unlike valuestr(), the result is recursive for iterators till at least one level deep.__str__()
Return a string (ascii formated for Python 2, unicode for Python 3) with the result in human readable format. Unlike valuestr(), the result
is recursive for iterators till at least one level deep.
class nbt.nbt.TAG_Int_Array(name=None, buffer=None)
Bases:
nbt.nbt.TAG
,collections.abc.MutableSequence
TAG_Int_Array, comparable to a collections.UserList with an intrinsic name whose values must be integers
id = 11
__init__(name=None, buffer=None)
Initialize self. See help(type(self)) for accurate signature.update_fmt(length)
Adjust struct format description to length given__len__()
__iter__()
__contains__(item)
__getitem__(key)
__setitem__(key, value)
__delitem__(key)
insert(key, value)
S.insert(index, value) – insert value before indexvaluestr()
Return Unicode string of unnested value. For iterators, this returns a summary.
class nbt.nbt.TAG_Long_Array(name=None, buffer=None)
Bases:
nbt.nbt.TAG
,collections.abc.MutableSequence
TAG_Long_Array, comparable to a collections.UserList with an intrinsic name whose values must be integers
id = 12
__init__(name=None, buffer=None)
Initialize self. See help(type(self)) for accurate signature.update_fmt(length)
Adjust struct format description to length given__len__()
__iter__()
__contains__(item)
__getitem__(key)
__setitem__(key, value)
__delitem__(key)
insert(key, value)
S.insert(index, value) – insert value before indexvaluestr()
Return Unicode string of unnested value. For iterators, this returns a summary.
class nbt.nbt.TAG_String(value=None, name=None, buffer=None)
Bases:
nbt.nbt.TAG
,collections.abc.Sequence
TAG_String, comparable to a collections.UserString with an intrinsic name
id = 8
__init__(value=None, name=None, buffer=None)
Initialize self. See help(type(self)) for accurate signature.__len__()
__iter__()
__contains__(item)
__getitem__(key)
__repr__()
Return a string (ascii formated for Python 2, unicode for Python 3) describing the class, name and id for debugging purposes.
class nbt.nbt.TAG_List(type=None, value=None, name=None, buffer=None)
Bases:
nbt.nbt.TAG
,collections.abc.MutableSequence
TAG_List, comparable to a collections.UserList with an intrinsic name
id = 9
__init__(type=None, value=None, name=None, buffer=None)
Initialize self. See help(type(self)) for accurate signature.__len__()
__iter__()
__contains__(item)
__getitem__(key)
__setitem__(key, value)
__delitem__(key)
insert(key, value)
S.insert(index, value) – insert value before index__repr__()
Return a string (ascii formated for Python 2, unicode for Python 3) describing the class, name and id for debugging purposes.valuestr()
Return Unicode string of unnested value. For iterators, this returns a summary.__unicode__()
Return a unicode string with the result in human readable format. Unlike valuestr(), the result is recursive for iterators till at least one level deep.__str__()
Return a string (ascii formated for Python 2, unicode for Python 3) with the result in human readable format. Unlike valuestr(), the result
is recursive for iterators till at least one level deep.pretty_tree(indent=0)
Return formated Unicode string of self, where iterable items are recursively listed in detail.
class nbt.nbt.TAG_Compound(buffer=None, name=None)
Bases:
nbt.nbt.TAG
,collections.abc.MutableMapping
TAG_Compound, comparable to a collections.OrderedDict with an intrinsic name
id = 10
__init__(buffer=None, name=None)
Initialize self. See help(type(self)) for accurate signature.__len__()
__iter__()
__contains__(key)
__getitem__(key)
__setitem__(key, value)
__delitem__(key)
keys() -> a set-like object providing a view on D's keys
iteritems()
__unicode__()
Return a unicode string with the result in human readable format. Unlike valuestr(), the result is recursive for iterators till at least one level deep.__str__()
Return a string (ascii formated for Python 2, unicode for Python 3) with the result in human readable format. Unlike valuestr(), the result
is recursive for iterators till at least one level deep.valuestr()
Return Unicode string of unnested value. For iterators, this returns a summary.pretty_tree(indent=0)
Return formated Unicode string of self, where iterable items are recursively listed in detail.
class nbt.nbt.NBTFile(filename=None, buffer=None, fileobj=None)
Bases:
nbt.nbt.TAG_Compound
Represent an NBT file object.
__init__(filename=None, buffer=None, fileobj=None)
Create a new NBTFile object. Specify either a filename, file object or data buffer. If filename of file object is specified, data should be GZip-compressed. If a data buffer is specified, it is assumed to be uncompressed.
If filename is specified, the file is closed after reading and writing. If file object is specified, the caller is responsible for closing the file.
parse_file(filename=None, buffer=None, fileobj=None)
Completely parse a file, extracting all tags.write_file(filename=None, buffer=None, fileobj=None)
Write this NBT file to a file.__repr__()
Return a string (ascii formated for Python 2, unicode for Python 3) describing the class, name and id for debugging purposes.