From c3c44a60bf45a79a46a915fa135e8c7fdcab8d6b Mon Sep 17 00:00:00 2001 From: Caleb Deveraux Date: Mon, 27 Sep 2010 09:00:49 +0800 Subject: [PATCH] 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. --- materials.py | 4 ++-- mclevel.py | 4 ++-- nbt.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/materials.py b/materials.py index ed03321..83d648b 100644 --- a/materials.py +++ b/materials.py @@ -4,7 +4,7 @@ from materials import classicMaterials, materials from numpy import * NOTEX = 184 #wow, punching this map in would have been much easier in hex -class MCMaterials(): +class MCMaterials(object): def materialNamed(self, name): return self.names.index(name); @@ -423,4 +423,4 @@ def texCoords(idx): materials.blockTextures = array([map(texCoords, faces) for (faces, name) in materials.blockTextures], dtype='uint8') classicMaterials.blockTextures = array([map(texCoords, faces) for (faces, name) in classicMaterials.blockTextures], dtype='uint8') -alphaMaterials = materials; \ No newline at end of file +alphaMaterials = materials; diff --git a/mclevel.py b/mclevel.py index 0a45b4c..fb4d220 100644 --- a/mclevel.py +++ b/mclevel.py @@ -269,7 +269,7 @@ def decompress_first(func): return func(self, *args, **kw); return dec_first -class MCLevel: +class MCLevel(object): """ MCLevel is an abstract class providing many routines to the different level types, including a common copyEntitiesFrom built on class-specific routines, and a dummy getChunk/getPresentChunks for the finite levels. @@ -1188,7 +1188,7 @@ class PlayerNotFound(Exception): pass class ChunkNotPresent(Exception): pass class ChunkMalformed(ChunkNotPresent): pass -class ZeroChunk: +class ZeroChunk(object): " a placebo for neighboring-chunk routines " def compress(self): pass def load(self): pass diff --git a/nbt.py b/nbt.py index 455800b..0479e8b 100644 --- a/nbt.py +++ b/nbt.py @@ -23,7 +23,7 @@ import StringIO; from numpy import array, zeros, uint8, fromstring TAGfmt = ">b" -class TAG_Value: +class TAG_Value(object): """Simple values. Subclasses override fmt to change the type and size. Subclasses may set dataType instead of overriding setValue for automatic data type coercion"""