We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
use `rel="noopener noreferrer"` for external links
1. GitHub link
2. Privacy Policy link
3. Transit agency link

<img width="974" alt="image" src="https://user-images.githubusercontent.com/3673236/142677414-95011bb6-2aaf-4136-a7e3-03cfc27f40f0.png">


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `benefits/core/viewmodels.py`
Content:
```
1 """
2 The core application: view model definitions for the root of the webapp.
3 """
4 from django.utils.translation import pgettext, ugettext as _
5 
6 from benefits.core import models
7 
8 from . import session
9 
10 
11 class Button:
12     """
13     Represents a clickable button as styled <a> element (with optional label):
14     * label: str
15     * id: str
16     * classes: str, str[]
17     * text: str
18     * url: str
19     """
20 
21     def __init__(self, **kwargs):
22         classes = kwargs.get("classes", [])
23         if isinstance(classes, str):
24             classes = classes.split()
25 
26         self.classes = ["btn", "btn-lg"]
27         self.classes.extend(classes)
28         self.id = kwargs.get("id")
29         self.label = kwargs.get("label")
30         self.text = kwargs.get("text", "Button")
31         self.url = kwargs.get("url")
32         self.target = kwargs.get("target")
33 
34     @staticmethod
35     def agency_contact_links(agency):
36         """Create link buttons for agency contact information."""
37         return [
38             # fmt: off
39             Button.link(classes="agency-url", label=agency.long_name, text=agency.info_url, url=agency.info_url, target="_blank"),  # noqa: E501
40             Button.link(classes="agency-phone", text=agency.phone, url=f"tel:{agency.phone}"),
41             # fmt: on
42         ]
43 
44     @staticmethod
45     def home(request, text=_("core.buttons.home")):
46         """Create a button back to this session's origin."""
47         return Button.primary(text=text, url=session.origin(request))
48 
49     @staticmethod
50     def link(**kwargs):
51         classes = kwargs.pop("classes", [])
52         if isinstance(classes, str):
53             classes = classes.split(" ")
54         classes.insert(0, "btn-link")
55         return Button(classes=classes, **kwargs)
56 
57     @staticmethod
58     def primary(**kwargs):
59         classes = kwargs.pop("classes", [])
60         if isinstance(classes, str):
61             classes = classes.split(" ")
62         classes.insert(0, "btn-primary")
63         return Button(classes=classes, **kwargs)
64 
65     @staticmethod
66     def outline_primary(**kwargs):
67         classes = kwargs.pop("classes", [])
68         if isinstance(classes, str):
69             classes = classes.split(" ")
70         classes.insert(0, "btn-outline-primary")
71         return Button(classes=classes, **kwargs)
72 
73 
74 class Image:
75     """Represents a generic image."""
76 
77     def __init__(self, src, alt):
78         self.src = src
79         if not self.src.startswith("http"):
80             self.src = f"img/{self.src}"
81 
82         self.alt = alt
83 
84 
85 class Icon(Image):
86     """Represents an icon."""
87 
88     def __init__(self, icon, alt):
89         super().__init__(src=f"icon/{icon}.svg", alt=alt)
90 
91 
92 class MediaItem:
93     """
94     Represents a list item:
95     * icon: core.viewmodels.Icon
96     * heading: str
97     * details: str
98     """
99 
100     def __init__(self, icon, heading, details):
101         self.icon = icon
102         self.heading = heading
103         self.details = details
104 
105 
106 class Page:
107     """
108     Represents a page of content:
109     * title: str
110     * image: core.viewmodels.Image
111     * icon: core.viewmodels.Icon
112     * content_title: str
113     * media: core.viewmodels.MediaItem[]
114     * paragraphs: str[]
115     * form: django.forms.Form
116     * forms: django.forms.Form[]
117     * button: core.viewmodels.Button
118     * buttons: core.viewmodels.Button[]
119     * classes: str[]
120     """
121 
122     def __init__(self, **kwargs):
123         self.title = kwargs.get("title")
124         if self.title is None:
125             self.title = _("core.page.title")
126         else:
127             self.title = f"{_('core.page.title')}: {self.title}"
128 
129         self.image = kwargs.get("image")
130         self.icon = kwargs.get("icon")
131         self.content_title = kwargs.get("content_title")
132         self.media = kwargs.get("media", [])
133         self.paragraphs = kwargs.get("paragraphs", [])
134         self.steps = kwargs.get("steps")
135 
136         self.forms = kwargs.get("forms", [])
137         if not isinstance(self.forms, list):
138             self.forms = [self.forms]
139         if "form" in kwargs:
140             self.forms.append(kwargs.get("form"))
141 
142         self.buttons = kwargs.get("buttons", [])
143         if not isinstance(self.buttons, list):
144             self.buttons = [self.buttons]
145         if "button" in kwargs:
146             self.buttons.append(kwargs.get("button"))
147 
148         self.classes = kwargs.get("classes", [])
149         if not isinstance(self.classes, list):
150             self.classes = self.classes.split(" ")
151         if isinstance(self.image, Image):
152             self.classes.append("with-image")
153 
154     def context_dict(self):
155         """Return a context dict for a Page."""
156         return {"page": self}
157 
158 
159 class ErrorPage(Page):
160     """
161     Represents an error page:
162     * title: str
163     * icon: core.viewmodels.Icon
164     * content_title: str
165     * paragraphs: str[]
166     * button: core.viewmodels.Button
167     """
168 
169     def __init__(self, **kwargs):
170         super().__init__(
171             title=kwargs.get("title", _("core.error")),
172             icon=kwargs.get("icon", Icon("sadbus", pgettext("image alt text", "core.icons.sadbus"))),
173             content_title=kwargs.get("content_title", _("core.error")),
174             paragraphs=kwargs.get("paragraphs", [_("core.error.server.content_title")]),
175             button=kwargs.get("button"),
176         )
177 
178     @staticmethod
179     def error(
180         title=_("core.error.server.title"),
181         content_title=_("core.error.server.title"),
182         paragraphs=[_("core.error.server.p1"), _("core.error.server.p2")],
183         **kwargs,
184     ):
185         """Create a new core.viewmodels.ErrorPage instance with defaults for a generic error."""
186         return ErrorPage(title=title, content_title=content_title, paragraphs=paragraphs, **kwargs)
187 
188     @staticmethod
189     def not_found(
190         title=_("core.error.notfound.title"),
191         content_title=_("core.error.notfound.content_title"),
192         paragraphs=[_("core.error.notfound.p1")],
193         **kwargs,
194     ):
195         """Create a new core.viewmodels.ErrorPage with defaults for a 404."""
196         path = kwargs.pop("path", None)
197         if path and title:
198             title = f"{title}: {path}"
199         elif path and not title:
200             title = path
201         return ErrorPage(title=title, content_title=content_title, paragraphs=paragraphs, **kwargs)
202 
203 
204 class PaymentProcessor:
205     """
206     Represents a core.models.PaymentProcessor:
207     * model: core.models.PaymentProcessor
208     * access_token: str
209     * element_id: str
210     * color: str
211     * [name: str]
212     * [loading_text: str]
213     """
214 
215     def __init__(self, model, access_token, element_id, color, name=None, loading_text=_("core.buttons.wait")):
216         if isinstance(model, models.PaymentProcessor):
217             self.access_token = access_token
218             self.element_id = element_id
219             self.color = color
220             self.name = name or model.name
221             self.loading_text = loading_text
222             self.card_tokenize_url = model.card_tokenize_url
223             self.card_tokenize_func = model.card_tokenize_func
224             self.card_tokenize_env = model.card_tokenize_env
225 
226     def context_dict(self):
227         """Return a context dict for a PaymentProcessor."""
228         return {"payment_processor": self}
229 
230 
231 class TransitAgency:
232     """
233     Represents a core.models.TransitAgency:
234     * model: core.models.TransitAgency
235     """
236 
237     def __init__(self, model):
238         if isinstance(model, models.TransitAgency):
239             self.slug = model.slug
240             self.short_name = model.short_name
241             self.long_name = model.long_name
242             self.agency_id = model.agency_id
243             self.merchant_id = model.merchant_id
244             self.info_url = model.info_url
245             self.phone = model.phone
246 
247     def context_dict(self):
248         """Return a context dict for a TransitAgency."""
249         return {"agency": self}
250
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/benefits/core/viewmodels.py b/benefits/core/viewmodels.py
--- a/benefits/core/viewmodels.py
+++ b/benefits/core/viewmodels.py
@@ -16,6 +16,8 @@
     * classes: str, str[]
     * text: str
     * url: str
+    * target: str
+    * rel: str
     """
 
     def __init__(self, **kwargs):
@@ -30,13 +32,14 @@
         self.text = kwargs.get("text", "Button")
         self.url = kwargs.get("url")
         self.target = kwargs.get("target")
+        self.rel = kwargs.get("rel")
 
     @staticmethod
     def agency_contact_links(agency):
         """Create link buttons for agency contact information."""
         return [
             # fmt: off
-            Button.link(classes="agency-url", label=agency.long_name, text=agency.info_url, url=agency.info_url, target="_blank"),  # noqa: E501
+            Button.link(classes="agency-url", label=agency.long_name, text=agency.info_url, url=agency.info_url, target="_blank", rel="noopener noreferrer"),  # noqa: E501
             Button.link(classes="agency-phone", text=agency.phone, url=f"tel:{agency.phone}"),
             # fmt: on
         ]

{"golden_diff": "diff --git a/benefits/core/viewmodels.py b/benefits/core/viewmodels.py\n--- a/benefits/core/viewmodels.py\n+++ b/benefits/core/viewmodels.py\n@@ -16,6 +16,8 @@\n     * classes: str, str[]\n     * text: str\n     * url: str\n+    * target: str\n+    * rel: str\n     \"\"\"\n \n     def __init__(self, **kwargs):\n@@ -30,13 +32,14 @@\n         self.text = kwargs.get(\"text\", \"Button\")\n         self.url = kwargs.get(\"url\")\n         self.target = kwargs.get(\"target\")\n+        self.rel = kwargs.get(\"rel\")\n \n     @staticmethod\n     def agency_contact_links(agency):\n         \"\"\"Create link buttons for agency contact information.\"\"\"\n         return [\n             # fmt: off\n-            Button.link(classes=\"agency-url\", label=agency.long_name, text=agency.info_url, url=agency.info_url, target=\"_blank\"),  # noqa: E501\n+            Button.link(classes=\"agency-url\", label=agency.long_name, text=agency.info_url, url=agency.info_url, target=\"_blank\", rel=\"noopener noreferrer\"),  # noqa: E501\n             Button.link(classes=\"agency-phone\", text=agency.phone, url=f\"tel:{agency.phone}\"),\n             # fmt: on\n         ]\n", "issue": "use `rel=\"noopener noreferrer\"` for external links\n1. GitHub link\r\n2. Privacy Policy link\r\n3. Transit agency link\r\n\r\n<img width=\"974\" alt=\"image\" src=\"https://user-images.githubusercontent.com/3673236/142677414-95011bb6-2aaf-4136-a7e3-03cfc27f40f0.png\">\r\n\n", "before_files": [{"content": "\"\"\"\nThe core application: view model definitions for the root of the webapp.\n\"\"\"\nfrom django.utils.translation import pgettext, ugettext as _\n\nfrom benefits.core import models\n\nfrom . import session\n\n\nclass Button:\n    \"\"\"\n    Represents a clickable button as styled <a> element (with optional label):\n    * label: str\n    * id: str\n    * classes: str, str[]\n    * text: str\n    * url: str\n    \"\"\"\n\n    def __init__(self, **kwargs):\n        classes = kwargs.get(\"classes\", [])\n        if isinstance(classes, str):\n            classes = classes.split()\n\n        self.classes = [\"btn\", \"btn-lg\"]\n        self.classes.extend(classes)\n        self.id = kwargs.get(\"id\")\n        self.label = kwargs.get(\"label\")\n        self.text = kwargs.get(\"text\", \"Button\")\n        self.url = kwargs.get(\"url\")\n        self.target = kwargs.get(\"target\")\n\n    @staticmethod\n    def agency_contact_links(agency):\n        \"\"\"Create link buttons for agency contact information.\"\"\"\n        return [\n            # fmt: off\n            Button.link(classes=\"agency-url\", label=agency.long_name, text=agency.info_url, url=agency.info_url, target=\"_blank\"),  # noqa: E501\n            Button.link(classes=\"agency-phone\", text=agency.phone, url=f\"tel:{agency.phone}\"),\n            # fmt: on\n        ]\n\n    @staticmethod\n    def home(request, text=_(\"core.buttons.home\")):\n        \"\"\"Create a button back to this session's origin.\"\"\"\n        return Button.primary(text=text, url=session.origin(request))\n\n    @staticmethod\n    def link(**kwargs):\n        classes = kwargs.pop(\"classes\", [])\n        if isinstance(classes, str):\n            classes = classes.split(\" \")\n        classes.insert(0, \"btn-link\")\n        return Button(classes=classes, **kwargs)\n\n    @staticmethod\n    def primary(**kwargs):\n        classes = kwargs.pop(\"classes\", [])\n        if isinstance(classes, str):\n            classes = classes.split(\" \")\n        classes.insert(0, \"btn-primary\")\n        return Button(classes=classes, **kwargs)\n\n    @staticmethod\n    def outline_primary(**kwargs):\n        classes = kwargs.pop(\"classes\", [])\n        if isinstance(classes, str):\n            classes = classes.split(\" \")\n        classes.insert(0, \"btn-outline-primary\")\n        return Button(classes=classes, **kwargs)\n\n\nclass Image:\n    \"\"\"Represents a generic image.\"\"\"\n\n    def __init__(self, src, alt):\n        self.src = src\n        if not self.src.startswith(\"http\"):\n            self.src = f\"img/{self.src}\"\n\n        self.alt = alt\n\n\nclass Icon(Image):\n    \"\"\"Represents an icon.\"\"\"\n\n    def __init__(self, icon, alt):\n        super().__init__(src=f\"icon/{icon}.svg\", alt=alt)\n\n\nclass MediaItem:\n    \"\"\"\n    Represents a list item:\n    * icon: core.viewmodels.Icon\n    * heading: str\n    * details: str\n    \"\"\"\n\n    def __init__(self, icon, heading, details):\n        self.icon = icon\n        self.heading = heading\n        self.details = details\n\n\nclass Page:\n    \"\"\"\n    Represents a page of content:\n    * title: str\n    * image: core.viewmodels.Image\n    * icon: core.viewmodels.Icon\n    * content_title: str\n    * media: core.viewmodels.MediaItem[]\n    * paragraphs: str[]\n    * form: django.forms.Form\n    * forms: django.forms.Form[]\n    * button: core.viewmodels.Button\n    * buttons: core.viewmodels.Button[]\n    * classes: str[]\n    \"\"\"\n\n    def __init__(self, **kwargs):\n        self.title = kwargs.get(\"title\")\n        if self.title is None:\n            self.title = _(\"core.page.title\")\n        else:\n            self.title = f\"{_('core.page.title')}: {self.title}\"\n\n        self.image = kwargs.get(\"image\")\n        self.icon = kwargs.get(\"icon\")\n        self.content_title = kwargs.get(\"content_title\")\n        self.media = kwargs.get(\"media\", [])\n        self.paragraphs = kwargs.get(\"paragraphs\", [])\n        self.steps = kwargs.get(\"steps\")\n\n        self.forms = kwargs.get(\"forms\", [])\n        if not isinstance(self.forms, list):\n            self.forms = [self.forms]\n        if \"form\" in kwargs:\n            self.forms.append(kwargs.get(\"form\"))\n\n        self.buttons = kwargs.get(\"buttons\", [])\n        if not isinstance(self.buttons, list):\n            self.buttons = [self.buttons]\n        if \"button\" in kwargs:\n            self.buttons.append(kwargs.get(\"button\"))\n\n        self.classes = kwargs.get(\"classes\", [])\n        if not isinstance(self.classes, list):\n            self.classes = self.classes.split(\" \")\n        if isinstance(self.image, Image):\n            self.classes.append(\"with-image\")\n\n    def context_dict(self):\n        \"\"\"Return a context dict for a Page.\"\"\"\n        return {\"page\": self}\n\n\nclass ErrorPage(Page):\n    \"\"\"\n    Represents an error page:\n    * title: str\n    * icon: core.viewmodels.Icon\n    * content_title: str\n    * paragraphs: str[]\n    * button: core.viewmodels.Button\n    \"\"\"\n\n    def __init__(self, **kwargs):\n        super().__init__(\n            title=kwargs.get(\"title\", _(\"core.error\")),\n            icon=kwargs.get(\"icon\", Icon(\"sadbus\", pgettext(\"image alt text\", \"core.icons.sadbus\"))),\n            content_title=kwargs.get(\"content_title\", _(\"core.error\")),\n            paragraphs=kwargs.get(\"paragraphs\", [_(\"core.error.server.content_title\")]),\n            button=kwargs.get(\"button\"),\n        )\n\n    @staticmethod\n    def error(\n        title=_(\"core.error.server.title\"),\n        content_title=_(\"core.error.server.title\"),\n        paragraphs=[_(\"core.error.server.p1\"), _(\"core.error.server.p2\")],\n        **kwargs,\n    ):\n        \"\"\"Create a new core.viewmodels.ErrorPage instance with defaults for a generic error.\"\"\"\n        return ErrorPage(title=title, content_title=content_title, paragraphs=paragraphs, **kwargs)\n\n    @staticmethod\n    def not_found(\n        title=_(\"core.error.notfound.title\"),\n        content_title=_(\"core.error.notfound.content_title\"),\n        paragraphs=[_(\"core.error.notfound.p1\")],\n        **kwargs,\n    ):\n        \"\"\"Create a new core.viewmodels.ErrorPage with defaults for a 404.\"\"\"\n        path = kwargs.pop(\"path\", None)\n        if path and title:\n            title = f\"{title}: {path}\"\n        elif path and not title:\n            title = path\n        return ErrorPage(title=title, content_title=content_title, paragraphs=paragraphs, **kwargs)\n\n\nclass PaymentProcessor:\n    \"\"\"\n    Represents a core.models.PaymentProcessor:\n    * model: core.models.PaymentProcessor\n    * access_token: str\n    * element_id: str\n    * color: str\n    * [name: str]\n    * [loading_text: str]\n    \"\"\"\n\n    def __init__(self, model, access_token, element_id, color, name=None, loading_text=_(\"core.buttons.wait\")):\n        if isinstance(model, models.PaymentProcessor):\n            self.access_token = access_token\n            self.element_id = element_id\n            self.color = color\n            self.name = name or model.name\n            self.loading_text = loading_text\n            self.card_tokenize_url = model.card_tokenize_url\n            self.card_tokenize_func = model.card_tokenize_func\n            self.card_tokenize_env = model.card_tokenize_env\n\n    def context_dict(self):\n        \"\"\"Return a context dict for a PaymentProcessor.\"\"\"\n        return {\"payment_processor\": self}\n\n\nclass TransitAgency:\n    \"\"\"\n    Represents a core.models.TransitAgency:\n    * model: core.models.TransitAgency\n    \"\"\"\n\n    def __init__(self, model):\n        if isinstance(model, models.TransitAgency):\n            self.slug = model.slug\n            self.short_name = model.short_name\n            self.long_name = model.long_name\n            self.agency_id = model.agency_id\n            self.merchant_id = model.merchant_id\n            self.info_url = model.info_url\n            self.phone = model.phone\n\n    def context_dict(self):\n        \"\"\"Return a context dict for a TransitAgency.\"\"\"\n        return {\"agency\": self}\n", "path": "benefits/core/viewmodels.py"}], "after_files": [{"content": "\"\"\"\nThe core application: view model definitions for the root of the webapp.\n\"\"\"\nfrom django.utils.translation import pgettext, ugettext as _\n\nfrom benefits.core import models\n\nfrom . import session\n\n\nclass Button:\n    \"\"\"\n    Represents a clickable button as styled <a> element (with optional label):\n    * label: str\n    * id: str\n    * classes: str, str[]\n    * text: str\n    * url: str\n    * target: str\n    * rel: str\n    \"\"\"\n\n    def __init__(self, **kwargs):\n        classes = kwargs.get(\"classes\", [])\n        if isinstance(classes, str):\n            classes = classes.split()\n\n        self.classes = [\"btn\", \"btn-lg\"]\n        self.classes.extend(classes)\n        self.id = kwargs.get(\"id\")\n        self.label = kwargs.get(\"label\")\n        self.text = kwargs.get(\"text\", \"Button\")\n        self.url = kwargs.get(\"url\")\n        self.target = kwargs.get(\"target\")\n        self.rel = kwargs.get(\"rel\")\n\n    @staticmethod\n    def agency_contact_links(agency):\n        \"\"\"Create link buttons for agency contact information.\"\"\"\n        return [\n            # fmt: off\n            Button.link(classes=\"agency-url\", label=agency.long_name, text=agency.info_url, url=agency.info_url, target=\"_blank\", rel=\"noopener noreferrer\"),  # noqa: E501\n            Button.link(classes=\"agency-phone\", text=agency.phone, url=f\"tel:{agency.phone}\"),\n            # fmt: on\n        ]\n\n    @staticmethod\n    def home(request, text=_(\"core.buttons.home\")):\n        \"\"\"Create a button back to this session's origin.\"\"\"\n        return Button.primary(text=text, url=session.origin(request))\n\n    @staticmethod\n    def link(**kwargs):\n        classes = kwargs.pop(\"classes\", [])\n        if isinstance(classes, str):\n            classes = classes.split(\" \")\n        classes.insert(0, \"btn-link\")\n        return Button(classes=classes, **kwargs)\n\n    @staticmethod\n    def primary(**kwargs):\n        classes = kwargs.pop(\"classes\", [])\n        if isinstance(classes, str):\n            classes = classes.split(\" \")\n        classes.insert(0, \"btn-primary\")\n        return Button(classes=classes, **kwargs)\n\n    @staticmethod\n    def outline_primary(**kwargs):\n        classes = kwargs.pop(\"classes\", [])\n        if isinstance(classes, str):\n            classes = classes.split(\" \")\n        classes.insert(0, \"btn-outline-primary\")\n        return Button(classes=classes, **kwargs)\n\n\nclass Image:\n    \"\"\"Represents a generic image.\"\"\"\n\n    def __init__(self, src, alt):\n        self.src = src\n        if not self.src.startswith(\"http\"):\n            self.src = f\"img/{self.src}\"\n\n        self.alt = alt\n\n\nclass Icon(Image):\n    \"\"\"Represents an icon.\"\"\"\n\n    def __init__(self, icon, alt):\n        super().__init__(src=f\"icon/{icon}.svg\", alt=alt)\n\n\nclass MediaItem:\n    \"\"\"\n    Represents a list item:\n    * icon: core.viewmodels.Icon\n    * heading: str\n    * details: str\n    \"\"\"\n\n    def __init__(self, icon, heading, details):\n        self.icon = icon\n        self.heading = heading\n        self.details = details\n\n\nclass Page:\n    \"\"\"\n    Represents a page of content:\n    * title: str\n    * image: core.viewmodels.Image\n    * icon: core.viewmodels.Icon\n    * content_title: str\n    * media: core.viewmodels.MediaItem[]\n    * paragraphs: str[]\n    * form: django.forms.Form\n    * forms: django.forms.Form[]\n    * button: core.viewmodels.Button\n    * buttons: core.viewmodels.Button[]\n    * classes: str[]\n    \"\"\"\n\n    def __init__(self, **kwargs):\n        self.title = kwargs.get(\"title\")\n        if self.title is None:\n            self.title = _(\"core.page.title\")\n        else:\n            self.title = f\"{_('core.page.title')}: {self.title}\"\n\n        self.image = kwargs.get(\"image\")\n        self.icon = kwargs.get(\"icon\")\n        self.content_title = kwargs.get(\"content_title\")\n        self.media = kwargs.get(\"media\", [])\n        self.paragraphs = kwargs.get(\"paragraphs\", [])\n        self.steps = kwargs.get(\"steps\")\n\n        self.forms = kwargs.get(\"forms\", [])\n        if not isinstance(self.forms, list):\n            self.forms = [self.forms]\n        if \"form\" in kwargs:\n            self.forms.append(kwargs.get(\"form\"))\n\n        self.buttons = kwargs.get(\"buttons\", [])\n        if not isinstance(self.buttons, list):\n            self.buttons = [self.buttons]\n        if \"button\" in kwargs:\n            self.buttons.append(kwargs.get(\"button\"))\n\n        self.classes = kwargs.get(\"classes\", [])\n        if not isinstance(self.classes, list):\n            self.classes = self.classes.split(\" \")\n        if isinstance(self.image, Image):\n            self.classes.append(\"with-image\")\n\n    def context_dict(self):\n        \"\"\"Return a context dict for a Page.\"\"\"\n        return {\"page\": self}\n\n\nclass ErrorPage(Page):\n    \"\"\"\n    Represents an error page:\n    * title: str\n    * icon: core.viewmodels.Icon\n    * content_title: str\n    * paragraphs: str[]\n    * button: core.viewmodels.Button\n    \"\"\"\n\n    def __init__(self, **kwargs):\n        super().__init__(\n            title=kwargs.get(\"title\", _(\"core.error\")),\n            icon=kwargs.get(\"icon\", Icon(\"sadbus\", pgettext(\"image alt text\", \"core.icons.sadbus\"))),\n            content_title=kwargs.get(\"content_title\", _(\"core.error\")),\n            paragraphs=kwargs.get(\"paragraphs\", [_(\"core.error.server.content_title\")]),\n            button=kwargs.get(\"button\"),\n        )\n\n    @staticmethod\n    def error(\n        title=_(\"core.error.server.title\"),\n        content_title=_(\"core.error.server.title\"),\n        paragraphs=[_(\"core.error.server.p1\"), _(\"core.error.server.p2\")],\n        **kwargs,\n    ):\n        \"\"\"Create a new core.viewmodels.ErrorPage instance with defaults for a generic error.\"\"\"\n        return ErrorPage(title=title, content_title=content_title, paragraphs=paragraphs, **kwargs)\n\n    @staticmethod\n    def not_found(\n        title=_(\"core.error.notfound.title\"),\n        content_title=_(\"core.error.notfound.content_title\"),\n        paragraphs=[_(\"core.error.notfound.p1\")],\n        **kwargs,\n    ):\n        \"\"\"Create a new core.viewmodels.ErrorPage with defaults for a 404.\"\"\"\n        path = kwargs.pop(\"path\", None)\n        if path and title:\n            title = f\"{title}: {path}\"\n        elif path and not title:\n            title = path\n        return ErrorPage(title=title, content_title=content_title, paragraphs=paragraphs, **kwargs)\n\n\nclass PaymentProcessor:\n    \"\"\"\n    Represents a core.models.PaymentProcessor:\n    * model: core.models.PaymentProcessor\n    * access_token: str\n    * element_id: str\n    * color: str\n    * [name: str]\n    * [loading_text: str]\n    \"\"\"\n\n    def __init__(self, model, access_token, element_id, color, name=None, loading_text=_(\"core.buttons.wait\")):\n        if isinstance(model, models.PaymentProcessor):\n            self.access_token = access_token\n            self.element_id = element_id\n            self.color = color\n            self.name = name or model.name\n            self.loading_text = loading_text\n            self.card_tokenize_url = model.card_tokenize_url\n            self.card_tokenize_func = model.card_tokenize_func\n            self.card_tokenize_env = model.card_tokenize_env\n\n    def context_dict(self):\n        \"\"\"Return a context dict for a PaymentProcessor.\"\"\"\n        return {\"payment_processor\": self}\n\n\nclass TransitAgency:\n    \"\"\"\n    Represents a core.models.TransitAgency:\n    * model: core.models.TransitAgency\n    \"\"\"\n\n    def __init__(self, model):\n        if isinstance(model, models.TransitAgency):\n            self.slug = model.slug\n            self.short_name = model.short_name\n            self.long_name = model.long_name\n            self.agency_id = model.agency_id\n            self.merchant_id = model.merchant_id\n            self.info_url = model.info_url\n            self.phone = model.phone\n\n    def context_dict(self):\n        \"\"\"Return a context dict for a TransitAgency.\"\"\"\n        return {\"agency\": self}\n", "path": "benefits/core/viewmodels.py"}]}