<commit_before># -*- coding: utf-8 -*-
""" Print accepted talks not scheduled and not accepted talks which have been scheduled.

"""
from   django.core.management.base import BaseCommand, CommandError
from   django.core  import urlresolvers
from   conference   import models
from   conference   import utils

from   collections  import defaultdict
from   optparse     import make_option
import operator
import simplejson   as json

### Globals

TYPE_NAMES = (
    ('keynote', 'Keynotes'),
    ('s', 'Talks'),
    ('t', 'Trainings'),
    ('p', 'Poster sessions'),
    ('h', 'Help desks'),
    ('europython', 'EuroPython sessions'),
    ('i', 'Other sessions'),
    )

def _check_talk_types(type_names):
    d = dict(type_names)
    for code, entry in models.TALK_TYPE:
        assert code in d, 'Talk type code %r is missing' % code
_check_talk_types(TYPE_NAMES)

### Helpers
def talk_schedule(talk):
    event = talk.get_event()

    if not event:
        #print('ERROR: Talk ({}) {} is not scheduled.'.format(talk.type, talk))
        return ''

    timerange = event.get_time_range()
    return '{}, {}'.format(str(timerange[0]), str(timerange[1]))


def talk_type(talk):
    type_names = dict(TYPE_NAMES)

    if 'EPS' in talk.title or 'EuroPython 20' in talk.title:
        type = 'europython'
    elif talk.title.lower().startswith('keynote'):
        type = 'keynote'
    else:
        type = talk.type<commit_msg>Added TODO comment<commit_after># -*- coding: utf-8 -*-
""" Print accepted talks not scheduled and not accepted talks which have been scheduled.

"""
from   django.core.management.base import BaseCommand, CommandError
from   django.core  import urlresolvers
from   conference   import models
from   conference   import utils

from   collections  import defaultdict
from   optparse     import make_option
import operator
import simplejson   as json

### Globals

TYPE_NAMES = (
    ('keynote', 'Keynotes'),
    ('s', 'Talks'),
    ('t', 'Trainings'),
    ('p', 'Poster sessions'),
    ('h', 'Help desks'),
    ('europython', 'EuroPython sessions'),
    ('i', 'Other sessions'),
    )

def _check_talk_types(type_names):
    d = dict(type_names)
    for code, entry in models.TALK_TYPE:
        assert code in d, 'Talk type code %r is missing' % code
_check_talk_types(TYPE_NAMES)

### Helpers
def talk_schedule(talk):
    event = talk.get_event()

    if not event:
        #print('ERROR: Talk ({}) {} is not scheduled.'.format(talk.type, talk))
        return ''

    #TODO: should also check if the talk has more than one event.

    timerange = event.get_time_range()
    return '{}, {}'.format(str(timerange[0]), str(timerange[1]))


def talk_type(talk):
    type_names = dict(TYPE_NAMES)

    if 'EPS' in talk.title or 'EuroPython 20' in talk.title:
        type = 'europython'
    elif talk.title.lower().startswith('keynote'):
        type = 'keynote'
    else:
        type = talk.type
{'fraction_non_alphanumeric': 0.1301510989010989, 'fraction_numerical': 0.003434065934065934, 'mean_word_length': 3.3028064992614476, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5437617', 'n_tokens_mistral': 946, 'n_tokens_neox': 918, 'n_words': 273}