# Path: openaddr/process_one.py
# class SourceProblem (enum.Enum):
#     ''' Possible problems encountered in a source.
#     '''
#     skip_source = 'Source says to skip'
#     missing_conform = 'Source is missing a conform object'
#     unknown_conform_format = 'Unknown source conform format'
#     unknown_conform_protocol = 'Unknown source conform protocol'
#     download_source_failed = 'Could not download source data'
#     conform_source_failed = 'Could not conform source data'
#     no_coverage = 'Missing or incomplete coverage'
#     no_esri_token = 'Missing required ESRI token'
#     test_failed = 'An acceptance test failed'
#     no_addresses_found = 'Found no addresses in source data'
# 
#     # Old tag naming; replaced with "format" or "protocol"
#     unknown_conform_type = 'Unknown source conform type'


import logging; _L = logging.getLogger('openaddr.ci.objects')
import json, pickle, copy, time
from ..process_one import SourceProblem
               (set.id, ))

    # Use unsuccessful runs if no successful ones exist.
    for (run_id, source_path) in db.fetchall():
        if source_path not in run_path_ids:
            run_path_ids[source_path] = run_id

    run_ids = tuple(sorted(run_path_ids.values()))

    if not run_ids:
        return []

    # Get Run instance for each of the returned run IDs.
    db.execute('''SELECT id, source_path, source_id, source_data, datetime_tz,
                         state, status, copy_of, code_version, worker_id,
                         job_id, set_id, commit_sha, is_merged
                  FROM runs
                  WHERE id IN %s''',
               (run_ids, ))

    runs = [Run(*row[:5]+(RunState(row[5]),)+row[6:]) for row in db.fetchall()]

    return runs

def mark_runs_for_index_page(db, runs):
    ''' Update runs.for_index_page boolean column from list of provided runs.
    '''
    run_ids = tuple([run.id for run in runs])

    db.execute('''

# Path: openaddr/process_one.py
# class SourceProblem (enum.Enum):
#     ''' Possible problems encountered in a source.
#     '''
#     skip_source = 'Source says to skip'
#     missing_conform = 'Source is missing a conform object'
#     unknown_conform_format = 'Unknown source conform format'
#     unknown_conform_protocol = 'Unknown source conform protocol'
#     download_source_failed = 'Could not download source data'
#     conform_source_failed = 'Could not conform source data'
#     no_coverage = 'Missing or incomplete coverage'
#     no_esri_token = 'Missing required ESRI token'
#     test_failed = 'An acceptance test failed'
#     no_addresses_found = 'Found no addresses in source data'
# 
#     # Old tag naming; replaced with "format" or "protocol"
#     unknown_conform_type = 'Unknown source conform type'


# Path: openaddr/ci/objects.py
import logging; _L = logging.getLogger('openaddr.ci.objects')
import json, pickle, copy, time
from ..process_one import SourceProblem

               (set.id, ))

    # Use unsuccessful runs if no successful ones exist.
    for (run_id, source_path) in db.fetchall():
        if source_path not in run_path_ids:
            run_path_ids[source_path] = run_id

    run_ids = tuple(sorted(run_path_ids.values()))

    if not run_ids:
        return []

    # Get Run instance for each of the returned run IDs.
    db.execute('''SELECT id, source_path, source_id, source_data, datetime_tz,
                         state, status, copy_of, code_version, worker_id,
                         job_id, set_id, commit_sha, is_merged
                  FROM runs
                  WHERE id IN %s''',
               (run_ids, ))

    runs = [Run(*row[:5]+(RunState(row[5]),)+row[6:]) for row in db.fetchall()]

    return runs

def mark_runs_for_index_page(db, runs):
    ''' Update runs.for_index_page boolean column from list of provided runs.
    '''
    run_ids = tuple([run.id for run in runs])

    db.execute('''

        UPDATE runs SET for_index_page = false