Fixed method naming in stats.py classes
This commit is contained in:
@@ -110,12 +110,12 @@ class DmgTypes:
|
||||
return self
|
||||
|
||||
def __repr__(self):
|
||||
spec = DmgTypes.Names()
|
||||
spec = DmgTypes.names()
|
||||
spec.append('total')
|
||||
return makeReprStr(self, spec)
|
||||
|
||||
@staticmethod
|
||||
def Names(short=None, postProcessor=None):
|
||||
def names(short=None, postProcessor=None):
|
||||
value = ['em', 'th', 'kin', 'exp'] if short else ['em', 'thermal', 'kinetic', 'explosive']
|
||||
|
||||
if postProcessor:
|
||||
@@ -201,11 +201,11 @@ class RRTypes:
|
||||
return self
|
||||
|
||||
def __repr__(self):
|
||||
spec = RRTypes.Names(False)
|
||||
spec = RRTypes.names(False)
|
||||
return makeReprStr(self, spec)
|
||||
|
||||
@staticmethod
|
||||
def Names(ehpOnly=True, postProcessor=None):
|
||||
def names(ehpOnly=True, postProcessor=None):
|
||||
value = ['shield', 'armor', 'hull']
|
||||
|
||||
if not ehpOnly:
|
||||
|
||||
@@ -3,8 +3,8 @@ from eos.saveddata.damagePattern import DamagePattern
|
||||
from eos.utils.stats import RRTypes, DmgTypes
|
||||
from gui.utils.numberFormatter import formatAmount
|
||||
|
||||
tankTypes = RRTypes.Names()
|
||||
damageTypes = DmgTypes.Names()
|
||||
tankTypes = RRTypes.names()
|
||||
damageTypes = DmgTypes.names()
|
||||
damagePatterns = [DamagePattern.oneType(damageType) for damageType in damageTypes]
|
||||
damageTypeResonanceNames = [damageType.capitalize() + "DamageResonance" for damageType in damageTypes]
|
||||
resonanceNames = {tankTypes[0]: [tankTypes[0] + s for s in damageTypeResonanceNames],
|
||||
@@ -50,8 +50,8 @@ def tankSection(fit):
|
||||
|
||||
def generalOutput():
|
||||
rowNames = ["EHP"]
|
||||
rowNames.extend(RRTypes.Names(postProcessor=lambda v: v.capitalize()))
|
||||
colNames = DmgTypes.Names(short=True, postProcessor=lambda v: " " + v.capitalize())
|
||||
rowNames.extend(RRTypes.names(postProcessor=lambda v: v.capitalize()))
|
||||
colNames = DmgTypes.names(short=True, postProcessor=lambda v: " " + v.capitalize())
|
||||
colNames[0] = colNames[0][1::]
|
||||
|
||||
outputScheme = []
|
||||
@@ -144,7 +144,7 @@ def repsSection(fit):
|
||||
shieldRegenStr = [formatAmount(rep, 3, 0, 9) if rep != 0 else "" for rep in shieldRegen]
|
||||
totalRepStr = [formatAmount(rep, 3, 0, 9) for rep in totalRep]
|
||||
|
||||
lines = RRTypes.Names(postProcessor=lambda v: v.capitalize())
|
||||
lines = RRTypes.names(postProcessor=lambda v: v.capitalize())
|
||||
lines.append("Total")
|
||||
lines = ["{:<8}".format(line) for line in lines]
|
||||
|
||||
|
||||
@@ -16,9 +16,9 @@ def setup_damage_types():
|
||||
|
||||
|
||||
def test_dmgtypes_names():
|
||||
assert DmgTypes.Names() == ['em', 'thermal', 'kinetic', 'explosive']
|
||||
assert DmgTypes.Names(True) == ['em', 'th', 'kin', 'exp']
|
||||
assert DmgTypes.Names(short=True) == ['em', 'th', 'kin', 'exp']
|
||||
assert DmgTypes.names() == ['em', 'thermal', 'kinetic', 'explosive']
|
||||
assert DmgTypes.names(True) == ['em', 'th', 'kin', 'exp']
|
||||
assert DmgTypes.names(short=True) == ['em', 'th', 'kin', 'exp']
|
||||
|
||||
|
||||
def test_dmgtypes__repr(setup_damage_types):
|
||||
@@ -26,8 +26,8 @@ def test_dmgtypes__repr(setup_damage_types):
|
||||
|
||||
|
||||
def test_dmgtypes_names_lambda():
|
||||
assert DmgTypes.Names(False, lambda v: v.capitalize()) == ['Em', 'Thermal', 'Kinetic', 'Explosive']
|
||||
assert DmgTypes.Names(True, lambda v: v.upper()) == ['EM', 'TH', 'KIN', 'EXP']
|
||||
assert DmgTypes.names(False, lambda v: v.capitalize()) == ['Em', 'Thermal', 'Kinetic', 'Explosive']
|
||||
assert DmgTypes.names(True, lambda v: v.upper()) == ['EM', 'TH', 'KIN', 'EXP']
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
@@ -36,10 +36,10 @@ def setup_rr_types():
|
||||
|
||||
|
||||
def test_rrtypes_names():
|
||||
assert RRTypes.Names() == ['shield', 'armor', 'hull']
|
||||
assert RRTypes.Names(True) == ['shield', 'armor', 'hull']
|
||||
assert RRTypes.Names(ehpOnly=True) == ['shield', 'armor', 'hull']
|
||||
assert RRTypes.Names(False) == ['shield', 'armor', 'hull', 'capacitor']
|
||||
assert RRTypes.names() == ['shield', 'armor', 'hull']
|
||||
assert RRTypes.names(True) == ['shield', 'armor', 'hull']
|
||||
assert RRTypes.names(ehpOnly=True) == ['shield', 'armor', 'hull']
|
||||
assert RRTypes.names(False) == ['shield', 'armor', 'hull', 'capacitor']
|
||||
|
||||
|
||||
def test_rrtypes__repr(setup_rr_types):
|
||||
@@ -47,7 +47,7 @@ def test_rrtypes__repr(setup_rr_types):
|
||||
|
||||
|
||||
def test_rrtypes_names_lambda():
|
||||
assert RRTypes.Names(True, lambda v: v.capitalize()) == ['Shield', 'Armor', 'Hull']
|
||||
assert RRTypes.Names(postProcessor=lambda v: v.upper(), ehpOnly=False) == ['SHIELD', 'ARMOR', 'HULL', 'CAPACITOR']
|
||||
assert RRTypes.names(True, lambda v: v.capitalize()) == ['Shield', 'Armor', 'Hull']
|
||||
assert RRTypes.names(postProcessor=lambda v: v.upper(), ehpOnly=False) == ['SHIELD', 'ARMOR', 'HULL', 'CAPACITOR']
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user