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

Function processTraits

db_update.py:344–382  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

342 _addRows(newData, eos.gamedata.AlphaCloneSkill)
343
344 def processTraits():
345 print('processing traits')
346 data = _readData('phobos', 'traits')
347
348 def convertSection(sectionData):
349 sectionLines = []
350 headerText = '<b>{}</b>'.format(sectionData['header'])
351 sectionLines.append(headerText)
352 for bonusData in sectionData['bonuses']:
353 prefix = '{} '.format(bonusData['number']) if 'number' in bonusData else ''
354 bonusText = '{}{}'.format(prefix, bonusData['text'].replace('\u00B7', '\u2022 '))
355 sectionLines.append(bonusText)
356 sectionLine = '<br />\n'.join(sectionLines)
357 return sectionLine
358
359 newData = []
360 for row in data:
361 try:
362 newRow = {
363 'typeID': row['typeID'],
364 }
365 for (k, v) in eos.config.translation_mapping.items():
366 if v == '':
367 v = '_en-us'
368 typeLines = []
369 traitData = row['traits{}'.format(v)]
370 for skillData in sorted(traitData.get('skills', ()), key=lambda i: i['header']):
371 typeLines.append(convertSection(skillData))
372 if 'role' in traitData:
373 typeLines.append(convertSection(traitData['role']))
374 if 'misc' in traitData:
375 typeLines.append(convertSection(traitData['misc']))
376 traitLine = '<br />\n<br />\n'.join(typeLines)
377 newRow['traitText{}'.format(v)] = traitLine
378
379 newData.append(newRow)
380 except:
381 pass
382 _addRows(newData, eos.gamedata.Traits, fieldMap={'traitText_en-us': 'traitText'})
383
384 def processMetadata():
385 print('processing metadata')

Callers 1

update_dbFunction · 0.85

Calls 6

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

Tested by

no test coverage detected