Use new-style classes so properties work

Properties don't work on old-style classes.  Convert classes to
new-style by explicitly inheriting from object.
This commit is contained in:
Caleb Deveraux 2010-09-27 09:00:49 +08:00 committed by David Vierra
parent 31b4fcbf13
commit c3c44a60bf
3 changed files with 5 additions and 5 deletions

View File

@ -4,7 +4,7 @@ from materials import classicMaterials, materials
from numpy import * from numpy import *
NOTEX = 184 NOTEX = 184
#wow, punching this map in would have been much easier in hex #wow, punching this map in would have been much easier in hex
class MCMaterials(): class MCMaterials(object):
def materialNamed(self, name): def materialNamed(self, name):
return self.names.index(name); return self.names.index(name);

View File

@ -269,7 +269,7 @@ def decompress_first(func):
return func(self, *args, **kw); return func(self, *args, **kw);
return dec_first return dec_first
class MCLevel: class MCLevel(object):
""" MCLevel is an abstract class providing many routines to the different level types, """ MCLevel is an abstract class providing many routines to the different level types,
including a common copyEntitiesFrom built on class-specific routines, and including a common copyEntitiesFrom built on class-specific routines, and
a dummy getChunk/getPresentChunks for the finite levels. a dummy getChunk/getPresentChunks for the finite levels.
@ -1188,7 +1188,7 @@ class PlayerNotFound(Exception): pass
class ChunkNotPresent(Exception): pass class ChunkNotPresent(Exception): pass
class ChunkMalformed(ChunkNotPresent): pass class ChunkMalformed(ChunkNotPresent): pass
class ZeroChunk: class ZeroChunk(object):
" a placebo for neighboring-chunk routines " " a placebo for neighboring-chunk routines "
def compress(self): pass def compress(self): pass
def load(self): pass def load(self): pass

2
nbt.py
View File

@ -23,7 +23,7 @@ import StringIO;
from numpy import array, zeros, uint8, fromstring from numpy import array, zeros, uint8, fromstring
TAGfmt = ">b" TAGfmt = ">b"
class TAG_Value: class TAG_Value(object):
"""Simple values. Subclasses override fmt to change the type and size. """Simple values. Subclasses override fmt to change the type and size.
Subclasses may set dataType instead of overriding setValue for automatic data type coercion""" Subclasses may set dataType instead of overriding setValue for automatic data type coercion"""