# Path: src/helper_functions.py
# def grab_vector(connection, cmd, *args):
#     return [x[0] for x in connection.execute(cmd, *args).fetchall()]
# 
# def grab_all(connection, cmd, *args):
#     return connection.execute(cmd, *args).fetchall()


import sqlite3
import logging
import argparse
import collections
from src.helper_functions import grab_vector, grab_all
WHERE query_level=1 AND non_zero_terms>=4'''
SID = grab_vector(seq_conn, cmd_search)

# Build the lookup table
cmd = '''SELECT function_name,invariant_id FROM ref_invariant_integer
ORDER BY invariant_id'''
ref_lookup = dict(grab_all(seq_conn, cmd))
ref_lookup_inv = {v: k for k, v in ref_lookup.items()}
func_names = ref_lookup.keys()

logging.info("Loading level 1 sequences")

cmd_select_interesting = '''
SELECT sequence_id FROM stat_sequence
WHERE query_level=1 AND non_zero_terms>4'''

cmd_grab_all = '''
SELECT * FROM sequence AS a
JOIN ref_sequence_level1 AS b
ON a.sequence_id = b.sequence_id
WHERE query_level = 1
ORDER BY a.sequence_id
'''


def is_trivial(seq):
    # Check if seq is all ones or zeros
    return len(set(seq)) <= 2

SEQS = collections.OrderedDict()

# Path: src/helper_functions.py
# def grab_vector(connection, cmd, *args):
#     return [x[0] for x in connection.execute(cmd, *args).fetchall()]
# 
# def grab_all(connection, cmd, *args):
#     return connection.execute(cmd, *args).fetchall()


# Path: verification/raw_dump_lvl1.py
import sqlite3
import logging
import argparse
import collections
from src.helper_functions import grab_vector, grab_all

WHERE query_level=1 AND non_zero_terms>=4'''
SID = grab_vector(seq_conn, cmd_search)

# Build the lookup table
cmd = '''SELECT function_name,invariant_id FROM ref_invariant_integer
ORDER BY invariant_id'''
ref_lookup = dict(grab_all(seq_conn, cmd))
ref_lookup_inv = {v: k for k, v in ref_lookup.items()}
func_names = ref_lookup.keys()

logging.info("Loading level 1 sequences")

cmd_select_interesting = '''
SELECT sequence_id FROM stat_sequence
WHERE query_level=1 AND non_zero_terms>4'''

cmd_grab_all = '''
SELECT * FROM sequence AS a
JOIN ref_sequence_level1 AS b
ON a.sequence_id = b.sequence_id
WHERE query_level = 1
ORDER BY a.sequence_id
'''


def is_trivial(seq):
    # Check if seq is all ones or zeros
    return len(set(seq)) <= 2

SEQS = collections.OrderedDict()

for items in grab_all(seq_conn, cmd_grab_all):