MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / processCloneGrades

Function processCloneGrades

db_update.py:309–342  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

307 _addRows(data, eos.gamedata.MetaGroup, fieldMap=map)
308
309 def processCloneGrades():
310 print('processing clonegrades')
311 data = _readData('fsd_lite', 'clonegrades')
312
313 newData = []
314 # December, 2017 - CCP decided to use only one set of skill levels for alpha clones. However, this is still
315 # represented in the data as a skillset per race. To ensure that all skills are the same, we store them in a way
316 # that we can check to make sure all races have the same skills, as well as skill levels
317 check = {}
318 for ID in data:
319 for skill in data[ID]['skills']:
320 newData.append({
321 'alphaCloneID': int(ID),
322 'alphaCloneName': 'Alpha Clone',
323 'typeID': skill['typeID'],
324 'level': skill['level']})
325 if ID not in check:
326 check[ID] = {}
327 check[ID][int(skill['typeID'])] = int(skill['level'])
328 if not functools.reduce(lambda a, b: a if a == b else False, [v for _, v in check.items()]):
329 raise Exception('Alpha Clones not all equal')
330 newData = [x for x in newData if x['alphaCloneID'] == 1]
331 if len(newData) == 0:
332 raise Exception('Alpha Clone processing failed')
333
334 tmp = []
335 for row in newData:
336 if row['alphaCloneID'] not in tmp:
337 cloneParent = eos.gamedata.AlphaClone()
338 setattr(cloneParent, 'alphaCloneID', row['alphaCloneID'])
339 setattr(cloneParent, 'alphaCloneName', row['alphaCloneName'])
340 eos.db.gamedata_session.add(cloneParent)
341 tmp.append(row['alphaCloneID'])
342 _addRows(newData, eos.gamedata.AlphaCloneSkill)
343
344 def processTraits():
345 print('processing traits')

Callers 1

update_dbFunction · 0.85

Calls 4

_readDataFunction · 0.85
_addRowsFunction · 0.85
itemsMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected