diff --git a/recommenders/datasets/amazon_reviews.py b/recommenders/datasets/amazon_reviews.py index 9107e749e7..a0b34a7439 100644 --- a/recommenders/datasets/amazon_reviews.py +++ b/recommenders/datasets/amazon_reviews.py @@ -285,15 +285,15 @@ def _data_generating_no_history_expanding( fo = f_test if user_id != last_user_id or tfile == "valid" or tfile == "test": if last_user_id is not None: - history_clk_num = len(movie_id_list) + history_clk_num = len(movie_id_list) # noqa: F821 undefined name 'movie_id_list' cat_str = "" mid_str = "" dt_str = "" - for c1 in cate_list[:-1]: + for c1 in cate_list[:-1]: # noqa: F821 undefined name 'cate_list' cat_str += c1 + "," - for mid in movie_id_list[:-1]: + for mid in movie_id_list[:-1]: # noqa: F821 undefined name 'movie_id_list' mid_str += mid + "," - for dt_time in dt_list[:-1]: + for dt_time in dt_list[:-1]: # noqa: F821 undefined name 'dt_list' dt_str += dt_time + "," if len(cat_str) > 0: cat_str = cat_str[:-1] diff --git a/recommenders/tuning/nni/ncf_utils.py b/recommenders/tuning/nni/ncf_utils.py index 3ffa31b5ff..708c1e901c 100644 --- a/recommenders/tuning/nni/ncf_utils.py +++ b/recommenders/tuning/nni/ncf_utils.py @@ -47,7 +47,7 @@ def compute_test_results(model, train, test, rating_metrics, ranking_metrics): all_predictions = merged[merged.rating.isnull()].drop('rating', axis=1) for metric in ranking_metrics: - test_results[metric] = eval(metric)(test, all_predictions, col_prediction='prediction', k=K) + test_results[metric] = eval(metric)(test, all_predictions, col_prediction='prediction', k=K) # noqa: F821 undefined name 'K' return test_results diff --git a/tox.ini b/tox.ini index 514a18b4f1..2fa2b50971 100644 --- a/tox.ini +++ b/tox.ini @@ -94,7 +94,7 @@ ignore = ; W605 # invalid escape sequence (done) ; F403 # 'from X import *' used; unable to detect undefined names (done) ; F405 # 'Dense' may be undefined, or defined from star imports: tensorflow.keras.layers (done) - F821 # undefined name 'K' + ; F821 # undefined name 'K' # File-specific flake8 ignore rules (too risky to implement the changes) per-file-ignores =