Example #1
0
def get_any_conf():
    # used when no conference_lib selected
    # presumably gets "first" conference_lib
    # normally only 1 conference_lib live in the system at any time
    confs = Conference.query().fetch(1)
    if confs == []:
        return None
    else:
        return confs[0]
Example #2
0
    def display(self):
        liste_of_dicto=self.model.get_all()
        str_of_display=""
        
        for dicto in (liste_of_dicto):

            speaker = Speaker(dicto)
            conference = Conference(dicto)
            str_of_display += "<p>"+(str(speaker)+" a animer "+str(conference))+"</p>"
        return str_of_display
Example #3
0
def main():
    ap = argparse.ArgumentParser()
    ap.add_argument("-p",
                    "--path",
                    required=True,
                    help="path csv file containing talks")
    args = vars(ap.parse_args())

    # Load arguments
    file_name = args['path']

    # Global variables
    n_days = 3  # (days)
    starting_time = 9  # (hours)
    closing_time = 17  # (hours)
    cleaning_break = 15  # (minutes)
    lunch_break = [12, 13]  # (hours)

    # Create talk list object
    tList = TalksList()

    # Load list of talks into the TalkList object
    with open(file_name, newline='') as csvfile:
        talksreader = csv.reader(csvfile, delimiter=',', quotechar='|')
        for idx, row in enumerate(talksreader):
            if idx == 0:
                pass
            else:
                tList.add_talk(Talk(row[0], row[1], row[2]))

    # Create Conference object
    conf = Conference(n_days, starting_time, closing_time, cleaning_break,
                      lunch_break)

    # Fit list of talks into the conference
    conf.fit_talks(tList)

    # Load Agenda and print it
    agenda = conf.get_agenda()
    for row in agenda:
        print(row)
def make_conf_graphs(absolute=False,
                     old=None,
                     scale=None,
                     week=-1,
                     order='winexp'):
    for conference in PFIVE + GFIVE:
        conf = Conference(name=conference, schedule=schedule)
        if not scale:
            for color in ['team', 'red-green', 'red-blue']:
                try:
                    conf.make_standings_projection_graph(absolute=absolute,
                                                         method='sp+',
                                                         file=conference,
                                                         old=old,
                                                         scale=color,
                                                         week=week,
                                                         order=order)
                except KeyError:
                    print('problem with {}'.format(conf))
        else:
            try:
                conf.make_standings_projection_graph(absolute=absolute,
                                                     method='sp+',
                                                     file=conference,
                                                     old=old,
                                                     scale=scale,
                                                     week=week,
                                                     order=order)
            except KeyError:
                print('problem with {}'.format(conf))
Example #5
0
def main():
    conference = Conference()

    # userInput = None

    while True:
        userInput = input("1. Save \n2. Load \n3. Add speaker \n4. Quit \n> ")
        print()
        if userInput == "1":
            conference.save()

        elif userInput == "2":
            conference.load()

        elif userInput == "3":
            conference.addSpeaker(addSpeaker())

        elif userInput == "4":
            break
Example #6
0
def run():
    try:
        file_name = sys.argv[1]
        app = ConferenceManager(file_name)

        app.read_file_and_create_tasks()
        if len(task_list) > 0:
            conference = Conference()
            while any(task.is_scheduled == 0 for task in task_list):
                session_list = app.create_and_fill_sessions()
                create_track_and_fill_track(conference, session_list)
            print_sessions(conference)
        else:
            print('No tasks given to be scheduled')
    except IndexError:
        print('Please give the input file with command')
    except BaseException as e:
        print('some error occurred' + str(e))
def parse_conferences_from_directory(conferences_directory):
    log.info("Loading conferences from " + conferences_directory)
    conferences = {}
    if not os.path.isdir(conferences_directory):
        log.error("Could not find " + conferences_directory)
        return None
    for base_directory_name, directory_names, file_names in os.walk(conferences_directory):
        for filename in file_names:

            # Ensure that the directory is a year directory
            if not re.match(conferences_directory + "/[0-9]{4}", base_directory_name):
                log.warning("Found {directory} that does not match expected "
                            "directory format".format(directory=base_directory_name))
            conf_year = base_directory_name[-4:]  # TODO use re groups instead

            # Ensure that the filename is valid
            if not re.match("[a-z-]+.yml", filename):
                log.warning("Found {filename} that does not match expected "
                            "file format".format(filename=filename))
            conf_slug = filename[:-4]  # TODO use re groups instead

            conf_id = conf_year + '/' + conf_slug
            log.debug("Found conference {conf_id}".format(conf_id=conf_id))

            # Load YAML
            with open(os.path.join(base_directory_name, filename), 'r') as f:
                log.info("Loading {file_name}".format(file_name=f.name))
                conf_data = yaml.load(f)
                # if not isinstance(conf_data, dict):
                #     log.error("{file_name} didn't produce a dict when loaded".format(
                #               file_name=f.name))
                #     pass
            try:
                conferences[conf_id] = Conference(conf_id, conf_data,
                                                  conf_year, conf_slug)
            except KeyError as e:
                log.error("Failed to initialize Conference: Key Error - " + str(e))
            # conferences[conf_id] = conf_data
            # conferences[conf_id]['meta_year'] = conf_year
            # conferences[conf_id]['meta_name'] = conf_name
            log.info("Loaded conference {conf_id}".format(conf_id=conf_id))
    return conferences
Example #8
0
def get_conf_by_shortname(shortname):
    confs = Conference.query().filter(Conference.conf_shortname == shortname).fetch(1)
    if confs == []:
        return None
    else:
        return confs[0]
Example #9
0
def get_conf_by_name(n):
    confs = Conference.query().filter(Conference.conf_name == n).fetch(1)
    if confs == []:
        return None
    else:
        return confs[0]
Example #10
0
def test_retrieve_conferences_not_finished():
    return Conference.query(ndb.OR(Conference.conf_state == "Round1Reviews",
                                   Conference.conf_state == "Round2Reviews")).filter().fetch()
Example #11
0
def retrieve_all_conferences_by_state(state):
    return Conference.query().filter(Conference.conf_state == state).fetch()
Example #12
0
def retrieve_all_conferences():
    return Conference.query().fetch()
Example #13
0
File: ddpl.py Project: jvasak/bpmc
    def __init__(self):
        logging.debug("In DDPL constructor")

        self.__standings  = dict()
        self.__postseason = dict()

        League.__init__(self, 'DDPL')

        pc = Conference('Piler')
        pc.setColors('black', 'blue')

        fc = Conference('Fornicator')
        fc.setColors('black', 'red')

        self.addChild(pc)
        self.addChild(fc)

        pc.addChild(Team('Beaners',           'BE'))
        pc.addChild(Team('Brains',            'BR'))
        pc.addChild(Team('CM All-Stars',      'CM'))
        pc.addChild(Team('Cuban Prostitutes', 'CP'))
        pc.addChild(Team('Hairy Palms',       'HP'))
        pc.addChild(Team('Umbrellas',         'UM'))

        fc.addChild(Team('Charlies',          'CH'))
        fc.addChild(Team('Dictators',         'DI'))
        fc.addChild(Team('La Players',        'LP'))
        fc.addChild(Team('Raw Doggers',       'RD'))
        fc.addChild(Team('Rusty Trombones',   'RT'))
        fc.addChild(Team('Sausage Milkers',   'SM'))
Example #14
0
async def send_private_message(sid, data):
    json = {}

    v = cerberus.Validator()

    v.schema = {
        'to': {
            'type': 'UUID',
            'required': True,
            'coerce': UUID
        },
        'text': {
            'type': 'string',
            'required': True
        }
    }

    if not v.validate(data):
        json['errors'] = v.errors

        return json

    user = await sio.get_session(sid)

    sender = database.session.query(User).get(user['uuid'])

    receiver = database.session.query(User).get(data['to'])

    if not receiver:
        json['errors'] = {'to': "Reciever doesn't exist"}

        return json

    if receiver.uuid == sender.uuid:
        json['errors'] = {'to': "Saved messages isn't implemeted yet"}

        return json

    conference = database.session.query(Conference) \
            .join(Conference_Reference) \
            .filter(and_(
                Conference.type == 'private',
                Conference_Reference.conference_uuid == Conference.uuid,
                Conference_Reference.user_uuid == sender.uuid,
                Conference_Reference.participant_uuid == receiver.uuid
            )) \
            .one_or_none()

    if not conference:
        conference = Conference(uuid=uuid4(), type='private')

        sender_conference_reference = Conference_Reference(
            user_uuid=sender.uuid, conference=conference, participant=receiver)

        receiver_conference_reference = Conference_Reference(
            user=receiver, conference=conference, participant_uuid=sender.uuid)

        sender_participant = Participant(conference=conference,
                                         user_uuid=sender.uuid)

        receiver_participant = Participant(conference=conference,
                                           user=receiver)

        database.session.add(conference)
        database.session.flush()

        database.session.add_all([
            sender_conference_reference, receiver_conference_reference,
            sender_participant, receiver_participant
        ])
        database.session.flush()

        sender.conferences_count += 1
        receiver.conferences_count += 1

        database.session.add_all([sender, receiver])
        database.session.flush()

    sender_conference_reference = database.session.query(Conference_Reference) \
        .filter(and_(
            Conference_Reference.user_uuid == sender.uuid,
            Conference_Reference.conference_uuid == conference.uuid
        )) \
        .one_or_none()

    # In case sender has deleted his own conference
    if not sender_conference_reference:
        sender_conference_reference = Conference_Reference(
            user_uuid=sender.uuid, conference=conference, participant=receiver)

        database.session.add(sender_conference_reference)
        database.session.flush()

        sender.conferences_count += 1

        database.session.add(sender)
        database.session.flush()

    receiver_conference_reference = database.session.query(Conference_Reference) \
        .filter(and_(
            Conference_Reference.user_uuid == receiver.uuid,
            Conference_Reference.conference_uuid == conference.uuid
        )) \
        .one_or_none()

    # In case receiver has deleted his own conference
    if not receiver_conference_reference:
        receiver_conference_reference = Conference_Reference(
            user=receiver, conference=conference, participant_uuid=sender.uuid)

        database.session.add(receiver_conference_reference)
        database.session.flush()

        receiver.conferences_count += 1

        database.session.add(receiver)
        database.session.flush()

    message = Message(uuid=uuid4(),
                      conference=conference,
                      author_uuid=sender.uuid,
                      type='text/plain',
                      content=data['text'],
                      edited=False)

    sender_message_reference = Message_Reference(user_uuid=sender.uuid,
                                                 message=message)
    receiver_message_reference = Message_Reference(user=receiver,
                                                   message=message)

    database.session.add(message)
    database.session.flush()

    database.session.add(sender_message_reference)
    database.session.add(receiver_message_reference)
    database.session.flush()

    sender_conference_reference.updated_at = datetime.datetime.utcnow()
    sender_conference_reference.messages_count += 1
    sender_conference_reference.last_message = message

    receiver_conference_reference.updated_at = datetime.datetime.utcnow()
    receiver_conference_reference.messages_count += 1
    receiver_conference_reference.unread_messages_count += 1
    receiver_conference_reference.last_message = message

    database.session.add(sender_conference_reference)
    database.session.add(receiver_conference_reference)
    database.session.flush()

    database.session.commit()

    conference_references = [
        sender_conference_reference, receiver_conference_reference
    ]

    await sio.emit('user.conferences_count.updated',
                   {'conferences_count': sender.conferences_count},
                   room=str(sender.uuid))
    await sio.emit('user.conferences_count.updated',
                   {'conferences_count': receiver.conferences_count},
                   room=str(receiver.uuid))

    for conference_reference in conference_references:
        c = {
            'uuid': str(conference.uuid),
            'type': conference.type,
            'updated_at': conference_reference.updated_at.timestamp(),
            'messages_count': conference_reference.messages_count,
            'unread_messages_count':
            conference_reference.unread_messages_count,
            'participant': {
                'uuid': str(conference_reference.participant.uuid),
                'name': conference_reference.participant.name,
                'public_key': conference_reference.participant.public_key
            },
            'last_message': {
                'uuid':
                str(message.uuid),
                'author': {
                    'uuid': str(message.author.uuid),
                    'name': message.author.name,
                    'public_key': message.author.public_key
                },
                'conference': {
                    'uuid': str(conference.uuid),
                    'type': conference.type,
                    'updated_at': conference_reference.updated_at.timestamp(),
                    'messages_count': conference_reference.messages_count,
                    'unread_messages_count':
                    conference_reference.unread_messages_count,
                    'participant': {
                        'uuid': str(conference_reference.participant.uuid),
                        'name': conference_reference.participant.name,
                        'public_key':
                        conference_reference.participant.public_key
                    }
                },
                'read':
                message.read,
                'readAt':
                message.read_at.timestamp()
                if message.read_at is not None else message.read_at,
                'date':
                message.date.timestamp(),
                'type':
                message.type,
                'content':
                message.content,
                'consumed':
                message.consumed,
                'edited':
                message.edited
            }
        }

        await sio.emit('conference.updated',
                       c,
                       room=str(conference_reference.user.uuid))

        m = {
            'uuid':
            str(message.uuid),
            'author': {
                'uuid': str(message.author.uuid),
                'name': message.author.name,
                'public_key': message.author.public_key
            },
            'conference': {
                'uuid': str(conference.uuid),
                'type': conference.type,
                'updated_at': conference_reference.updated_at.timestamp(),
                'messages_count': conference_reference.messages_count,
                'unread_messages_count':
                conference_reference.unread_messages_count,
                'participant': {
                    'uuid': str(conference_reference.participant.uuid),
                    'name': conference_reference.participant.name,
                    'public_key': conference_reference.participant.public_key
                }
            },
            'read':
            message.read,
            'readAt':
            message.read_at.timestamp()
            if message.read_at is not None else message.read_at,
            'date':
            message.date.timestamp(),
            'type':
            message.type,
            'content':
            message.content,
            'consumed':
            message.consumed,
            'edited':
            message.edited
        }

        await sio.emit('private.message.sent',
                       m,
                       room=str(conference_reference.user.uuid))

    json['message'] = {
        'uuid':
        str(message.uuid),
        'author': {
            'uuid': str(message.author.uuid),
            'name': message.author.name,
            'public_key': message.author.public_key
        },
        'conference': {
            'uuid': str(conference.uuid),
            'type': conference.type,
            'updated_at': sender_conference_reference.updated_at.timestamp(),
            'messages_count': sender_conference_reference.messages_count,
            'unread_messages_count':
            sender_conference_reference.unread_messages_count,
            'participant': {
                'uuid': str(sender_conference_reference.participant.uuid),
                'name': sender_conference_reference.participant.name,
                'public_key':
                sender_conference_reference.participant.public_key
            }
        },
        'read':
        message.read,
        'readAt':
        message.read_at.timestamp()
        if message.read_at is not None else message.read_at,
        'date':
        message.date.timestamp(),
        'type':
        message.type,
        'content':
        message.content,
        'consumed':
        message.consumed,
        'edited':
        message.edited
    }

    return json
Example #15
0
def count_conferences():
    return Conference.query().count()
Example #16
0
def conference_set_state(request):
  c = Conference()
  state = request.GET['state']
  c.set_state(state)
  return HttpResponse(state)
Example #17
0
def conference_inf(request):
  c = Conference()
  return HttpResponse(etree.tostring(c.inf(), encoding='UTF-8', xml_declaration=True, pretty_print=True),mimetype='text/xml') 
Example #18
0
def conference_save(request):
  c = Conference()
  venues = request.POST.getlist('venue_id')
  inf = request.POST
  c.update(inf, venues)
  return HttpResponse('ok')
Example #19
0
    def parse(self):

        conference_xml = ET.parse(self.input).getroot()
        conference = Conference()

        for subevent in conference_xml:

            if subevent.tag == 'subevent':

                for child in subevent:

                    if child.tag == 'title':
                        current_session = Session(child.text, conference)

                    elif child.tag == 'date':
                        current_session.day = child.text

                    elif child.tag == 'room':
                        current_session.room = child.text

                    elif child.tag == 'tracks':

                        assert len(child) == 1  # one event in a single track
                        track_tag = child[0]
                        track = conference.get_track(track_tag.text)
                        current_session.track = track
                        track.add_session(current_session)

                    elif child.tag == 'timeslot':
                        for slot_child in child:

                            if slot_child.tag == 'title':
                                current_slot = Slot(slot_child.text if slot_child.text is not None else "Unknown")
                                current_session.add_slot(current_slot)

                            elif slot_child.tag == 'room':
                                current_slot.room = slot_child.text

                            elif slot_child.tag == 'start_time':
                                current_slot.start = slot_child.text

                            elif slot_child.tag == 'end_time':
                                current_slot.end = slot_child.text

                            elif slot_child.tag == 'description':
                                current_slot.description = slot_child.text

                            elif slot_child.tag == 'persons':

                                for person in slot_child:
                                    for person_child in person:

                                        if person_child.tag == 'first_name':
                                            current_speaker = Speaker(person_child.tag, None, None)
                                            current_slot.add_speaker(current_speaker)

                                        elif person_child.tag == 'last_name':
                                            current_speaker.last_name = person_child.text

                                        elif person_child.tag == 'affiliation':
                                            current_speaker.affiliation = person_child.text

            else:
                pass
                # print "Unhandled tag: " + str(subevent)

        # sort sessions by date and name
        conference.sort_sessions()

        # build time ranges
        conference.build_time_ranges()

        return conference
Example #20
0
def main():

	all_talks = load_talks_from_csv()

	'''
	Sum up all the minutes for all the talks that we
	loaded from CSV
	'''
	total_time_for_all_talks = sum(t.duration for t in all_talks)

	t1 = Track("Track One",
			[
				AMSession(SESSION_DURATION['AM']), 
				PMSession(SESSION_DURATION['PM_MAX'], SESSION_DURATION['PM_MIN'])
			]
	)

	t2 = Track("Track Two",
			[
				AMSession(SESSION_DURATION['AM']), 
				PMSession(SESSION_DURATION['PM_MAX'], SESSION_DURATION['PM_MIN'])
			]
	)


	c = Conference(SESSION_TIMINGS['MORNING'], 
					SESSION_TIMINGS['LUNCH'], 
					SESSION_TIMINGS['AFTERNOON'])
	c.append(t1)
	c.append(t2)

	'''
	Check to ensure that our sessions have been allocated enough
	time to fit in all the talks in the list
	'''
	if total_time_for_all_talks > c.time_allocated():
		print("Please allocate more space to the sessions in order to " + \
				"accomodate all the talks.\n" + \
				"Total talk time: {}\nTotal time allocated in sessions:{}\n\n".format(total_time_for_all_talks, c.time_allocated()))

		sys.exit()

	i = 0



	while True:

		talks = list(all_talks)

		random.shuffle(talks)

		''' 
		Prepare multi-capacity bin that we will use to populate with talks
		'''
		c.reset_sessions()
		sessions = c.get_all_sessions()


		'''
		Loop while there are still talks that have yet to be allocated
		to a session
		'''
		while len(talks) != 0:

			'''
			Use this to break out of the loop if all sessions still have
			space in them but not big enough to accomodate the
			current talk
			for e.g.
			Python for beginners: 60mins
			Track 1, AM session: 30mins unallocated
			Track 1, PM session: 15mins unallocated
			Track 2, AM session: 5mins unallocated
			Track 2, PM session: 30mins unallocated
			'''
			can_fit_in_at_least_one_session = False

			''' 
			Start doing first-fit bin packing
			'''
			for session in sessions:

				'''
				Continue to the next bin if current bin is full
				'''
				if session.is_full():
					continue

				'''
				Add talk to bin. Remove talk from the list 
				Proceed to finding a place for the next talk
				'''
				if session.append(talks[0]):
					can_fit_in_at_least_one_session = True
					talks.pop(0)
					break;

			if not can_fit_in_at_least_one_session:
				print("Sessions still have spaces in them " + \
						"but not big enough to accomodate this talk: \n{}\nSkipped this iteration\n\n".format(talks[0]))

				'''
				Skip this loop so we can work another permutation of talks
				'''
				break


		'''
		All talks have now been distributed successfully so now we just need to ensure 
		the conference passes the contraints of our itinerary
		'''
		if c.is_valid() and c.talk_count() == len(all_talks):
			print("Valid conference itinerary found at iteration: {}".format(i))
			print(c.schedule_string())
			break

		i += 1
Example #21
0
async def start_secret_chat(sid, data):
    json = {}

    v = cerberus.Validator()

    v.schema = {'user': {'type': 'UUID', 'required': True, 'coerce': UUID}}

    if not v.validate(data):
        json['errors'] = v.errors

        return json

    user = await sio.get_session(sid)

    requester = database.session.query(User).get(user['uuid'])

    participant = database.session.query(User).get(data['user'])

    if not participant:
        json['errors'] = {'user': "******"}

        return json

    if participant.uuid == requester.uuid:
        json['errors'] = {'user': "******"}

        return json

    conference = database.session.query(Conference) \
        .join(Conference_Reference) \
        .filter(and_(
            Conference.type == 'secret',
            Conference_Reference.conference_uuid == Conference.uuid,
            Conference_Reference.user_uuid == requester.uuid,
            Conference_Reference.participant_uuid == participant.uuid
        )) \
        .one_or_none()

    if conference:
        conference_reference = database.session.query(Conference_Reference) \
            .filter(and_(
                Conference_Reference.user_uuid == requester.uuid,
                Conference_Reference.conference_uuid == conference.uuid
            )) \
            .one_or_none()

        json['conference'] = {
            'uuid': str(conference.uuid),
            'type': conference.type,
            'updated_at': conference_reference.updated_at.timestamp(),
            'messages_count': conference_reference.messages_count,
            'unread_messages_count':
            conference_reference.unread_messages_count,
            'participant': {
                'uuid': str(conference_reference.participant.uuid),
                'name': conference_reference.participant.name,
                'public_key': conference_reference.participant.public_key
            }
        }

        if conference_reference.last_message is not None:
            last_message = conference_reference.last_message

            json['conference']['last_message'] = {
                'uuid':
                str(last_message.uuid),
                'author': {
                    'uuid': str(last_message.author.uuid),
                    'name': last_message.author.name,
                    'public_key': last_message.author.public_key
                },
                'conference': {
                    'uuid': str(conference.uuid),
                    'type': conference.type,
                    'updated_at': conference_reference.updated_at.timestamp(),
                    'messages_count': conference_reference.messages_count,
                    'unread_messages_count':
                    conference_reference.unread_messages_count,
                    'participant': {
                        'uuid': str(conference_reference.participant.uuid),
                        'name': conference_reference.participant.name,
                        'public_key':
                        conference_reference.participant.public_key
                    }
                },
                'read':
                last_message.read,
                'readAt':
                last_message.read_at.timestamp()
                if last_message.read_at is not None else last_message.read_at,
                'date':
                last_message.date.timestamp(),
                'type':
                last_message.type,
                'content':
                last_message.content,
                'consumed':
                last_message.consumed,
                'edited':
                last_message.edited
            }

        return json

    # if not conference:
    conference = Conference(uuid=uuid4(), type='secret')

    requester_conference_reference = Conference_Reference(
        user=requester, conference=conference, participant=participant)

    participant_conference_reference = Conference_Reference(
        user=participant, conference=conference, participant=requester)

    requester_participant = Participant(conference=conference,
                                        user_uuid=requester.uuid)

    participant_participant = Participant(conference=conference,
                                          user=participant)

    database.session.add(conference)
    database.session.flush()

    database.session.add_all([
        requester_conference_reference, participant_conference_reference,
        requester_participant, participant_participant
    ])
    database.session.flush()

    requester.conferences_count += 1
    participant.conferences_count += 1

    database.session.add_all([requester, participant])
    database.session.flush()

    await sio.emit('user.conferences_count.updated',
                   {'conferences_count': requester.conferences_count},
                   room=str(requester.uuid))
    await sio.emit('user.conferences_count.updated',
                   {'conferences_count': participant.conferences_count},
                   room=str(participant.uuid))

    conference_references = [
        requester_conference_reference, participant_conference_reference
    ]

    for conference_reference in conference_references:
        c = {
            'uuid': str(conference.uuid),
            'type': conference.type,
            'updated_at': conference_reference.updated_at.timestamp(),
            'messages_count': conference_reference.messages_count,
            'unread_messages_count':
            conference_reference.unread_messages_count,
            'participant': {
                'uuid': str(conference_reference.participant.uuid),
                'name': conference_reference.participant.name,
                'public_key': conference_reference.participant.public_key
            }
        }

        await sio.emit('secret.chat.started',
                       c,
                       room=str(conference_reference.user.uuid))

    json['conference'] = {
        'uuid': str(conference.uuid),
        'type': conference.type,
        'updated_at': requester_conference_reference.updated_at.timestamp(),
        'messages_count': requester_conference_reference.messages_count,
        'unread_messages_count':
        requester_conference_reference.unread_messages_count,
        'participant': {
            'uuid': str(requester_conference_reference.participant.uuid),
            'name': requester_conference_reference.participant.name,
            'public_key': requester_conference_reference.participant.public_key
        }
    }

    return json
Example #22
0
File: nfl.py Project: jvasak/bpmc
    def __init__(self):
        logging.debug("In NFL constructor")

        self.__standings  = dict()
        self.__postseason = dict()

        League.__init__(self, 'NFL')

        afc = Conference('AFC')
        nfc = Conference('NFC')

        self.addChild(afc)
        self.addChild(nfc)

        afce = Division('East')
        afce.setColors('black', 'red')

        afcn = Division('North')
        afcn.setColors('yellow', 'blue')

        afcs = Division('South')
        afcs.setColors('black', 'white')

        afcw = Division('West')
        afcw.setColors('black', 'orange')

        afc.addChild(afce)
        afc.addChild(afcn)
        afc.addChild(afcs)
        afc.addChild(afcw)

        afce.addChild(Team('Buffalo Bills',        'BUF'))
        afce.addChild(Team('Miami Dolphins',       'MIA'))
        afce.addChild(Team('New England Patriots', 'NE'))
        afce.addChild(Team('New York Jets',        'NYJ'))

        afcn.addChild(Team('Baltimore Ravens',     'BAL'))
        afcn.addChild(Team('Cincinnati Bengals',   'CIN'))
        afcn.addChild(Team('Cleveland Browns',     'CLE'))
        afcn.addChild(Team('Pittsburgh Steelers',  'PIT'))

        afcs.addChild(Team('Houston Texans',       'HOU'))
        afcs.addChild(Team('Indianapolis Colts',   'IND'))
        afcs.addChild(Team('Jacksonville Jaguars', 'JAC'))
        afcs.addChild(Team('Tennessee Titans',     'TEN'))

        afcw.addChild(Team('Denver Broncos',       'DEN'))
        afcw.addChild(Team('Kansas City Chiefs',   'KC'))
        afcw.addChild(Team('Oakland Raiders',      'OAK'))
        afcw.addChild(Team('San Diego Chargers',   'SD'))

        nfce = Division('East')
        nfce.setColors('black', 'darkgreen')

        nfcc = Division('Central')
        nfcc.setColors('orange', 'black')

        nfcs = Division('South')
        nfcs.setColors('black', 'lightblue')

        nfcw = Division('West')
        nfcw.setColors('black', 'yellow')

        nfc.addChild(nfce)
        nfc.addChild(nfcc)
        nfc.addChild(nfcs)
        nfc.addChild(nfcw)

        nfce.addChild(Team('Dallas Cowboys',       'DAL'))
        nfce.addChild(Team('New York Giants',      'NYG'))
        nfce.addChild(Team('Philadelphia Eagles',  'PHI'))
        nfce.addChild(Team('Washington Redskins',  'WAS'))

        nfcc.addChild(Team('Chicago Bears',        'CHI'))
        nfcc.addChild(Team('Detroit Lions',        'DET'))
        nfcc.addChild(Team('Green Bay Packers',    'GB'))
        nfcc.addChild(Team('Minnesota Vikings',    'MIN'))

        nfcs.addChild(Team('Atlanta Falcons',      'ATL'))
        nfcs.addChild(Team('Carolina Panthers',    'CAR'))
        nfcs.addChild(Team('New Orleans Saints',   'NO'))
        nfcs.addChild(Team('Tampa Bay Buccaneers', 'TB'))

        nfcw.addChild(Team('Arizona Cardnials',    'ARI'))
        nfcw.addChild(Team('San Francisco 49ers',  'SF'))
        nfcw.addChild(Team('Seattle Seahawks',     'SEA'))
        nfcw.addChild(Team('St. Louis Rams',       'STL'))