From 653fcb25e91ba4014433cad6fc3171e87e7c0fd2 Mon Sep 17 00:00:00 2001 From: Yozachar <38415384+yozachar@users.noreply.github.com> Date: Sat, 5 Oct 2024 15:30:07 +0530 Subject: [PATCH] fix: `_extract_ignored_languages` - closes #166 - closes #167 --- main.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index e09e6b5..9b1cd96 100644 --- a/main.py +++ b/main.py @@ -273,14 +273,14 @@ def make_graph(block_style: str, percent: float, gr_len: int, lg_nm: str = "", / def _extract_ignored_languages(): if not wk_i.ignored_languages: - return False + return "" temp = "" for igl in wk_i.ignored_languages.strip().split(): - if igl.startswith('"'): - temp = igl.lstrip('"') + if igl.startswith(('"', "'")): + temp = igl.lstrip('"').lstrip("'") continue - if igl.endswith('"'): - igl = f"{temp} {igl.rstrip('"')}" + if igl.endswith(('"', "'")): + igl = f"{temp} {igl.rstrip('"').rstrip("'")}" temp = "" yield igl @@ -329,10 +329,11 @@ def prep_content(stats: dict[str, Any], /): ) return contents.rstrip("\n") - ignored_languages = _extract_ignored_languages() + ignored_languages = set(_extract_ignored_languages()) + logger.debug(f"Ignoring {', '.join(ignored_languages)}") for idx, lang in enumerate(lang_info): lang_name = str(lang["name"]) - if ignored_languages and lang_name in ignored_languages: + if lang_name in ignored_languages: continue lang_time = str(lang["text"]) if wk_i.show_time else "" lang_ratio = float(lang["percent"])