nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: hhursev/recipe-scrapers
Pull request #526 (2022-04-12 19:58:30)

fix cookingcircle instructions parsing
fix cookingcircle parser, return text instead of array, like in other parsers


Patch:
diff --git a/recipe_scrapers/cookingcircle.py b/recipe_scrapers/cookingcircle.py
index 3f453252..6965c76b 100644
--- a/recipe_scrapers/cookingcircle.py
+++ b/recipe_scrapers/cookingcircle.py
@@ -64,4 +64,4 @@ class CookingCircle(AbstractScraper):
         for li in ulList:
             instructions.append(li.get_text().strip().replace("\n", " "))
 
-        return instructions
+        return "\n".join(instructions)


Test patch:
diff --git a/tests/test_cookingcircle.py b/tests/test_cookingcircle.py
index 23411f8c..b53678d2 100644
--- a/tests/test_cookingcircle.py
+++ b/tests/test_cookingcircle.py
@@ -47,15 +47,17 @@ class TestCookingCircleScraper(ScraperTest):
 
     def test_instructions(self):
         self.assertEqual(
-            [
-                "Step 1 Preheat your oven to 180c and line a cupcake tray with cases.",
-                "Step 2 Combine the non-dairy milk and cider vinegar, then set aside and allow to thicken.",
-                "Step 3 In your Ninja food processor, add in all of your dry ingredients and pulse to combine.",
-                "Step 4 Pour in the oil, milk mixture and lemon zest and blend for a few seconds to create a smooth batter.",
-                "Step 5 Transfer this into your cupcake cases (makes around 6 cupcakes) and bake in the oven for 25 minutes or until cooked through.",
-                "Step 6 Whilst allowing your cupcakes to cool, use an electric mixer to cream the butter until light and fluffy.",
-                "Step 7 Gradually add in the sugar and powders whilst mixing until fully combined.",
-                "Step 8 Once cooled, pipe the butter cream into each of your cakes and decorate.",
-            ],
+            "\n".join(
+                [
+                    "Step 1 Preheat your oven to 180c and line a cupcake tray with cases.",
+                    "Step 2 Combine the non-dairy milk and cider vinegar, then set aside and allow to thicken.",
+                    "Step 3 In your Ninja food processor, add in all of your dry ingredients and pulse to combine.",
+                    "Step 4 Pour in the oil, milk mixture and lemon zest and blend for a few seconds to create a smooth batter.",
+                    "Step 5 Transfer this into your cupcake cases (makes around 6 cupcakes) and bake in the oven for 25 minutes or until cooked through.",
+                    "Step 6 Whilst allowing your cupcakes to cool, use an electric mixer to cream the butter until light and fluffy.",
+                    "Step 7 Gradually add in the sugar and powders whilst mixing until fully combined.",
+                    "Step 8 Once cooled, pipe the butter cream into each of your cakes and decorate.",
+                ]
+            ),
             self.harvester_class.instructions(),
         )
Repository: hhursev/recipe-scrapers
Pull request #339 (2021-02-25 06:54:22)

Remove debug print statement
Remove unneeded print statements from food52.py (new PR with commits fixed)

bjdm: I'm not sure if I should have moved the isort fix into another commit or PR, but given it runs on pre-commit, I figured that it's fine to include both changes in the same commit
hhursev: Thanks 🍺 

Patch:
diff --git a/recipe_scrapers/_utils.py b/recipe_scrapers/_utils.py
index 6f99782d..d813507b 100644
--- a/recipe_scrapers/_utils.py
+++ b/recipe_scrapers/_utils.py
@@ -1,7 +1,6 @@
 import html
 import re
 
-
 TIME_REGEX = re.compile(
     r"(\D*(?P<hours>\d+)\s*(hours|hrs|hr|h|Hours|H|óra))?(\D*(?P<minutes>\d+)\s*(minutes|mins|min|m|Minutes|M|perc))?"
 )
@@ -20,6 +19,12 @@ def get_minutes(element):
     if element is None:
         return None
 
+    # handle integer in string literal
+    try:
+        return int(element)
+    except Exception:
+        pass
+
     if isinstance(element, str):
         time_text = element
     else:
diff --git a/recipe_scrapers/food52.py b/recipe_scrapers/food52.py
index 42e26085..ac68d250 100644
--- a/recipe_scrapers/food52.py
+++ b/recipe_scrapers/food52.py
@@ -1,5 +1,5 @@
-from recipe_scrapers._utils import normalize_string, get_minutes
 from recipe_scrapers._abstract import AbstractScraper
+from recipe_scrapers._utils import get_minutes, normalize_string
 
 
 class Food52(AbstractScraper):
@@ -8,7 +8,6 @@ class Food52(AbstractScraper):
         return "food52.com"
 
     def title(self):
-        print("title was called")
         return self.schema.title()
 
     def total_time(self):


Test patch:
diff --git a/tests/library/test_utils.py b/tests/library/test_utils.py
index 35c85832..9ebd3695 100644
--- a/tests/library/test_utils.py
+++ b/tests/library/test_utils.py
@@ -27,3 +27,9 @@ class UtilsTest(unittest.TestCase):
         result = get_minutes(text)
 
         assert result == 70
+
+    def test_get_minutes_int_in_string_literal(self):
+        text = "90"
+        result = get_minutes(text)
+
+        assert result == 90
Repository: hhursev/recipe-scrapers
Pull request #361 (2021-03-15 01:59:53)

Cucciaio.it: Use combined time
As recommended by @rakicluca in #351.

A bit of a lazy change since I'll end up writing this for the v13 changes, but I thought I'd at least get it in.


Patch:
diff --git a/recipe_scrapers/cucchiaio.py b/recipe_scrapers/cucchiaio.py
index 7e7cfdea..0c4c3d2d 100644
--- a/recipe_scrapers/cucchiaio.py
+++ b/recipe_scrapers/cucchiaio.py
@@ -14,10 +14,10 @@ class Cucchiaio(AbstractScraper):
         return self.schema.title()
 
     def total_time(self):
-        time = self.soup.find("div", {"class": "sintesi sx"})
-        if time:
-            time = get_minutes(time.get_text())
-        return time
+        block = self.soup.find("div", {"class": "scheda-ricetta-new"})
+        if block:
+            return sum(map(get_minutes, block.findAll("tr")))
+        return 0
 
     def yields(self):
         header = self.soup.find("td", text="PORZIONI")


Test patch:
diff --git a/tests/test_cucchiaio.py b/tests/test_cucchiaio.py
index c2ac6403..b433ca46 100644
--- a/tests/test_cucchiaio.py
+++ b/tests/test_cucchiaio.py
@@ -19,7 +19,7 @@ class TestCucchiaioScraper(ScraperTest):
         )
 
     def test_total_time(self):
-        self.assertEqual(30, self.harvester_class.total_time())
+        self.assertEqual(60, self.harvester_class.total_time())
 
     def test_yields(self):
         self.assertEqual("4 item(s)", self.harvester_class.yields())
Repository: hhursev/recipe-scrapers
Pull request #389 (2021-06-12 22:09:30)

Consistent return type for recipe yields
- Add yield output for `whatsgabycooking` scraper, using schema retrieval
- Return Python `None` (null) value instead of an empty string when recipe yield is unknown / cannot be retrieved (affects `nihhealthyeating`, `vegolosi`)

Inspired by #388 


Patch:
diff --git a/recipe_scrapers/nihhealthyeating.py b/recipe_scrapers/nihhealthyeating.py
index 16501450..388d2039 100644
--- a/recipe_scrapers/nihhealthyeating.py
+++ b/recipe_scrapers/nihhealthyeating.py
@@ -25,7 +25,7 @@ class NIHHealthyEating(AbstractScraper):
             i += 1
 
         if i >= len(time_table.findAll("td")):
-            return ""
+            return
         return get_yields(time_table.find_all("td")[i])
 
     def ingredients(self):
diff --git a/recipe_scrapers/usdamyplate.py b/recipe_scrapers/usdamyplate.py
index 0bfe6ee8..32341e5c 100644
--- a/recipe_scrapers/usdamyplate.py
+++ b/recipe_scrapers/usdamyplate.py
@@ -40,8 +40,6 @@ class USDAMyPlate(AbstractScraper):
                 return get_yields(spans[i + 1])
             i += 1
 
-        return ""
-
     def image(self):
         div = self.soup.find(
             "div",
diff --git a/recipe_scrapers/vegolosi.py b/recipe_scrapers/vegolosi.py
index 4ab51f0b..54c318a1 100644
--- a/recipe_scrapers/vegolosi.py
+++ b/recipe_scrapers/vegolosi.py
@@ -38,7 +38,6 @@ class Vegolosi(AbstractScraper):
         for element in possible_yields_info_elements:
             if "persone" in element.get_text():
                 return get_yields(element)
-        return ""
 
     def ingredients(self):
         ingredients = self.soup.select(".tasty-recipe-ingredients > ul > li")
diff --git a/recipe_scrapers/whatsgabycooking.py b/recipe_scrapers/whatsgabycooking.py
index c3d4f9f3..ea11a4c0 100644
--- a/recipe_scrapers/whatsgabycooking.py
+++ b/recipe_scrapers/whatsgabycooking.py
@@ -14,7 +14,7 @@ class WhatsGabyCooking(AbstractScraper):
         return get_minutes(self.soup.find("p", {"class": "header-recipe-time"}))
 
     def yields(self):
-        return ""
+        return self.schema.yields()
 
     def ingredients(self):
         ingredients = self.soup.findAll("li", {"class": "wprm-recipe-ingredient"})


Test patch:
diff --git a/tests/test_whatsgabycooking.py b/tests/test_whatsgabycooking.py
index dcb25688..a7ef11e3 100644
--- a/tests/test_whatsgabycooking.py
+++ b/tests/test_whatsgabycooking.py
@@ -21,6 +21,9 @@ class TestWhatsGabyCookingScraper(ScraperTest):
     def test_total_time(self):
         self.assertEqual(45, self.harvester_class.total_time())
 
+    def test_yields(self):
+        self.assertEqual("6 serving(s)", self.harvester_class.yields())
+
     def test_image(self):
         self.assertEqual(
             "https://cdn.whatsgabycooking.com/wp-content/uploads/2017/10/WGC-Quinoa-Bake-copy-2.jpg",