Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
refactor: remove the legacy directory
Browse files- utils.py → src/utils.py +2 -2
- tests/test_utils.py +2 -3
utils.py → src/utils.py
RENAMED
@@ -43,7 +43,7 @@ def search_table(df: pd.DataFrame, query: str) -> pd.DataFrame:
|
|
43 |
return df[(df[COL_NAME_RETRIEVAL_MODEL].str.contains(query, case=False))]
|
44 |
|
45 |
|
46 |
-
def get_default_cols(task: str, columns: list, add_fix_cols: bool = True) -> list:
|
47 |
cols = []
|
48 |
types = []
|
49 |
if task == "qa":
|
@@ -59,7 +59,7 @@ def get_default_cols(task: str, columns: list, add_fix_cols: bool = True) -> lis
|
|
59 |
for col_name, col_type in zip(cols_list, types_list):
|
60 |
if col_name not in benchmark_list:
|
61 |
continue
|
62 |
-
if col_name not in columns:
|
63 |
continue
|
64 |
cols.append(col_name)
|
65 |
types.append(col_type)
|
|
|
43 |
return df[(df[COL_NAME_RETRIEVAL_MODEL].str.contains(query, case=False))]
|
44 |
|
45 |
|
46 |
+
def get_default_cols(task: str, columns: list = [], add_fix_cols: bool = True) -> list:
|
47 |
cols = []
|
48 |
types = []
|
49 |
if task == "qa":
|
|
|
59 |
for col_name, col_type in zip(cols_list, types_list):
|
60 |
if col_name not in benchmark_list:
|
61 |
continue
|
62 |
+
if columns and col_name not in columns:
|
63 |
continue
|
64 |
cols.append(col_name)
|
65 |
types.append(col_type)
|
tests/test_utils.py
CHANGED
@@ -1,8 +1,7 @@
|
|
1 |
import pandas as pd
|
2 |
import pytest
|
3 |
|
4 |
-
from utils import filter_models, search_table, filter_queries, select_columns, update_table_long_doc, get_iso_format_timestamp, get_default_cols
|
5 |
-
from src.display.utils import COLS_QA
|
6 |
|
7 |
|
8 |
@pytest.fixture
|
@@ -90,6 +89,6 @@ def test_get_iso_format_timestamp():
|
|
90 |
|
91 |
|
92 |
def test_get_default_cols():
|
93 |
-
cols, types = get_default_cols("qa"
|
94 |
for c, t in zip(cols, types):
|
95 |
print(f"type({c}): {t}")
|
|
|
1 |
import pandas as pd
|
2 |
import pytest
|
3 |
|
4 |
+
from src.utils import filter_models, search_table, filter_queries, select_columns, update_table_long_doc, get_iso_format_timestamp, get_default_cols
|
|
|
5 |
|
6 |
|
7 |
@pytest.fixture
|
|
|
89 |
|
90 |
|
91 |
def test_get_default_cols():
|
92 |
+
cols, types = get_default_cols("qa")
|
93 |
for c, t in zip(cols, types):
|
94 |
print(f"type({c}): {t}")
|