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

Method validator

eos/saveddata/drone.py:320–332  ·  view source on GitHub ↗
(self, key, val)

Source from the content-addressed store, hash-verified

318
319 @validates("ID", "itemID", "chargeID", "amount", "amountActive")
320 def validator(self, key, val):
321 map = {
322 "ID" : lambda _val: isinstance(_val, int),
323 "itemID" : lambda _val: isinstance(_val, int),
324 "chargeID" : lambda _val: isinstance(_val, int),
325 "amount" : lambda _val: isinstance(_val, int) and _val >= 0,
326 "amountActive": lambda _val: isinstance(_val, int) and self.amount >= _val >= 0
327 }
328
329 if not map[key](val):
330 raise ValueError(str(val) + " is not a valid value for " + key)
331 else:
332 return val
333
334 def clear(self):
335 self.__baseVolley = None

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected