Exemplo n.º 1
0
def crosslisting_feature(catalog, soup):
    """Parses all the crosslistings. These refer to the similar CRNs,
    such as a grad & undergrad level course.
    """
    listing = {}
    for elem in soup.coursedb.findAll('crosslisting'):
        seats = int(elem['seats'])
        crns = [safeInt(crn.string) for crn in elem.findAll('crn')]

        # we want to refer to the same object to save space
        cl = CrossListing(crns, seats)
        for crn in crns:
            listing[crn] = cl
    catalog.crosslistings = FrozenDict(listing)

    logger.info('Catalog has %d course crosslistings' % len(catalog.crosslistings))