David Vierra
86640ec61a
Fixed: Remove self from TAG_Compound's key not found error message
...
String formatting was taking forever.
2013-01-10 16:04:41 -10:00
David Vierra
3e4a9b8ef6
NBT: TAG_List now accepts item assignment using slices.
...
e.g. `list_tag[:] = [nbt.TAG_Double(3), nbt.TAG_Double(5)]`
Also, changed the names of a few method args to be more consistent between implementations.
2012-10-31 15:16:12 -10:00
David Vierra
7b3a5995b2
nbt: gunzip calls GzipFile now instead of zlib.decompress.
...
Removed gunzip/zlib workaround used for Primordial Desert. This was causing some uncompressed NBT files to fail to load.
2012-10-29 18:21:08 -10:00
David Vierra
2712e297ee
Refactor: Clean up imports in nbt and _nbt
2012-10-29 18:19:06 -10:00
David Vierra
f4b40912a3
Fixed: Statement seems to have no effect
...
Change several strings-in-void-context into comments like they ought to be.
Change member accesses in void context into assertions or prints.
2012-10-27 15:05:08 -10:00
David Vierra
78e45aedfb
Refactor: Remove compressedChunks and related methods and data from MCInfdevOldLevel and AnvilChunk
...
Move MCRegionFile to its own source file.
Remove knowledge of chunk structure from MCRegionFile. Rename loadChunk to readChunk.
Remove compress, decompress, unload, isLoaded, compressedSize methods.
Remove compressedTag, dataIsPacked, loadedChunkQueue/Limit, decompressedChunkQueue/Limit members.
Rename InfdevChunk to AnvilChunk. Keep in place the conversion to old-style chunks until all client code is updated.
Remove most checks for self.version and keep only the VERSION_ANVIL code in place
Rename Alpha tests to Anvil tests.
Change several tests to load the AnvilWorld test data.
Change ZipSchematic test to export an area from the center of the world instead of from hard-coded coordinates.
2012-10-27 15:04:28 -10:00
David Vierra
7972bb8a0d
Rename pynbt.py to nbt.py, remove old nbt.py
2012-10-15 15:31:27 -10:00
David Vierra
a83821cd13
Clean up NBT modules.
...
Simplify the load and save interfaces. Replace the (data, data_cursor) tuples with a load_ctx object. Add an option to skip decoding tag names to unicode, improving speed and memory use if tag names are assumed to be ASCII. Make nbt.py and _nbt.pyx more consistent with each other. Use a similar method to import from _nbt.pyx as is seen in the standard library. Move pretty-print code to its own file and share it between implementations.
2012-10-10 23:28:27 -10:00
Tyler Kennedy
10fe26d372
Removing pointless dependency messages from nbt.py logging. Dependency instructions don't belong in logging calls :). Added a more informative error message to pyximport failing on a common case, and had it fall back.
2012-03-13 04:15:15 -04:00
David Sowder
eb6b03a8d2
Remove the last of the import alls, from __init__.py and nbt.py
2012-03-04 21:34:04 -06:00
Jack Twilley
b883010e4e
Changed nbt.py to use logging module instead of print
...
The accelerated NBT module information best serves the user when
it can be prioritized appropriately. By using the logging module,
the user can be informed of the state of the module while debugging
their code but not bothered with it when log levels are set higher.
2012-02-29 11:04:45 -08:00
David Sowder
1a2ecc5c41
pyflakes result fix: imported but unused
2012-02-26 15:06:41 -06:00
David Sowder
4270a929d7
pep8 compliance changes and gitignore the ENV directory
2012-02-26 13:47:58 -06:00
David Vierra
751f190274
Import error messages now explain that NBT acceleration is not available, and gives tips on how to enable it by getting pyximport working.
2012-01-03 12:18:40 -10:00
David Vierra
167f7e960c
Pass numpy's include dir to pyximport.install() to fix "error: numpy/arrayobject.h: No such file or directory".
2012-01-03 12:05:24 -10:00
David Vierra
3703015f86
add setup_nbt.py and setupnbt64.bat. try to import _nbt without using ImportError, in case it was built using setup_nbt.py
2011-11-29 03:39:25 -10:00
David Vierra
4135f603c5
Added _nbt.pyx, a Cython implentation of nbt that uses extension classes and pointer arithmetic to speed up loading.
...
Renamed nbt.py to pynbt.py, added nbt.py as a thin loader for either _nbt.pyx or pynbt.py.
2011-11-25 16:10:39 -10:00
David Vierra
c48adf501a
switch to cStringIO, clean up nbt.loadFile, add nbt.load to __all__
2011-11-25 15:49:02 -10:00
David Vierra
7933473be3
move NBT tests to tests.py, add speed test and chunks with TileTicks
2011-11-20 15:13:42 -10:00
David Vierra
af4c11ea3f
removed nbt_length() and data= keyword argument to TAG_*, replacing them with load_from to pass around the data cursor
2011-11-17 20:43:21 -10:00
David Vierra
ae18928064
print a more informative keyerror
2011-08-15 19:03:00 -10:00
David Vierra
d74bf07343
TAG_Compound automatically wraps lists, tuples, and strings
2011-07-24 00:21:44 -10:00
David Vierra
225f813d28
put everything through pydev's code auto-formatter
2011-07-23 21:59:18 -10:00
David Vierra
6b9e82c2e4
refactor level formats out to different files, add testing framework and test files
2011-07-23 19:58:11 -10:00
David Vierra
5b39487030
don't misuse TypeError here...this is an unexpected value
2011-07-22 22:56:18 -10:00
David Vierra
5c56843a76
repair the shabby unit tests
2011-07-22 20:46:47 -10:00
David Vierra
f462469424
TAG_Short_Array used by cubic chunks
2011-07-22 20:34:49 -10:00
David Vierra
a6c0da238a
add pretty_string method to tags for indented output
2011-07-22 20:34:36 -10:00
David Vierra
d91ca462e1
avoid having uninitialized data in nbt.loadFile
2011-05-26 14:08:51 -10:00
David Vierra
53be8e48bf
workarounds for a bug in python's gzip module - it will raise an error when trying to decompress any extra bytes that follow the first gzip packet
...
changed (de)compressTag to (de)compressChunk - the chunk is now in charge of setting chunk.root_tag and chunk.compressedTag
the region file sets chunk.compressMode on new chunks, which is VERSION_GZIP by default
2011-04-29 11:30:35 -10:00
David Vierra
cfb06fdf43
fix and clarify the type of the initial value for newly created TAG_Strings
2011-04-20 20:20:49 -10:00
David Vierra
e6d767d0e4
fix the length of TAG_Strings now that they are unicode
2011-04-11 12:01:23 -10:00
David Vierra
dc6b5cffa2
hahaha TAG_String is a unicode string, not just a generic byte stream
2011-04-11 11:28:15 -10:00
David Vierra
1ba8d0fc8f
TAG_String is a unicode string, encoded with modified utf-8.
2011-04-10 20:40:25 -10:00
David Vierra
111be952d4
create an NBTFormatError and raise it where appropriate instead of IOError
2011-04-07 13:00:28 -10:00
David Vierra
abb66b3d98
clean up imports and references to the 'materials' module and restrict imports from nbt.py
2011-04-06 12:25:08 -10:00
David Vierra
d22a2cc3a3
change several length values to unsigned ints
2011-02-22 12:17:13 -10:00
David Vierra
3d23f5b3d4
use a dtype with an explicit byte order when creating IntArrays
2011-02-22 03:37:34 -10:00
David Vierra
0c3d9eeef9
added TAG_Int_Array introduced by ymod
2011-02-19 18:19:16 -10:00
David Vierra
f944725b00
use standard 4-space indent here
2011-02-19 18:18:57 -10:00
Caleb Deveraux
0116df38fc
Use with statement for file management
2010-11-16 18:33:27 -07:00
Caleb Deveraux
d1168d67d1
Convert TAG_List over to using value property
2010-11-16 03:56:46 -10:00
David Vierra
aadc0fcffe
attempt to keep processing the NBT data if it's uncompressed
2010-10-28 01:13:57 -10:00
David Vierra
8ffb8262da
allow unicode filenames here, too
2010-10-15 22:06:33 -10:00
David Vierra
4cc5f05fa8
Need to import os
2010-10-15 16:02:08 -10:00
Caleb Deveraux
5e564531fb
Fix dataType assertions in TAG_Compound
2010-10-08 21:36:34 -10:00
Caleb Deveraux
e41cf4f77e
Add a vim modeline to nbt.py so the non-pep8-ness of nbt.py is maintained
2010-10-08 21:36:27 -10:00
Caleb Deveraux
8ba96f9b13
Avoid creating temporary lists where possible
2010-10-04 00:23:31 -06:00
Caleb Deveraux
ee8a079cf1
Unify the 'load named nbt' logic
2010-10-03 20:35:46 -06:00
Caleb Deveraux
37889cddfb
Don't construct a key list unnecessarily; it slows things down
2010-10-03 20:35:46 -06:00