

def pascal(tags, range=(2003, 2010)):
    '\n    Builds an iterator that queries images identical to the Pascal challenge.\n    '
    if isinstance(tags, str):
        tags = tags.split(' ')
    perpage = 10
    while True:
        start = int(time.mktime([range[0], 1, 1, 0, 0, 0, 0, 0, (- 1)]))
        stop = int(time.mktime([range[1], 12, 31, 23, 59, 59, 0, 0, (- 1)]))
        rtime = (time.localtime(random.randint(start, stop))[0:3] + (0, 0, 0, 0, 0, (- 1)))
        rtime = time.mktime(rtime)
        (stm, etm) = (int(rtime), int((rtime + 86400)))
        tag = random.choice(tags)
        r = request('flickr.photos.search', {
            'text': tag,
            'min_upload_date': stm,
            'max_upload_date': etm,
            'per_page': perpage,
            'page': 1,
        })
        totpages = int(r.find('photos').get('pages'))
        if (totpages == 0):
            continue
        page = random.randint(1, totpages)
        r = request('flickr.photos.search', {
            'text': tag,
            'min_upload_date': stm,
            'max_upload_date': etm,
            'per_page': perpage,
            'page': page,
            'extras': all_extras,
        })
        photos = [x.attrib for x in r.find('photos')]
        if (len(photos) > 0):
            (yield Photo.fromapi(photos[random.randint(0, (len(photos) - 1))]))

dataset/ETHPy150Open cvondrick/pyvision/vision/flickr.py pascal/original