We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Use codespell in precommit hook


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `run.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 # You can obtain one at http://mozilla.org/MPL/2.0/.
5 
6 import argparse
7 import csv
8 import os
9 from datetime import datetime, timedelta
10 
11 import numpy as np
12 
13 from bugbug import repository  # noqa
14 from bugbug import bugzilla, db
15 from bugbug.models import get_model_class
16 
17 if __name__ == "__main__":
18     parser = argparse.ArgumentParser()
19     parser.add_argument(
20         "--lemmatization",
21         help="Perform lemmatization (using spaCy)",
22         action="store_true",
23     )
24     parser.add_argument("--train", help="Perform training", action="store_true")
25     parser.add_argument(
26         "--goal",
27         help="Goal of the classifier",
28         choices=[
29             # bug classifiers
30             "defect",
31             "regression",
32             "tracking",
33             "qaneeded",
34             "uplift",
35             "component",
36             "devdocneeded",
37             "defectenhancementtask",
38             "assignee",
39             "bugtype",
40             "stepstoreproduce",
41             # commit classifiers
42             "backout",
43         ],
44         default="defect",
45     )
46     parser.add_argument(
47         "--classifier",
48         help="Type of the classifier",
49         choices=["default", "nn"],
50         default="default",
51     )
52     parser.add_argument("--classify", help="Perform evaluation", action="store_true")
53     parser.add_argument(
54         "--generate-sheet",
55         help="Perform evaluation on bugs from last week and generate a csv file",
56         action="store_true",
57     )
58     parser.add_argument("--token", help="Bugzilla token", action="store")
59     parser.add_argument(
60         "--historical", help="Analyze historical bugs", action="store_true"
61     )
62     args = parser.parse_args()
63 
64     model_file_name = "{}{}model".format(
65         args.goal, "" if args.classifier == "default" else args.classifier
66     )
67 
68     model_class_name = args.goal
69 
70     if args.goal == "component":
71         if args.classifier == "default":
72             model_class_name = "component"
73         elif args.classifier == "nn":
74             model_class_name = "component_nn"
75         else:
76             raise ValueError(f"Unkown value {args.classifier}")
77 
78     model_class = get_model_class(model_class_name)
79 
80     if args.train:
81         db.download()
82 
83         if args.historical:
84             model = model_class(args.lemmatization, args.historical)
85         else:
86             model = model_class(args.lemmatization)
87         model.train()
88     else:
89         model = model_class.load(model_file_name)
90 
91     if args.classify:
92         for bug in bugzilla.get_bugs():
93             print(
94                 f'https://bugzilla.mozilla.org/show_bug.cgi?id={ bug["id"] } - { bug["summary"]} '
95             )
96 
97             if model.calculate_importance:
98                 probas, importances = model.classify(
99                     bug, probabilities=True, importances=True
100                 )
101 
102                 feature_names = model.get_feature_names()
103                 for i, (importance, index, is_positive) in enumerate(importances):
104                     print(
105                         f'{i + 1}. \'{feature_names[int(index)]}\' ({"+" if (is_positive) else "-"}{importance})'
106                     )
107             else:
108                 probas = model.classify(bug, probabilities=True, importances=False)
109 
110             if np.argmax(probas) == 1:
111                 print(f"Positive! {probas}")
112             else:
113                 print(f"Negative! {probas}")
114             input()
115 
116     if args.generate_sheet:
117         assert (
118             args.token is not None
119         ), "A Bugzilla token should be set in order to download bugs"
120         today = datetime.utcnow()
121         a_week_ago = today - timedelta(7)
122         bugzilla.set_token(args.token)
123         bugs = bugzilla.download_bugs_between(a_week_ago, today)
124 
125         print(f"Classifying {len(bugs)} bugs...")
126 
127         rows = [["Bug", f"{args.goal}(model)", args.goal, "Title"]]
128 
129         for bug in bugs:
130             p = model.classify(bug, probabilities=True)
131             rows.append(
132                 [
133                     f'https://bugzilla.mozilla.org/show_bug.cgi?id={bug["id"]}',
134                     "y" if p[0][1] >= 0.7 else "n",
135                     "",
136                     bug["summary"],
137                 ]
138             )
139 
140         os.makedirs("sheets", exist_ok=True)
141         with open(
142             os.path.join(
143                 "sheets",
144                 f'{args.goal}-{datetime.utcnow().strftime("%Y-%m-%d")}-labels.csv',
145             ),
146             "w",
147         ) as f:
148             writer = csv.writer(f)
149             writer.writerows(rows)
150
```
--- 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/run.py b/run.py
--- a/run.py
+++ b/run.py
@@ -73,7 +73,7 @@
         elif args.classifier == "nn":
             model_class_name = "component_nn"
         else:
-            raise ValueError(f"Unkown value {args.classifier}")
+            raise ValueError(f"Unknown value {args.classifier}")
 
     model_class = get_model_class(model_class_name)

{"golden_diff": "diff --git a/run.py b/run.py\n--- a/run.py\n+++ b/run.py\n@@ -73,7 +73,7 @@\n         elif args.classifier == \"nn\":\n             model_class_name = \"component_nn\"\n         else:\n-            raise ValueError(f\"Unkown value {args.classifier}\")\n+            raise ValueError(f\"Unknown value {args.classifier}\")\n \n     model_class = get_model_class(model_class_name)\n", "issue": "Use codespell in precommit hook\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this file,\n# You can obtain one at http://mozilla.org/MPL/2.0/.\n\nimport argparse\nimport csv\nimport os\nfrom datetime import datetime, timedelta\n\nimport numpy as np\n\nfrom bugbug import repository  # noqa\nfrom bugbug import bugzilla, db\nfrom bugbug.models import get_model_class\n\nif __name__ == \"__main__\":\n    parser = argparse.ArgumentParser()\n    parser.add_argument(\n        \"--lemmatization\",\n        help=\"Perform lemmatization (using spaCy)\",\n        action=\"store_true\",\n    )\n    parser.add_argument(\"--train\", help=\"Perform training\", action=\"store_true\")\n    parser.add_argument(\n        \"--goal\",\n        help=\"Goal of the classifier\",\n        choices=[\n            # bug classifiers\n            \"defect\",\n            \"regression\",\n            \"tracking\",\n            \"qaneeded\",\n            \"uplift\",\n            \"component\",\n            \"devdocneeded\",\n            \"defectenhancementtask\",\n            \"assignee\",\n            \"bugtype\",\n            \"stepstoreproduce\",\n            # commit classifiers\n            \"backout\",\n        ],\n        default=\"defect\",\n    )\n    parser.add_argument(\n        \"--classifier\",\n        help=\"Type of the classifier\",\n        choices=[\"default\", \"nn\"],\n        default=\"default\",\n    )\n    parser.add_argument(\"--classify\", help=\"Perform evaluation\", action=\"store_true\")\n    parser.add_argument(\n        \"--generate-sheet\",\n        help=\"Perform evaluation on bugs from last week and generate a csv file\",\n        action=\"store_true\",\n    )\n    parser.add_argument(\"--token\", help=\"Bugzilla token\", action=\"store\")\n    parser.add_argument(\n        \"--historical\", help=\"Analyze historical bugs\", action=\"store_true\"\n    )\n    args = parser.parse_args()\n\n    model_file_name = \"{}{}model\".format(\n        args.goal, \"\" if args.classifier == \"default\" else args.classifier\n    )\n\n    model_class_name = args.goal\n\n    if args.goal == \"component\":\n        if args.classifier == \"default\":\n            model_class_name = \"component\"\n        elif args.classifier == \"nn\":\n            model_class_name = \"component_nn\"\n        else:\n            raise ValueError(f\"Unkown value {args.classifier}\")\n\n    model_class = get_model_class(model_class_name)\n\n    if args.train:\n        db.download()\n\n        if args.historical:\n            model = model_class(args.lemmatization, args.historical)\n        else:\n            model = model_class(args.lemmatization)\n        model.train()\n    else:\n        model = model_class.load(model_file_name)\n\n    if args.classify:\n        for bug in bugzilla.get_bugs():\n            print(\n                f'https://bugzilla.mozilla.org/show_bug.cgi?id={ bug[\"id\"] } - { bug[\"summary\"]} '\n            )\n\n            if model.calculate_importance:\n                probas, importances = model.classify(\n                    bug, probabilities=True, importances=True\n                )\n\n                feature_names = model.get_feature_names()\n                for i, (importance, index, is_positive) in enumerate(importances):\n                    print(\n                        f'{i + 1}. \\'{feature_names[int(index)]}\\' ({\"+\" if (is_positive) else \"-\"}{importance})'\n                    )\n            else:\n                probas = model.classify(bug, probabilities=True, importances=False)\n\n            if np.argmax(probas) == 1:\n                print(f\"Positive! {probas}\")\n            else:\n                print(f\"Negative! {probas}\")\n            input()\n\n    if args.generate_sheet:\n        assert (\n            args.token is not None\n        ), \"A Bugzilla token should be set in order to download bugs\"\n        today = datetime.utcnow()\n        a_week_ago = today - timedelta(7)\n        bugzilla.set_token(args.token)\n        bugs = bugzilla.download_bugs_between(a_week_ago, today)\n\n        print(f\"Classifying {len(bugs)} bugs...\")\n\n        rows = [[\"Bug\", f\"{args.goal}(model)\", args.goal, \"Title\"]]\n\n        for bug in bugs:\n            p = model.classify(bug, probabilities=True)\n            rows.append(\n                [\n                    f'https://bugzilla.mozilla.org/show_bug.cgi?id={bug[\"id\"]}',\n                    \"y\" if p[0][1] >= 0.7 else \"n\",\n                    \"\",\n                    bug[\"summary\"],\n                ]\n            )\n\n        os.makedirs(\"sheets\", exist_ok=True)\n        with open(\n            os.path.join(\n                \"sheets\",\n                f'{args.goal}-{datetime.utcnow().strftime(\"%Y-%m-%d\")}-labels.csv',\n            ),\n            \"w\",\n        ) as f:\n            writer = csv.writer(f)\n            writer.writerows(rows)\n", "path": "run.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this file,\n# You can obtain one at http://mozilla.org/MPL/2.0/.\n\nimport argparse\nimport csv\nimport os\nfrom datetime import datetime, timedelta\n\nimport numpy as np\n\nfrom bugbug import repository  # noqa\nfrom bugbug import bugzilla, db\nfrom bugbug.models import get_model_class\n\nif __name__ == \"__main__\":\n    parser = argparse.ArgumentParser()\n    parser.add_argument(\n        \"--lemmatization\",\n        help=\"Perform lemmatization (using spaCy)\",\n        action=\"store_true\",\n    )\n    parser.add_argument(\"--train\", help=\"Perform training\", action=\"store_true\")\n    parser.add_argument(\n        \"--goal\",\n        help=\"Goal of the classifier\",\n        choices=[\n            # bug classifiers\n            \"defect\",\n            \"regression\",\n            \"tracking\",\n            \"qaneeded\",\n            \"uplift\",\n            \"component\",\n            \"devdocneeded\",\n            \"defectenhancementtask\",\n            \"assignee\",\n            \"bugtype\",\n            \"stepstoreproduce\",\n            # commit classifiers\n            \"backout\",\n        ],\n        default=\"defect\",\n    )\n    parser.add_argument(\n        \"--classifier\",\n        help=\"Type of the classifier\",\n        choices=[\"default\", \"nn\"],\n        default=\"default\",\n    )\n    parser.add_argument(\"--classify\", help=\"Perform evaluation\", action=\"store_true\")\n    parser.add_argument(\n        \"--generate-sheet\",\n        help=\"Perform evaluation on bugs from last week and generate a csv file\",\n        action=\"store_true\",\n    )\n    parser.add_argument(\"--token\", help=\"Bugzilla token\", action=\"store\")\n    parser.add_argument(\n        \"--historical\", help=\"Analyze historical bugs\", action=\"store_true\"\n    )\n    args = parser.parse_args()\n\n    model_file_name = \"{}{}model\".format(\n        args.goal, \"\" if args.classifier == \"default\" else args.classifier\n    )\n\n    model_class_name = args.goal\n\n    if args.goal == \"component\":\n        if args.classifier == \"default\":\n            model_class_name = \"component\"\n        elif args.classifier == \"nn\":\n            model_class_name = \"component_nn\"\n        else:\n            raise ValueError(f\"Unknown value {args.classifier}\")\n\n    model_class = get_model_class(model_class_name)\n\n    if args.train:\n        db.download()\n\n        if args.historical:\n            model = model_class(args.lemmatization, args.historical)\n        else:\n            model = model_class(args.lemmatization)\n        model.train()\n    else:\n        model = model_class.load(model_file_name)\n\n    if args.classify:\n        for bug in bugzilla.get_bugs():\n            print(\n                f'https://bugzilla.mozilla.org/show_bug.cgi?id={ bug[\"id\"] } - { bug[\"summary\"]} '\n            )\n\n            if model.calculate_importance:\n                probas, importances = model.classify(\n                    bug, probabilities=True, importances=True\n                )\n\n                feature_names = model.get_feature_names()\n                for i, (importance, index, is_positive) in enumerate(importances):\n                    print(\n                        f'{i + 1}. \\'{feature_names[int(index)]}\\' ({\"+\" if (is_positive) else \"-\"}{importance})'\n                    )\n            else:\n                probas = model.classify(bug, probabilities=True, importances=False)\n\n            if np.argmax(probas) == 1:\n                print(f\"Positive! {probas}\")\n            else:\n                print(f\"Negative! {probas}\")\n            input()\n\n    if args.generate_sheet:\n        assert (\n            args.token is not None\n        ), \"A Bugzilla token should be set in order to download bugs\"\n        today = datetime.utcnow()\n        a_week_ago = today - timedelta(7)\n        bugzilla.set_token(args.token)\n        bugs = bugzilla.download_bugs_between(a_week_ago, today)\n\n        print(f\"Classifying {len(bugs)} bugs...\")\n\n        rows = [[\"Bug\", f\"{args.goal}(model)\", args.goal, \"Title\"]]\n\n        for bug in bugs:\n            p = model.classify(bug, probabilities=True)\n            rows.append(\n                [\n                    f'https://bugzilla.mozilla.org/show_bug.cgi?id={bug[\"id\"]}',\n                    \"y\" if p[0][1] >= 0.7 else \"n\",\n                    \"\",\n                    bug[\"summary\"],\n                ]\n            )\n\n        os.makedirs(\"sheets\", exist_ok=True)\n        with open(\n            os.path.join(\n                \"sheets\",\n                f'{args.goal}-{datetime.utcnow().strftime(\"%Y-%m-%d\")}-labels.csv',\n            ),\n            \"w\",\n        ) as f:\n            writer = csv.writer(f)\n            writer.writerows(rows)\n", "path": "run.py"}]}