MCPcopy Create free account
hub / github.com/pyfa-org/Pyfa / validator

Method validator

eos/saveddata/mutator.py:82–95  ·  view source on GitHub ↗

Validates values as properly falling within the range of the items' Mutaplasmid

(self, key, val)

Source from the content-addressed store, hash-verified

80
81 @validates("value")
82 def validator(self, key, val):
83 """ Validates values as properly falling within the range of the items' Mutaplasmid """
84 if self.baseValue == 0:
85 return 0
86 mod = val / self.baseValue
87
88 if self.minMod <= mod <= self.maxMod:
89 # sweet, all good
90 returnVal = val
91 else:
92 actualMin = min(self.minValue, self.maxValue)
93 actualMax = max(self.minValue, self.maxValue)
94 returnVal = min(actualMax, max(actualMin, val))
95 return returnVal
96
97 @property
98 def isInvalid(self):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected