INNER CODE UNIT · Python

__getitem__

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

    def __getitem__(self, id):
        return self.table_dict[id]

    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: "!="}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…