mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-25 04:02:46 +01:00
Math.convertcore: remove unnecessary StringIO usage
Since the unit data is already a variable, we can read from it as is
This commit is contained in:
parent
21a729d95a
commit
2460c0abca
@ -1059,12 +1059,7 @@ class UnitData(dict):
|
||||
"Read all unit data from file"
|
||||
types = []
|
||||
typeUnits = {}
|
||||
try:
|
||||
f = minisix.io.StringIO(unitData)
|
||||
lines = f.readlines()
|
||||
f.close()
|
||||
except IOError:
|
||||
raise UnitDataError('Can not read "units.dat" file')
|
||||
lines = unitData.splitlines()
|
||||
for i in range(len(lines)): # join continuation lines
|
||||
delta = 1
|
||||
while lines[i].rstrip().endswith('\\'):
|
||||
@ -1229,5 +1224,3 @@ def units(type):
|
||||
return '%s units: %s' % (type, ', '.join(unitsByType[type]))
|
||||
else:
|
||||
return 'valid types: ' + ', '.join(types)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user