From f9c0d929ff0a451c1d2718a7bf1d39a948571fe9 Mon Sep 17 00:00:00 2001 From: Trent Palmer Date: Thu, 26 Aug 2021 23:13:14 -0700 Subject: [PATCH] update rank_hugo_themes.py to deduplicate tags_lists and features_lists --- rank_hugo_themes.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/rank_hugo_themes.py b/rank_hugo_themes.py index 394e3ad..34e7bce 100755 --- a/rank_hugo_themes.py +++ b/rank_hugo_themes.py @@ -481,8 +481,10 @@ def parse_themes_toml_for_each_hugo_themes(): if 'tags' in theme_toml: if len(theme_toml['tags']) > 0: corrected_tags = get_corrected_tags(theme_toml['tags']) - theme_tags = [ - tag.lower() for tag in corrected_tags if len(tag) > 1] + tt = [ + tag.lower() for tag in corrected_tags if len(tag) > 1 + ] + theme_tags = list(set(tt)) if theme.num_tags != len(theme_tags): theme.num_tags = len(theme_tags) if theme.num_tags > 0: @@ -498,9 +500,11 @@ def parse_themes_toml_for_each_hugo_themes(): if theme.num_tags != 0: theme.num_tags = 0 if 'features' in theme_toml: if len(theme_toml['features']) > 0: - theme_features = [ - feature.lower() for feature in theme_toml[ - 'features'] if len(feature) > 1] + tf = [ + feature.lower() for feature in + theme_toml['features'] if len(feature) > 1 + ] + theme_features = list(set(tf)) if theme.num_features != len(theme_features): theme.num_features = len(theme_features) if theme.num_features > 0: