Validates values as properly falling within the range of the items' Mutaplasmid
(self, key, val)
| 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): |
nothing calls this directly
no outgoing calls
no test coverage detected