pyflakes result fix: local variable is assigned to but never used

This commit is contained in:
David Sowder 2012-02-26 16:31:14 -06:00
parent 150e6f9485
commit a2364dc3c0
7 changed files with 21 additions and 34 deletions

View File

@ -1188,7 +1188,6 @@ class CallgrindParser(LineParser):
_, values = line.split('=', 1)
values = values.strip().split()
calls = int(values[0])
call_position = values[1:]
self.consume()
self.parse_cost_line(calls)
@ -1352,8 +1351,6 @@ class OprofileParser(LineParser):
profile = Profile()
reverse_call_samples = {}
# populate the profile
profile[SAMPLES] = 0
for _callers, _function, _callees in self.entries.itervalues():
@ -1945,7 +1942,6 @@ class AQtimeParser(XmlParser):
return table
def parse_data(self):
rows = []
attrs = self.element_start('DATA')
table_id = int(attrs['TABLE_ID'])
table_name, field_types, field_names = self.tables[table_id]

View File

@ -299,7 +299,7 @@ class MCIndevLevel(EntityLevel):
# output_file = gzip.open(self.filename, "wb", compresslevel=1)
try:
os.rename(filename, filename + ".old")
except Exception, e:
except Exception:
pass
try:
@ -309,7 +309,7 @@ class MCIndevLevel(EntityLevel):
try:
os.remove(filename + ".old")
except Exception, e:
except Exception:
pass
self.BlockLight = self.Data & 0xf

View File

@ -2892,7 +2892,7 @@ class MCInfdevOldLevel(ChunkedLevelMixin, EntityLevel):
try:
chunk = self.getChunk(x >> 4, z >> 4)
except (ChunkNotPresent, ChunkMalformed), e:
except (ChunkNotPresent, ChunkMalformed):
return None
# raise Error, can't find a chunk?
chunk.addEntity(entityTag)

View File

@ -91,7 +91,6 @@ def getSlices(box, height):
if cx == box.maxcx - 1:
localMaxX = maxxoff
newMinX = localMinX + (cx << 4) - box.minx
newMaxX = localMaxX + (cx << 4) - box.minx
for cz in range(box.mincz, box.maxcz):
localMinZ = 0
@ -101,7 +100,6 @@ def getSlices(box, height):
if cz == box.maxcz - 1:
localMaxZ = maxzoff
newMinZ = localMinZ + (cz << 4) - box.minz
newMaxZ = localMaxZ + (cz << 4) - box.minz
slices, point = (
(slice(localMinX, localMaxX), slice(localMinZ, localMaxZ), slice(miny, maxy)),
(newMinX, newMinY, newMinZ)
@ -662,7 +660,6 @@ class EntityLevel(MCLevel):
# if not self.hasEntities or not sourceLevel.hasEntities:
# return
sourcePoint0 = sourceBox.origin
sourcePoint1 = sourceBox.maximum
if sourceLevel.isInfinite:
for i in self.copyEntitiesFromInfiniteIter(sourceLevel, sourceBox, destinationPoint, entities):

View File

@ -179,19 +179,21 @@ class MCMaterials(object):
def addYamlBlock(self, kw):
blockID = kw['id']
unused_yaml_properties = \
['explored',
# 'id',
# 'idStr',
# 'mapcolor',
# 'name',
# 'tex',
### 'tex_data',
# 'tex_direction',
### 'tex_direction_data',
'tex_extra',
# 'type'
]
# xxx unused_yaml_properties variable unused; needed for
# documentation purpose of some sort? -zothar
#unused_yaml_properties = \
#['explored',
# # 'id',
# # 'idStr',
# # 'mapcolor',
# # 'name',
# # 'tex',
# ### 'tex_data',
# # 'tex_direction',
# ### 'tex_direction_data',
# 'tex_extra',
# # 'type'
# ]
for val, data in kw.get('data', {0: {}}).items():
datakw = dict(kw)

11
mce.py
View File

@ -527,8 +527,6 @@ class mce(object):
importLevel = mclevel.fromFile(filename)
destBox = BoundingBox(destPoint, importLevel.size)
self.level.copyBlocksFrom(importLevel, importLevel.bounds, destPoint, blocksToCopy, create=True)
self.needsSave = True
@ -681,9 +679,7 @@ class mce(object):
print "Region {rx},{rz} not found.".format(**locals())
return
used = rf.usedSectors
sectors = rf.sectorCount
print "Region {rx:6}, {rz:6}: {used}/{sectors} sectors".format(**locals())
print "Region {rx:6}, {rz:6}: {used}/{sectors} sectors".format(used=rf.usedSectors, sectors=rf.sectorCount)
print "Offset Table:"
for cx in range(32):
for cz in range(32):
@ -715,8 +711,7 @@ class mce(object):
level.allChunks
coords = (r for r in level.regionFiles)
for i, (rx, rz) in enumerate(coords):
count = level.regionFiles[rx, rz].chunkCount
print "({rx:6}, {rz:6}): {count}, ".format(**locals()),
print "({rx:6}, {rz:6}): {count}, ".format(count=level.regionFiles[rx, rz].chunkCount),
if i % 5 == 4:
print ""
@ -1376,7 +1371,7 @@ class mce(object):
logging.basicConfig(format=u'%(levelname)s:%(message)s')
logging.getLogger().level = logging.INFO
appPath = sys.argv.pop(0)
sys.argv.pop(0)
if len(sys.argv):
world = sys.argv.pop(0)

View File

@ -541,12 +541,9 @@ def extractZipSchematicFromIter(sourceLevel, box, zipfilename=None, entities=Tru
tempfolder = tempfile.mktemp("schematic")
try:
done = False
tempSchematic = MCInfdevOldLevel(tempfolder, create=True)
tempSchematic.materials = sourceLevel.materials
destBox = BoundingBox(destPoint, sourceBox.size)
for i in tempSchematic.copyBlocksFromIter(sourceLevel, sourceBox, destPoint, entities=entities, create=True):
yield i
tempSchematic.saveInPlace() # lights not needed for this format - crashes minecraft though