コード例 #1
0
def section2_part3(section):
    part3 = section.find(id='p10')

    reading = part3.get_text()
    reading_duration = 4

    item = models.StudentsAssignment(reading, reading_duration, partner=None)

    return item
コード例 #2
0
def section3_items(section):
    list_items = section.findAll('li')
    L = []
    if len(list_items) == 1:
        title, duration = extract_name_and_duration(list_items[0])
        return [models.Assignment(title, duration)]

    for item in list_items:
        title, duration = extract_name_and_duration(item)
        L.append(models.StudentsAssignment(title, duration + 1))

    return L
コード例 #3
0
def section3(tree, titles):
    items = []

    for index, item in enumerate(tree[2]):
        if 'student' in item:
            index = models.StudentsAssignment(
                item['title'], item['duration'], item['student'],
                item['partner'], *get_point_title_and_url(item['point']))
            index.time = item['time']
            items.append(index)
        else:
            index = models.Assignment(item['title'], item['duration'],
                                      item['assignee'])
            index.time = item['time']

            items.append(index)

    section = models.Section(titles[2], items)

    return section
コード例 #4
0
ファイル: extract_form.py プロジェクト: emomilol/Presidency
def section2(tree, titles):
    item0 = tree[1][0]
    treasures = models.Assignment(item0['title'], item0['duration'], item0['assignee'])
    treasures.time = item0['time']

    item1 = tree[1][1]
    gems = models.Assignment(item1['title'], item1['duration'], item1['assignee'])
    gems.time = item1['time']

    item2 = tree[1][2]
    reading = models.StudentsAssignment(item2['title'], item2['duration'],
                                        item2['student'], None,
                                        item2['point'])
    reading.time = item2['time']

    items = [treasures, gems, reading]

    sections = models.Section(titles[1], items)

    return sections