From e06ea30e53e3b8ca02f9a9a32478c282b0953319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Rod=C3=A9s-Guirao?= Date: Sat, 30 Nov 2024 01:13:12 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20etl=20pr,=20anomalist=20(#3664)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/pr/cli.py | 12 +++++++++--- apps/wizard/app_pages/anomalist/app.py | 3 +++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/apps/pr/cli.py b/apps/pr/cli.py index 930f3531f96..3de16f52888 100644 --- a/apps/pr/cli.py +++ b/apps/pr/cli.py @@ -373,7 +373,7 @@ def bake_branch_name(repo, pr_title, no_llm, remote_branches): category = pr_title.category # Get input title (without emoji, scope, etc.) - title = _extract_relevant_title_for_branch_name(pr_title.title, not no_llm) + title = _extract_relevant_title_for_branch_name(pr_title.title, category, not no_llm) # Bake complete PR branch name # name = f"{user}-{category}-{title}" @@ -383,13 +383,14 @@ def bake_branch_name(repo, pr_title, no_llm, remote_branches): # if name in remote_branches: # log.info("Generating a hash for this branch name to prevent name collisions.") # name = f"{name}-{user}" - if name in remote_branches: + local_branches = [branch.name for branch in repo.branches] + if (name in remote_branches) or (name in local_branches): log.info("Generating a hash for this branch name to prevent name collisions.") name = f"{name}-{generate_short_hash()}" return name -def _extract_relevant_title_for_branch_name(text_in: str, use_llm) -> str: +def _extract_relevant_title_for_branch_name(text_in: str, category: str, use_llm) -> str: """ Process the input string by: 1. Removing all symbols, keeping only letters and numbers. @@ -411,8 +412,13 @@ def _extract_relevant_title_for_branch_name(text_in: str, use_llm) -> str: # Split into tokens/words tokens = cleaned_text.split() + + # Clean if there is word included in category + tokens = [t for t in tokens if t.lower() != category] + # Keep only the first 3 tokens tokens = tokens[:3] + # Combine tokens with '-' name = "-".join(tokens).lower() diff --git a/apps/wizard/app_pages/anomalist/app.py b/apps/wizard/app_pages/anomalist/app.py index 2a461a1ff57..c32cb10493b 100644 --- a/apps/wizard/app_pages/anomalist/app.py +++ b/apps/wizard/app_pages/anomalist/app.py @@ -446,6 +446,9 @@ def show_anomaly_compact(index, df): config = bake_chart_config(variable_id=indicator_id, selected_entities=entities) config["hideAnnotationFieldsInTitle"]["time"] = True config["hideFacetControl"] = False + config["hideShareButton"] = True + config["hideExploreTheDataButton"] = True + # config["isSocialMediaExport"] = False # Actually plot grapher_chart(chart_config=config, owid_env=OWID_ENV)