def save(self): if self.id == None: self.id = str(uuid4()) users[self.id] = self userNames[self.username] = self usrs = [users[id].toJSON() for id in users] setKey("/users.json", usrs)
def save(self): with lock.gen_wlock(): if self.id == None: self.id = str(uuid4()) contests[self.id] = self setKey(f"/contests/{self.id}/contest.json", self.toJSONSimple()) for callback in Contest.saveCallbacks: callback(self)
def save(self): with lock.gen_wlock(): if self.id == None: self.id = str(uuid4()) messages[self.id] = self setKey(f"/messages/{self.id}/message.json", self.toJSONSimple()) for callback in Message.saveCallbacks: callback(self)
def save(self): with lock.gen_wlock(): if self.id == None: self.id = str(uuid4()) submissions[self.id] = self setKey(f"/submissions/{self.id}/submission.json", self.toJSONSimple()) for callback in Submission.saveCallbacks: callback(self)
def save(self): with lock.gen_wlock(): if self.id == None: self.id = str(uuid4()) problems[self.id] = self setKey(f"/problems/{self.id}/problem.json", self.toJSONSimple()) for i, datum in enumerate(self.testData): setKey(f"/problems/{self.id}/input/in{i}.txt", datum.input) setKey(f"/problems/{self.id}/output/out{i}.txt", datum.output) self.sampleData = [Datum.get(self.id, i) for i in range(self.samples)] for callback in Problem.saveCallbacks: callback(self)
def save(self): with lock.gen_wlock(): if self.id == None: self.id = str(uuid4()) problems[self.id] = self setKey(f"/problems/{self.id}/problem.json", self.toJSONSimple()) for i, datum in enumerate(self.testData): setKey(f"/problems/{self.id}/input/in{i}.txt", datum.input) setKey(f"/problems/{self.id}/output/out{i}.txt", datum.output) self.sampleData = [ Datum.get(self.id, i) for i in range(self.samples) ] for callback in Problem.saveCallbacks: callback(self)