From aec6994a4825361ee742d318b9395c7a94cffb87 Mon Sep 17 00:00:00 2001 From: Jianna Wong Date: Tue, 10 Mar 2026 23:33:55 -0700 Subject: [PATCH 1/3] fix instructions --- app/app.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/app.py b/app/app.py index 8e1c9cf..f033920 100644 --- a/app/app.py +++ b/app/app.py @@ -49,18 +49,18 @@ def parse_r_list(r_string): if clean_val.upper() == "N/A" or clean_val.lower() in ["character(0)", "none", ""]: return result - if clean_val.startswith('c('): - content = re.sub(r'^c\(', '', clean_val) - content = re.sub(r'\)$', '', content) - parts = re.findall(r'"([^"]*)"', content) - result = [p.strip() for p in parts if p.strip()] + if not '.' in clean_val: + result = [p.strip() for p in clean_val.split(',') if p.strip()] elif ", http" in clean_val: parts = clean_val.split(", http") result = [parts[0].strip()] + ["http" + p.strip() for p in parts[1:]] elif clean_val.startswith('http'): result = [clean_val] else: - result = [p.strip() for p in clean_val.split(',') if p.strip()] + if "., " in clean_val: + clean_val = clean_val.replace("., ", ". ") + result = [p.strip() for p in clean_val.split('.') if p.strip()] + return result From cd96c597118f11187f026838a8f0799c6d4a2bab Mon Sep 17 00:00:00 2001 From: Jianna Wong Date: Tue, 10 Mar 2026 23:40:15 -0700 Subject: [PATCH 2/3] fix test --- tests/test_app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_app.py b/tests/test_app.py index c001be3..0360907 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -40,7 +40,7 @@ class TestCookingHelper(unittest.TestCase): def test_parse_r_list_valid(self): """Test parsing a standard R-style character vector string.""" - r_string = 'c("Butter", "Sugar", "Flour")' + r_string = 'Butter, Sugar, Flour' expected = ["Butter", "Sugar", "Flour"] self.assertEqual(parse_r_list(r_string), expected) From cfc48929e9b011e0d788dbae8fcf83ff3fe1d949 Mon Sep 17 00:00:00 2001 From: Jianna Wong Date: Tue, 10 Mar 2026 23:43:43 -0700 Subject: [PATCH 3/3] fix pylint --- app/app.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/app.py b/app/app.py index f033920..5ea3a9b 100644 --- a/app/app.py +++ b/app/app.py @@ -3,7 +3,6 @@ Finds recipes and fetches real-time Kroger prices based on user location. """ import json -import re import sys from itertools import zip_longest from pathlib import Path @@ -60,7 +59,6 @@ def parse_r_list(r_string): if "., " in clean_val: clean_val = clean_val.replace("., ", ". ") result = [p.strip() for p in clean_val.split('.') if p.strip()] - return result