prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Add canonicals to category page
  For example this two pages contains no canonicals:
  - https://www.shopelectro.ru/catalog/categories/akkumuliatory-270/tags/li-ro_hbced/?page=2
  - ~https://www.shopelectro.ru/catalog/categories/akkumuliatory-270/?page=2~ checked - it contains canonical
  Add canonicals to category page
  For example this two pages contains no canonicals:
  - https://www.shopelectro.ru/catalog/categories/akkumuliatory-270/tags/li-ro_hbced/?page=2
  - ~https://www.shopelectro.ru/catalog/categories/akkumuliatory-270/?page=2~ checked - it contains canonical
  
  </issue>
  <code>
  [start of shopelectro/context.py]
  1 from functools import partial
  2 
  3 from catalog.newcontext import Context, Tags
  4 
  5 
  6 class Page(Context):
  7 
  8     def __init__(self, page, tags: Tags):
  9         self._page = page
  10         self._tags = tags
  11 
  12     def context(self):
  13         def template_context(page, tag_titles, tags):
  14             return {
  15                 'page': page,
  16                 'tag_titles': tag_titles,
  17                 'tags': tags,
  18             }
  19 
  20         tags_qs = self._tags.qs()
  21         self._page.get_template_render_context = partial(
  22             template_context, self._page, tags_qs.as_title(), tags_qs
  23         )
  24 
  25         return {
  26             'page': self._page,
  27             'skip_canonical': tags_qs.exists(),
  28         }
  29
  [end of shopelectro/context.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/shopelectro/context.py b/shopelectro/context.py
  --- a/shopelectro/context.py
  +++ b/shopelectro/context.py
  @@ -24,5 +24,4 @@
   
           return {
               'page': self._page,
  -            'skip_canonical': tags_qs.exists(),
           }
  
verification_info: {"golden_diff": "diff --git a/shopelectro/context.py b/shopelectro/context.py\n--- a/shopelectro/context.py\n+++ b/shopelectro/context.py\n@@ -24,5 +24,4 @@\n \n         return {\n             'page': self._page,\n-            'skip_canonical': tags_qs.exists(),\n         }\n", "issue": "Add canonicals to category page\nFor example this two pages contains no canonicals:\r\n- https://www.shopelectro.ru/catalog/categories/akkumuliatory-270/tags/li-ro_hbced/?page=2\r\n- ~https://www.shopelectro.ru/catalog/categories/akkumuliatory-270/?page=2~ checked - it contains canonical\nAdd canonicals to category page\nFor example this two pages contains no canonicals:\r\n- https://www.shopelectro.ru/catalog/categories/akkumuliatory-270/tags/li-ro_hbced/?page=2\r\n- ~https://www.shopelectro.ru/catalog/categories/akkumuliatory-270/?page=2~ checked - it contains canonical\n", "before_files": [{"content": "from functools import partial\n\nfrom catalog.newcontext import Context, Tags\n\n\nclass Page(Context):\n\n    def __init__(self, page, tags: Tags):\n        self._page = page\n        self._tags = tags\n\n    def context(self):\n        def template_context(page, tag_titles, tags):\n            return {\n                'page': page,\n                'tag_titles': tag_titles,\n                'tags': tags,\n            }\n\n        tags_qs = self._tags.qs()\n        self._page.get_template_render_context = partial(\n            template_context, self._page, tags_qs.as_title(), tags_qs\n        )\n\n        return {\n            'page': self._page,\n            'skip_canonical': tags_qs.exists(),\n        }\n", "path": "shopelectro/context.py"}]}