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

Method validator

eos/saveddata/user.py:51–62  ·  view source on GitHub ↗
(self, key, val)

Source from the content-addressed store, hash-verified

49
50 @validates("ID", "username", "password", "admin")
51 def validator(self, key, val):
52 map = {
53 "ID" : lambda _val: isinstance(_val, int),
54 "username": lambda _val: isinstance(_val, str),
55 "password": lambda _val: isinstance(_val, str) and len(_val) == 96,
56 "admin" : lambda _val: isinstance(_val, bool)
57 }
58
59 if not map[key](val):
60 raise ValueError(str(val) + " is not a valid value for " + key)
61 else:
62 return val

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected