mirror of
https://github.com/Unidata/python-awips.git
synced 2025-02-23 22:57:56 -05:00
don't use len(object) as a bool, and avoid iterating over a range()
This commit is contained in:
parent
e43f6bb98b
commit
49709197bc
2 changed files with 13 additions and 13 deletions
|
@ -47,17 +47,17 @@ def get_hdf5_data(idra):
|
||||||
azdat = []
|
azdat = []
|
||||||
depVals = []
|
depVals = []
|
||||||
threshVals = []
|
threshVals = []
|
||||||
if len(idra) > 0:
|
if idra:
|
||||||
for ii in range(len(idra)):
|
for item in idra:
|
||||||
if idra[ii].getName() == "Data":
|
if item.getName() == "Data":
|
||||||
rdat = idra[ii]
|
rdat = item
|
||||||
elif idra[ii].getName() == "Angles":
|
elif item.getName() == "Angles":
|
||||||
azdat = idra[ii]
|
azdat = item
|
||||||
# dattyp = "radial"
|
# dattyp = "radial"
|
||||||
elif idra[ii].getName() == "DependentValues":
|
elif item.getName() == "DependentValues":
|
||||||
depVals = idra[ii].getShortData()
|
depVals = item.getShortData()
|
||||||
elif idra[ii].getName() == "Thresholds":
|
elif item.getName() == "Thresholds":
|
||||||
threshVals = idra[ii].getShortData()
|
threshVals = item.getShortData()
|
||||||
|
|
||||||
return rdat, azdat, depVals, threshVals
|
return rdat, azdat, depVals, threshVals
|
||||||
|
|
||||||
|
|
|
@ -225,7 +225,7 @@ class ThriftSerializationContext(object):
|
||||||
if size:
|
if size:
|
||||||
if listType not in primitiveSupport:
|
if listType not in primitiveSupport:
|
||||||
m = self.typeDeserializationMethod[listType]
|
m = self.typeDeserializationMethod[listType]
|
||||||
result = [m() for n in range(size)]
|
result = [m() for __ in range(size)]
|
||||||
else:
|
else:
|
||||||
result = self.listDeserializationMethod[listType](size)
|
result = self.listDeserializationMethod[listType](size)
|
||||||
self.protocol.readListEnd()
|
self.protocol.readListEnd()
|
||||||
|
@ -234,7 +234,7 @@ class ThriftSerializationContext(object):
|
||||||
def _deserializeMap(self):
|
def _deserializeMap(self):
|
||||||
keyType, valueType, size = self.protocol.readMapBegin()
|
keyType, valueType, size = self.protocol.readMapBegin()
|
||||||
result = {}
|
result = {}
|
||||||
for n in range(size):
|
for __ in range(size):
|
||||||
# can't go off the type, due to java generics limitations dynamic serialize is
|
# can't go off the type, due to java generics limitations dynamic serialize is
|
||||||
# serializing keys and values as void
|
# serializing keys and values as void
|
||||||
key = self.typeDeserializationMethod[TType.STRUCT]()
|
key = self.typeDeserializationMethod[TType.STRUCT]()
|
||||||
|
@ -246,7 +246,7 @@ class ThriftSerializationContext(object):
|
||||||
def _deserializeSet(self):
|
def _deserializeSet(self):
|
||||||
setType, setSize = self.protocol.readSetBegin()
|
setType, setSize = self.protocol.readSetBegin()
|
||||||
result = set([])
|
result = set([])
|
||||||
for n in range(setSize):
|
for __ in range(setSize):
|
||||||
result.add(self.typeDeserializationMethod[TType.STRUCT]())
|
result.add(self.typeDeserializationMethod[TType.STRUCT]())
|
||||||
self.protocol.readSetEnd()
|
self.protocol.readSetEnd()
|
||||||
return result
|
return result
|
||||||
|
|
Loading…
Add table
Reference in a new issue