Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if "online" not in raw:
raise ValueError("Invalid players object (no 'online' value)")
if type(raw["online"]) is not int:
raise ValueError("Invalid players object (expected 'online' to be int, was %s)" % type(raw["online"]))
self.online = raw["online"]
if "max" not in raw:
raise ValueError("Invalid players object (no 'max' value)")
if type(raw["max"]) is not int:
raise ValueError("Invalid players object (expected 'max' to be int, was %s)" % type(raw["max"]))
self.max = raw["max"]
if "sample" in raw:
if type(raw["sample"]) is not list:
raise ValueError("Invalid players object (expected 'sample' to be list, was %s)" % type(raw["max"]))
self.sample = [PingResponse.Players.Player(p) for p in raw["sample"]]
else:
self.sample = None