diff --git a/python/agents/customer-service/customer_service/tools/tools.py b/python/agents/customer-service/customer_service/tools/tools.py index b1babffa1..f44a68792 100644 --- a/python/agents/customer-service/customer_service/tools/tools.py +++ b/python/agents/customer-service/customer_service/tools/tools.py @@ -293,7 +293,7 @@ def schedule_planting_service( logger.info("Details: %s", details) # MOCK API RESPONSE - Replace with actual API call to your scheduling system # Calculate confirmation time based on date and time_range - start_time_str = time_range.split("-")[0] # Get the start time (e.g., "9") + start_time_str = time_range.split("-", maxsplit=1)[0] # Get the start time (e.g., "9") confirmation_time_str = ( f"{date} {start_time_str}:00" # e.g., "2024-07-29 9:00" ) diff --git a/python/agents/data-science/data_science/sub_agents/bigquery/chase_sql/chase_db_tools.py b/python/agents/data-science/data_science/sub_agents/bigquery/chase_sql/chase_db_tools.py index 37966563b..cb3a38b9c 100644 --- a/python/agents/data-science/data_science/sub_agents/bigquery/chase_sql/chase_db_tools.py +++ b/python/agents/data-science/data_science/sub_agents/bigquery/chase_sql/chase_db_tools.py @@ -72,7 +72,7 @@ def parse_response(response: str) -> str: query = response try: if "```sql" in response and "```" in response: - query = response.split("```sql")[1].split("```")[0] + query = response.split("```sql")[1].split("```", maxsplit=1)[0] except ValueError as e: print(f"Error in parsing response: {e}") query = response diff --git a/python/agents/plumber-data-engineering-assistant/plumber_agent/sub_agents/dataproc_template_agent/tools/dataproc_template_tools.py b/python/agents/plumber-data-engineering-assistant/plumber_agent/sub_agents/dataproc_template_agent/tools/dataproc_template_tools.py index baf1f5bac..8fbb49c33 100644 --- a/python/agents/plumber-data-engineering-assistant/plumber_agent/sub_agents/dataproc_template_agent/tools/dataproc_template_tools.py +++ b/python/agents/plumber-data-engineering-assistant/plumber_agent/sub_agents/dataproc_template_agent/tools/dataproc_template_tools.py @@ -240,7 +240,7 @@ def run_dataproc_template( # IF NEED TO INTEGRATE TRANSFORMATION LOGIC if TRANSFORMATION_SQL: - template_file_name = template_path.split("/")[-1] + template_file_name = template_path.rsplit("/", maxsplit=1)[-1] template_dir = os.path.dirname(template_path) # CREATE THE TEMP TEMPLATE REPO WITH INTEGRATED TRANSFORMATION LOGIC diff --git a/python/agents/plumber-data-engineering-assistant/plumber_agent/sub_agents/github_agent/utils.py b/python/agents/plumber-data-engineering-assistant/plumber_agent/sub_agents/github_agent/utils.py index 874580c1c..0d1b9eb8d 100644 --- a/python/agents/plumber-data-engineering-assistant/plumber_agent/sub_agents/github_agent/utils.py +++ b/python/agents/plumber-data-engineering-assistant/plumber_agent/sub_agents/github_agent/utils.py @@ -68,7 +68,7 @@ def _parse_repo_path(repository: str) -> tuple[str | None, str | None]: Returns (None, None) if the format is invalid. """ if repository.startswith(("http://", "https://")): - repo_path = repository.split("github.com/")[-1].rstrip(".git") + repo_path = repository.rsplit("github.com/", maxsplit=1)[-1].rstrip(".git") else: repo_path = repository if "/" not in repo_path: diff --git a/python/agents/product-catalog-ad-generation/content_gen_agent/func_tools/combine_video.py b/python/agents/product-catalog-ad-generation/content_gen_agent/func_tools/combine_video.py index bed3d39b8..625de67bf 100644 --- a/python/agents/product-catalog-ad-generation/content_gen_agent/func_tools/combine_video.py +++ b/python/agents/product-catalog-ad-generation/content_gen_agent/func_tools/combine_video.py @@ -148,7 +148,7 @@ async def _load_single_clip( f.write(artifact.inline_data.data) clip = VideoFileClip(temp_path) - clip_index_str = filename.split("_")[0] + clip_index_str = filename.split("_", maxsplit=1)[0] if clip_index_str.isdigit(): clip_index = int(clip_index_str) if 0 <= clip_index < len(storyline): diff --git a/python/agents/product-catalog-ad-generation/content_gen_agent/utils/images.py b/python/agents/product-catalog-ad-generation/content_gen_agent/utils/images.py index d95c2b838..c6cb6e400 100644 --- a/python/agents/product-catalog-ad-generation/content_gen_agent/utils/images.py +++ b/python/agents/product-catalog-ad-generation/content_gen_agent/utils/images.py @@ -94,7 +94,7 @@ async def ensure_image_artifact( exc_info=True, ) # Fall through to try loading as an artifact - image_filename = image_filename.split("/")[-1] + image_filename = image_filename.rsplit("/", maxsplit=1)[-1] try: logging.info( diff --git a/python/agents/retail-ai-location-strategy/app/frontend/backend/main.py b/python/agents/retail-ai-location-strategy/app/frontend/backend/main.py index 4f41bdce1..01fe01dff 100644 --- a/python/agents/retail-ai-location-strategy/app/frontend/backend/main.py +++ b/python/agents/retail-ai-location-strategy/app/frontend/backend/main.py @@ -39,7 +39,6 @@ from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware - # Add app directory to path for imports # Structure: app/frontend/backend/main.py app_dir = Path(__file__).parent.parent.parent # app/