INNER CODE UNIT · Python

__iter__

beader/tianchi_nl2sql · code/nl2sql/utils/__init__.py:70

    def __iter__(self):
        for table_id, table in self.table_dict.items():
            yield table_id, table


def set_sql_compare_mode(mode):
    available_modes = {'all', 'agg', 'no_val', 'conn_and_agg'}
    if mode not in available_modes:
        raise ValueError('mode should be one of {}'.format(available_modes))
    cmp_func = getattr(SQL, 'equal_{}_mode'.format(mode))
    SQL.__eq__ = cmp_func


class SQL:
    op_sql_dict = {0: ">", 1: "<", 2: "==", 3: "!="}
    agg_sql_dict = {0: "", 1: "AVG", 2: "MAX", 3: "MIN", 4: "COUNT", 5: "SUM"}
    conn_sql_dict = {0: "", 1: "and", 2: "or"}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…