def parse(data): assert (data is not None), 'Tournament.parse must have a data parameter' if 'data' in data and 'tournament' in data['data']: raise DataMalformedException( data, 'data is malformed for Tournament.parse. ' 'Please give only what is contained in the ' '"tournament" property') assert ('id' in data), 'Tournament.parse must have id in data parameter' assert ('name' in data), 'Tournament.parse must have id in data parameter' assert ('slug' in data), 'Tournament.parse must have id in data parameter' assert ('startAt' in data), 'Tournament.parse must have id in data parameter' assert ('endAt' in data), 'Tournament.parse must have id in data parameter' assert ('timezone' in data), 'Tournament.parse must have id in data parameter' return Tournament(data['id'], data['name'], data['slug'], data['startAt'], data['endAt'], data['timezone'], Venue.parse(data), Organizer.parse(data))
def parse(data): assert (data is not None), "PhaseGroup.parse cannot have None for data parameter" if 'data' in data: raise DataMalformedException(data, 'data is malformed for PhaseGroup.parse. ' 'Please give only what is contained in the ' '"phaseGroup" property') assert ('id' in data), 'PhaseGroup.parse must have a id property in data parameter' assert ('displayIdentifier' in data), \ 'PhaseGroup.parse cannot must have a displayIdentifier property in data parameter' assert ('firstRoundTime' in data), \ 'PhaseGroup.parse cannot must have a firstRoundTime property in data parameter' assert ('state' in data), 'PhaseGroup.parse cannot must have a state property in data parameter' assert ('phase' in data), 'PhaseGroup.parse cannot must have a phaseId property in data parameter' assert ('wave' in data), 'PhaseGroup.parse cannot must have a waveId property in data parameter' assert ('tiebreakOrder' in data), 'PhaseGroup.parse cannot must have a tiebreakOrder property in data parameter' return PhaseGroup( data['id'], data['displayIdentifier'], data['firstRoundTime'], data['state'], data['phase'], data['wave'], data['tiebreakOrder'] )
def validate_data(input, id: int=0): if 'data' in input: raise DataMalformedException(input, 'data is malformed for PhaseGroup.parse. ' 'Please give only what is contained in the ' '"phaseGroup" property') if 'phaseGroup' not in input and 'phaseGroups' not in input: raise NoPhaseGroupDataException(id) elif 'phaseGroup' in input and input['phaseGroup'] is None: raise NoPhaseGroupDataException(id) elif 'phaseGroups' in input and input['phaseGroups'] is None: raise NoPhaseGroupDataException(id)
def validate_data(input: dict, id: int=0) -> None: if 'data' in input: raise DataMalformedException(input) if 'phaseGroup' in input: input = input['phaseGroup'] if 'participant' not in input and 'paginatedSeeds' not in input: raise NoAttendeeDataException(id) if 'participant' in input and input['participant'] is None: raise NoAttendeeDataException(id) elif 'paginatedSeeds' in input and input['paginatedSeeds']['nodes'] is None: raise NoAttendeeDataException(id)
def parse(data): assert (data is not None), 'Event.parse cannot have None for data parameter' if 'data' in data and 'event' in data['data']: raise DataMalformedException( data, 'data is malformed for Event.parse. ' 'Please give only what is contained in the ' '"event" property') assert ('id' in data), 'Event.parse must have id property on data parameter' assert ( 'name' in data), 'Event.parse must have name property on data parameter' assert ( 'slug' in data), 'Event.parse must have slug property on data parameter' assert ( 'state' in data), 'Event.parse must have state property on data parameter' assert ('startAt' in data ), 'Event.parse must have startAt property on data parameter' assert ( 'numEntrants' in data ), 'Event.parse must have numEntrants property on data parameter' assert ( 'checkInBuffer' in data ), 'Event.parse must have checkInBuffer property on data parameter' assert ( 'checkInDuration' in data ), 'Event.parse must have checkInDuration property on data parameter' assert ( 'checkInEnabled' in data ), 'Event.parse must have checkInEnabled property on data parameter' assert ('isOnline' in data ), 'Event.parse must have isOnline property on data parameter' assert ( 'teamNameAllowed' in data ), 'Event.parse must have teamNameAllowed property on data parameter' assert ('teamManagementDeadline' in data), \ 'Event.parse must have teamManagementDeadline property on data parameter' return Event(data['id'], data['name'], data['slug'], data['state'], data['startAt'], data['numEntrants'], data['checkInBuffer'], data['checkInDuration'], data['checkInEnabled'], data['isOnline'], data['teamNameAllowed'], data['teamManagementDeadline'])
def parse(data): assert (data is not None), 'Phase.parse cannot have None for data parameter' if 'data' in data and 'phase' in data['data']: raise DataMalformedException( data, 'data is malformed for Phase.parse. ' 'Please give only what is contained in the ' '"phase" property') assert ( 'id' in data ), 'Phase.parse cannot have a None id property in data parameter' assert ( 'name' in data ), 'Phase.parse cannot have a None name property in data parameter' assert ( 'numSeeds' in data ), 'Phase.parse cannot have a None numSeeds property in data parameter' assert ( 'groupCount' in data ), 'Phase.parse cannot have a None groupCount property in data parameter' return Phase(data['id'], data['name'], data['numSeeds'], data['groupCount'])
def validate_data(data: dict): if 'data' not in data: raise DataMalformedException(data) if 'errors' in data['data']: raise DataPullException(id, data['data']['errors'])
def validate_data(input, id: int = 0): if 'data' in input: raise DataMalformedException(input) if 'phase' not in input or input['phase'] is None: raise NoPhaseDataException(id)
def validate_data(input: dict, slug: str = None): if 'data' in input: raise DataMalformedException(input) if 'tournament' not in input or input['tournament'] is None: raise NoTournamentDataException(slug)
def validate_data(input: dict, id: int = 0): if 'data' in input: raise DataMalformedException(input) if 'event' not in input or input['event'] is None: raise NoEventDataException(id)