Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
dataType == CDF.CDF_UCHAR):
if (isinstance(data, list) or
isinstance(data, tuple)):
warnings.warn('Invalid global attribute value')
return
numElems = len(data)
elif (dataType == CDF.CDF_EPOCH or
dataType == CDF.CDF_EPOCH16
or dataType == CDF.CDF_TIME_TT2000):
cvalue = []
if (isinstance(data, list) or
isinstance(data, tuple)):
numElems = len(data)
for x in range(0, numElems):
if (isinstance(data[x], str)):
cvalue.append(cdfepoch.CDFepoch.parse(data[x]))
else:
cvalue.append(data[x])
data = cvalue
else:
if (isinstance(data, str)):
data = cdfepoch.CDFepoch.parse(data)
numElems = 1
else:
if (isinstance(data, list) or
isinstance(data, tuple)):
numElems = len(data)
else:
numElems = 1
else:
# Data type not found, both values are data.
data = value
elif (dataType == CDF.CDF_EPOCH or
dataType == CDF.CDF_EPOCH16
or dataType == CDF.CDF_TIME_TT2000):
cvalue = []
if (isinstance(data, list) or
isinstance(data, tuple)):
numElems = len(data)
for x in range(0, numElems):
if (isinstance(data[x], str)):
cvalue.append(cdfepoch.CDFepoch.parse(data[x]))
else:
cvalue.append(data[x])
data = cvalue
else:
if (isinstance(data, str)):
data = cdfepoch.CDFepoch.parse(data)
numElems = 1
else:
if (isinstance(data, list) or
isinstance(data, tuple)):
numElems = len(data)
else:
numElems = 1
else:
# Data type not found, both values are data.
data = value
numElems, dataType = CDF._datatype_define(value[0])
numElems = len(value)
else:
# Length greater than 2, so it is all data.
data = value
numElems, dataType = CDF._datatype_define(value[0])
if (x > 0):
data += str('\\N ')
data += odata[x]
else:
data = odata[x]
numElems = len(data)
elif (dataType == CDF.CDF_EPOCH or dataType == CDF.CDF_EPOCH16
or dataType == CDF.CDF_TIME_TT2000):
cvalue = []
if isinstance(data, (list, tuple)):
numElems = len(data)
for x in range(0, numElems):
cvalue.append(cdfepoch.CDFepoch.parse(data[x]))
data = cvalue
else:
data = cdfepoch.CDFepoch.parse(data)
numElems = 1
else:
# No data type defined...
data = entry
if isinstance(entry, (list, tuple)):
numElems, dataType = CDF._datatype_define(entry[0])
if (dataType == CDF.CDF_CHAR or dataType == CDF.CDF_UCHAR):
data = str('')
for x in range(0, len(entry)):
if (x > 0):
data += str('\\N ')
data += entry[x]
else:
data = entry[x]
numElems = len(data)
else:
odata = data
data = str('')
for x in range(0, items):
if (x > 0):
data += str('\\N ')
data += odata[x]
else:
data = odata[x]
numElems = len(data)
elif (dataType == CDF.CDF_EPOCH or dataType == CDF.CDF_EPOCH16
or dataType == CDF.CDF_TIME_TT2000):
cvalue = []
if isinstance(data, (list, tuple)):
numElems = len(data)
for x in range(0, numElems):
cvalue.append(cdfepoch.CDFepoch.parse(data[x]))
data = cvalue
else:
data = cdfepoch.CDFepoch.parse(data)
numElems = 1
else:
# No data type defined...
data = entry
if isinstance(entry, (list, tuple)):
numElems, dataType = CDF._datatype_define(entry[0])
if (dataType == CDF.CDF_CHAR or dataType == CDF.CDF_UCHAR):
data = str('')
for x in range(0, len(entry)):
if (x > 0):
data += str('\\N ')
data += entry[x]
else:
if (dataType == CDF.CDF_CHAR or
dataType == CDF.CDF_UCHAR):
if (isinstance(data, list) or
isinstance(data, tuple)):
raise ValueError('Invalid variable attribute value')
numElems = len(data)
elif (dataType == CDF.CDF_EPOCH or
dataType == CDF.CDF_EPOCH16
or dataType == CDF.CDF_TIME_TT2000):
cvalue = []
if (isinstance(data, list) or
isinstance(data, tuple)):
numElems = len(data)
for x in range(0, numElems):
if (isinstance(data[x], str)):
avalue = cdfepoch.CDFepoch.parse(data[x])
else:
avalue = data[x]
if (dataType == CDF.CDF_EPOCH16):
cvalue.append(avalue.real)
cvalue.append(avalue.imag)
else:
cvalue.append(avalue)
data = cvalue
else:
if (isinstance(data, str)):
data = cdfepoch.CDFepoch.parse(data)
numElems = 1
else:
if (isinstance(data, list) or isinstance(data, tuple)):
numElems = len(data)
else:
isinstance(data, tuple)):
numElems = len(data)
for x in range(0, numElems):
if (isinstance(data[x], str)):
avalue = cdfepoch.CDFepoch.parse(data[x])
else:
avalue = data[x]
if (dataType == CDF.CDF_EPOCH16):
cvalue.append(avalue.real)
cvalue.append(avalue.imag)
else:
cvalue.append(avalue)
data = cvalue
else:
if (isinstance(data, str)):
data = cdfepoch.CDFepoch.parse(data)
numElems = 1
else:
if (isinstance(data, list) or isinstance(data, tuple)):
numElems = len(data)
else:
numElems = 1
else:
data = value
numElems, dataType = CDF._datatype_define(value[0])
numElems = len(value)
else:
data = value
numElems, dataType = CDF._datatype_define(value[0])
numElems = len(value)
else:
data = value