Permalink
Browse files

remove 725 unnecessary semicolons

  • Loading branch information...
1 parent 8fac69e commit 745d1c41c004d9a67b74682694d21041a6ac4c79 @codewarrior0 committed Jan 13, 2012
Showing with 787 additions and 790 deletions.
  1. +2 −2 _nbt.pyx
  2. +5 −5 blockrotation.py
  3. +21 −20 box.py
  4. +30 −31 indev.py
  5. +248 −251 infiniteworld.py
  6. +9 −9 items.py
  7. +24 −23 java.py
  8. +69 −70 level.py
  9. +3 −3 materials.py
  10. +145 −149 mce.py
  11. +19 −20 mclevel.py
  12. +12 −9 mclevelbase.py
  13. +5 −5 pocket.py
  14. +78 −76 pynbt.py
  15. +1 −1 run_regression_test.py
  16. +70 −69 schematic.py
  17. +46 −47 tests.py
View
@@ -43,7 +43,7 @@ cdef cwrite(obj, char * buf, size_t len):
return PycStringIO.cwrite(obj, buf, len)
import sys
-import os;
+import os
from os.path import exists
from contextlib import closing
@@ -439,7 +439,7 @@ cdef load_compound(load_ctx ctx):
ctx.offset += 1
if tagID == TAG_END:
#print "TAG_END at ", ctx.offset
- break;
+ break
else:
name = load_string(ctx)
tag = load_tag(tagID, ctx)
View
@@ -29,7 +29,7 @@ def genericNorthSouthFlip(cls):
rotation[cls.North] = cls.South
return rotation
-rotationClasses = [];
+rotationClasses = []
def genericFlipRotation(cls):
cls.rotateLeft = genericRotation(cls)
@@ -411,10 +411,10 @@ def rotationTypeTable():
return table
class BlockRotation:
- rotateLeft = masterRotationTable("rotateLeft");
- flipEastWest = masterRotationTable("flipEastWest");
- flipNorthSouth = masterRotationTable("flipNorthSouth");
- flipVertical = masterRotationTable("flipVertical");
+ rotateLeft = masterRotationTable("rotateLeft")
+ flipEastWest = masterRotationTable("flipEastWest")
+ flipNorthSouth = masterRotationTable("flipNorthSouth")
+ flipVertical = masterRotationTable("flipVertical")
typeTable = rotationTypeTable()
def SameRotationType(blocktype1, blocktype2):
View
41 box.py
@@ -24,7 +24,7 @@ def getMaxz(self): return self.origin[2] + self.size[2];
def setMinx(self, x):
self.size[0] -= x - self.origin[0]
- self.origin[0] = x;
+ self.origin[0] = x
def setMiny(self, y):
self.size[1] -= y - self.origin[1]
@@ -37,42 +37,42 @@ def setMinz(self, z):
def setMaxx(self, x):
if x < self.origin[0]:
- x = self.origin[0];
+ x = self.origin[0]
self.size[0] = x - self.origin[0]
def setMaxy(self, y):
if y < self.origin[1]:
- y = self.origin[1];
+ y = self.origin[1]
self.size[1] = y - self.origin[1]
def setMaxz(self, z):
if z < self.origin[2]:
- z = self.origin[2];
+ z = self.origin[2]
self.size[2] = z - self.origin[2]
- minx = property(getMinx, setMinx);
- miny = property(getMiny, setMiny);
- minz = property(getMinz, setMinz);
+ minx = property(getMinx, setMinx)
+ miny = property(getMiny, setMiny)
+ minz = property(getMinz, setMinz)
- maxx = property(getMaxx, setMaxx);
- maxy = property(getMaxy, setMaxy);
- maxz = property(getMaxz, setMaxz);
+ maxx = property(getMaxx, setMaxx)
+ maxy = property(getMaxy, setMaxy)
+ maxz = property(getMaxz, setMaxz)
def getMincx(self): return self.origin[0] >> 4;
def getMincz(self): return self.origin[2] >> 4;
def getMaxcx(self): return ((self.origin[0] + self.size[0] - 1) >> 4) + 1;
def getMaxcz(self): return ((self.origin[2] + self.size[2] - 1) >> 4) + 1;
- mincx = property(getMincx, None, None, "The smallest chunk position contained in this box");
- mincz = property(getMincz, None, None, "The smallest chunk position contained in this box");
+ mincx = property(getMincx, None, None, "The smallest chunk position contained in this box")
+ mincz = property(getMincz, None, None, "The smallest chunk position contained in this box")
- maxcx = property(getMaxcx, None, None, "The largest chunk position contained in this box");
- maxcz = property(getMaxcz, None, None, "The largest chunk position contained in this box");
+ maxcx = property(getMaxcx, None, None, "The largest chunk position contained in this box")
+ maxcz = property(getMaxcz, None, None, "The largest chunk position contained in this box")
def getOrigin(self): return self._origin;
def setOrigin(self, o): self._origin = list(o);
@@ -91,9 +91,9 @@ def setWidth(self, w): self.size[0] = max(0, self.type(w))
def setHeight(self, h): self.size[1] = max(0, self.type(h))
def setLength(self, l): self.size[2] = max(0, self.type(l))
- width = property(getWidth, setWidth, None, "The dimension along the X axis");
- height = property(getHeight, setHeight, None, "The dimension along the Y axis");
- length = property(getLength, setLength, None, "The dimension along the Z axis");
+ width = property(getWidth, setWidth, None, "The dimension along the X axis")
+ height = property(getHeight, setHeight, None, "The dimension along the Y axis")
+ length = property(getLength, setLength, None, "The dimension along the Z axis")
def getMaximum(self): return map(lambda a, b:a + b, self._origin, self._size)
@@ -106,7 +106,8 @@ def getVolume(self): return reduce(lambda a, b:a * b, self.size)
@property
def chunkPositions(self):
#iterate through all of the chunk positions within this selection box
- return itertools.product(xrange(self.mincx, self.maxcx), xrange(self.mincz, self.maxcz));
+ return itertools.product(xrange(self.mincx, self.maxcx), xrange(self.mincz, self.maxcz))
+
@property
def chunkCount(self):
return (self.maxcx - self.mincx) * (self.maxcz - self.mincz)
@@ -163,12 +164,12 @@ def expand(self, dx, dy=None, dz=None):
def __contains__(self, pos):
- x, y, z = pos;
+ x, y, z = pos
if x < self.minx or x >= self.maxx: return False
if y < self.miny or y >= self.maxy: return False
if z < self.minz or z >= self.maxz: return False
- return True;
+ return True
def __cmp__(self, b):
return cmp((self.origin, self.size), (b.origin, b.size))
View
@@ -96,10 +96,10 @@ class MCIndevLevel(EntityLevel):
materials = indevMaterials
def setPlayerSpawnPosition(self, pos, player=None):
assert len(pos) == 3
- self.Spawn = array(pos);
+ self.Spawn = array(pos)
def playerSpawnPosition(self, player=None):
- return self.Spawn;
+ return self.Spawn
def setPlayerPosition(self, pos, player="Ignored"):
for x in self.root_tag["Entities"]:
@@ -109,7 +109,7 @@ def setPlayerPosition(self, pos, player="Ignored"):
def getPlayerPosition(self, player="Ignored"):
for x in self.root_tag["Entities"]:
if x["id"].value == "LocalPlayer":
- return array(map(lambda x:x.value, x["Pos"]));
+ return array(map(lambda x:x.value, x["Pos"]))
def setPlayerOrientation(self, yp, player="Ignored"):
for x in self.root_tag["Entities"]:
@@ -120,22 +120,22 @@ def getPlayerOrientation(self, player="Ignored"):
""" returns (yaw, pitch) """
for x in self.root_tag["Entities"]:
if x["id"].value == "LocalPlayer":
- return array(map(lambda x:x.value, x["Rotation"]));
+ return array(map(lambda x:x.value, x["Rotation"]))
def setBlockDataAt(self, x, y, z, newdata):
if x < 0 or y < 0 or z < 0: return 0
if x >= self.Width or y >= self.Height or z >= self.Length: return 0;
- self.Data[x, z, y] = (newdata & 0xf);
+ self.Data[x, z, y] = (newdata & 0xf)
def blockDataAt(self, x, y, z):
if x < 0 or y < 0 or z < 0: return 0
if x >= self.Width or y >= self.Height or z >= self.Length: return 0;
- return self.Data[x, z, y];
+ return self.Data[x, z, y]
def blockLightAt(self, x, y, z):
if x < 0 or y < 0 or z < 0: return 0
if x >= self.Width or y >= self.Height or z >= self.Length: return 0;
- return self.BlockLight[x, z, y];
+ return self.BlockLight[x, z, y]
def __repr__(self):
return u"MCIndevLevel({0}): {1}W {2}L {3}H".format(self.filename, self.Width, self.Length, self.Height)
@@ -151,13 +151,12 @@ def __init__(self, root_tag=None, filename=""):
self.Blocks = array([], uint8)
self.Data = array([], uint8)
self.Spawn = (0, 0, 0)
- self.filename = filename;
-
+ self.filename = filename
if root_tag:
- self.root_tag = root_tag;
- mapTag = root_tag[Map];
+ self.root_tag = root_tag
+ mapTag = root_tag[Map]
self.Width = mapTag[Width].value
self.Length = mapTag[Length].value
self.Height = mapTag[Height].value
@@ -176,10 +175,10 @@ def __init__(self, root_tag=None, filename=""):
self.Data >>= 4
- self.Spawn = [mapTag[Spawn][i].value for i in range(3)];
+ self.Spawn = [mapTag[Spawn][i].value for i in range(3)]
if not Entities in root_tag:
- root_tag[Entities] = TAG_List();
+ root_tag[Entities] = TAG_List()
self.Entities = root_tag[Entities]
#xxx fixup Motion and Pos to match infdev format
@@ -192,7 +191,7 @@ def numbersToDoubles(ent):
if not TileEntities in root_tag:
- root_tag[TileEntities] = TAG_List();
+ root_tag[TileEntities] = TAG_List()
self.TileEntities = root_tag[TileEntities]
#xxx fixup TileEntities positions to match infdev format
for te in self.TileEntities:
@@ -233,51 +232,51 @@ def numbersToDoubles(ent):
def rotateLeft(self):
- MCLevel.rotateLeft(self);
+ MCLevel.rotateLeft(self)
- self.Data = swapaxes(self.Data, 1, 0)[:, ::-1, :]; #x=y; y=-x
+ self.Data = swapaxes(self.Data, 1, 0)[:, ::-1, :] #x=y; y=-x
torchRotation = array([0, 4, 3, 1, 2, 5,
6, 7,
- 8, 9, 10, 11, 12, 13, 14, 15]);
+ 8, 9, 10, 11, 12, 13, 14, 15])
torchIndexes = (self.Blocks == self.materials.Torch.ID)
info(u"Rotating torches: {0}".format(len(torchIndexes.nonzero()[0])))
self.Data[torchIndexes] = torchRotation[self.Data[torchIndexes]]
def decodePos(self, v):
- b = 10;
+ b = 10
m = (1 << b) - 1; return v & m, (v >> b) & m, (v >> (2 * b))
def encodePos(self, x, y, z):
- b = 10;
+ b = 10
return x + (y << b) + (z << (2 * b))
def saveToFile(self, filename=None):
if filename == None: filename = self.filename;
if filename == None:
warn(u"Attempted to save an unnamed file in place")
- return; #you fool!
+ return #you fool!
- self.Data <<= 4;
+ self.Data <<= 4
self.Data |= (self.BlockLight & 0xf)
self.Blocks = swapaxes(self.Blocks, 0, 2)
self.Data = swapaxes(self.Data, 0, 2)
- mapTag = TAG_Compound(name=Map);
- mapTag[Width] = TAG_Short(self.Width);
- mapTag[Height] = TAG_Short(self.Height);
- mapTag[Length] = TAG_Short(self.Length);
- mapTag[Blocks] = TAG_Byte_Array(self.Blocks);
- mapTag[Data] = TAG_Byte_Array(self.Data);
+ mapTag = TAG_Compound(name=Map)
+ mapTag[Width] = TAG_Short(self.Width)
+ mapTag[Height] = TAG_Short(self.Height)
+ mapTag[Length] = TAG_Short(self.Length)
+ mapTag[Blocks] = TAG_Byte_Array(self.Blocks)
+ mapTag[Data] = TAG_Byte_Array(self.Data)
self.Blocks = swapaxes(self.Blocks, 0, 2)
self.Data = swapaxes(self.Data, 0, 2)
mapTag[Spawn] = TAG_List([TAG_Short(i) for i in self.Spawn])
- self.root_tag[Map] = mapTag;
+ self.root_tag[Map] = mapTag
self.root_tag[Map]
#fix up Entities imported from Alpha worlds
@@ -294,14 +293,14 @@ def numbersToFloats(ent):
ent["Pos"] = TAG_Int(self.encodePos(ent['x'].value, ent['y'].value, ent['z'].value))
#output_file = gzip.open(self.filename, "wb", compresslevel=1)
try:
- os.rename(filename, filename + ".old");
+ os.rename(filename, filename + ".old")
except Exception, e:
pass
try:
- self.root_tag.saveGzipped(filename);
+ self.root_tag.saveGzipped(filename)
except:
- os.rename(filename + ".old", filename);
+ os.rename(filename + ".old", filename)
try: os.remove(filename + ".old");
except Exception, e:
Oops, something went wrong.

0 comments on commit 745d1c4

Please sign in to comment.