We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Spelling error in ContextManager
`coalib/misc/ContextManagers.py` function `prepare_file` has a spelling error - `Can creates a temporary file ...` should be `Can create a temporary file ...`


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `coalib/misc/ContextManagers.py`
Content:
```
1 from contextlib import contextmanager, closing
2 import sys
3 import os
4 from io import StringIO
5 import builtins
6 import signal
7 import threading
8 import platform
9 import tempfile
10 
11 from coalib.misc.MutableValue import MutableValue
12 
13 
14 @contextmanager
15 def subprocess_timeout(sub_process, seconds, kill_pg=False):
16     """
17     Kill subprocess if the sub process takes more the than the timeout.
18 
19     :param sub_process: The sub process to run.
20     :param seconds:     The number of seconds to allow the test to run for. If
21                         set to 0 or a negative value, it waits indefinitely.
22                         Floats can be used to specify units smaller than
23                         seconds.
24     :param kill_pg:     Boolean whether to kill the process group or only this
25                         process. (not applicable for windows)
26     """
27     timedout = MutableValue(False)
28 
29     if seconds <= 0:
30         yield timedout
31         return
32 
33     finished = threading.Event()
34 
35     if platform.system() == "Windows":  # pragma: no cover
36         kill_pg = False
37 
38     def kill_it():
39         finished.wait(seconds)
40         if not finished.is_set():
41             timedout.value = True
42             if kill_pg:
43                 pgid = os.getpgid(sub_process.pid)
44             os.kill(sub_process.pid, signal.SIGINT)
45             if kill_pg:
46                 os.killpg(pgid, signal.SIGINT)
47 
48     thread = threading.Thread(name='timeout-killer', target=kill_it)
49     try:
50         thread.start()
51         yield timedout
52     finally:
53         finished.set()
54         thread.join()
55 
56 
57 @contextmanager
58 def replace_stdout(replacement):
59     """
60     Replaces stdout with the replacement, yields back to the caller and then
61     reverts everything back.
62     """
63     _stdout = sys.stdout
64     sys.stdout = replacement
65     try:
66         yield
67     finally:
68         sys.stdout = _stdout
69 
70 
71 @contextmanager
72 def suppress_stdout():
73     """
74     Suppresses everything going to stdout.
75     """
76     with open(os.devnull, "w") as devnull, replace_stdout(devnull):
77         yield
78 
79 
80 @contextmanager
81 def retrieve_stdout():
82     """
83     Yields a StringIO object from which one can read everything that was
84     printed to stdout. (It won't be printed to the real stdout!)
85 
86     Example usage:
87 
88     with retrieve_stdout() as stdout:
89         print("something")  # Won't print to the console
90         what_was_printed = stdout.getvalue()  # Save the value
91     """
92     with closing(StringIO()) as sio, replace_stdout(sio):
93         oldprint = builtins.print
94         try:
95             # Overriding stdout doesn't work with libraries, this ensures even
96             # cached variables take this up. Well... it works.
97             def newprint(*args, **kwargs):
98                 kwargs['file'] = sio
99                 oldprint(*args, **kwargs)
100 
101             builtins.print = newprint
102             yield sio
103         finally:
104             builtins.print = oldprint
105 
106 
107 @contextmanager
108 def simulate_console_inputs(*inputs):
109     """
110     Does some magic to simulate the given inputs to any calls to the `input`
111     builtin. This yields back an InputGenerator object so you can check
112     which input was already used and append any additional inputs you want.
113     Example:
114 
115         with simulate_console_inputs(0, 1, 2) as generator:
116             assert(input() == 0)
117             assert(generator.last_input == 0)
118             generator.inputs.append(3)
119             assert(input() == 1)
120             assert(input() == 2)
121             assert(input() == 3)
122             assert(generator.last_input == 3)
123 
124     :param inputs:      Any inputs to simulate.
125     :raises ValueError: Raised when was asked for more input but there's no
126                         more provided.
127     """
128     class InputGenerator:
129 
130         def __init__(self, inputs):
131             self.last_input = -1
132             self.inputs = inputs
133 
134         def generate_input(self, prompt=''):
135             print(prompt, end="")
136             self.last_input += 1
137             try:
138                 return self.inputs[self.last_input]
139             except IndexError:
140                 raise ValueError("Asked for more input, but no more was "
141                                  "provided from `simulate_console_inputs`.")
142 
143     input_generator = InputGenerator(list(inputs))
144     _input = builtins.input
145     builtins.input = input_generator.generate_input
146     try:
147         yield input_generator
148     finally:
149         builtins.input = _input
150 
151 
152 @contextmanager
153 def make_temp(suffix="", prefix="tmp", dir=None):
154     """
155     Creates a temporary file with a closed stream and deletes it when done.
156 
157     :return: A contextmanager retrieving the file path.
158     """
159     temporary = tempfile.mkstemp(suffix=suffix, prefix=prefix, dir=dir)
160     os.close(temporary[0])
161     try:
162         yield temporary[1]
163     finally:
164         os.remove(temporary[1])
165 
166 
167 @contextmanager
168 def prepare_file(lines,
169                  filename,
170                  force_linebreaks=True,
171                  create_tempfile=True,
172                  tempfile_kwargs={}):
173     """
174     Can creates a temporary file (if filename is None) with the lines.
175     Can also add a trailing newline to each line specified if needed.
176 
177     :param lines:            The lines from the file. (list of strings)
178     :param filename:         The filename to be prepared.
179     :param force_linebreaks: Whether to append newlines at each line if needed.
180     :param create_tempfile:  Whether to save lines in tempfile if needed.
181     :param tempfile_kwargs:  Kwargs passed to tempfile.mkstemp().
182     """
183     if force_linebreaks:
184         for i, line in enumerate(lines):
185             lines[i] = line if line.endswith("\n") else line + "\n"
186 
187     if not create_tempfile and filename is None:
188         filename = "dummy_file_name"
189 
190     if not isinstance(filename, str) and create_tempfile:
191         with make_temp(**tempfile_kwargs) as filename:
192             with open(filename, 'w') as file:
193                 file.writelines(lines)
194             yield lines, filename
195     else:
196         yield lines, filename
197
```
--- 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/coalib/misc/ContextManagers.py b/coalib/misc/ContextManagers.py
--- a/coalib/misc/ContextManagers.py
+++ b/coalib/misc/ContextManagers.py
@@ -171,7 +171,7 @@
                  create_tempfile=True,
                  tempfile_kwargs={}):
     """
-    Can creates a temporary file (if filename is None) with the lines.
+    Can create a temporary file (if filename is None) with the lines.
     Can also add a trailing newline to each line specified if needed.
 
     :param lines:            The lines from the file. (list of strings)

{"golden_diff": "diff --git a/coalib/misc/ContextManagers.py b/coalib/misc/ContextManagers.py\n--- a/coalib/misc/ContextManagers.py\n+++ b/coalib/misc/ContextManagers.py\n@@ -171,7 +171,7 @@\n                  create_tempfile=True,\n                  tempfile_kwargs={}):\n     \"\"\"\n-    Can creates a temporary file (if filename is None) with the lines.\n+    Can create a temporary file (if filename is None) with the lines.\n     Can also add a trailing newline to each line specified if needed.\n \n     :param lines:            The lines from the file. (list of strings)\n", "issue": "Spelling error in ContextManager\n`coalib/misc/ContextManagers.py` function `prepare_file` has a spelling error - `Can creates a temporary file ...` should be `Can create a temporary file ...`\n\n", "before_files": [{"content": "from contextlib import contextmanager, closing\nimport sys\nimport os\nfrom io import StringIO\nimport builtins\nimport signal\nimport threading\nimport platform\nimport tempfile\n\nfrom coalib.misc.MutableValue import MutableValue\n\n\n@contextmanager\ndef subprocess_timeout(sub_process, seconds, kill_pg=False):\n    \"\"\"\n    Kill subprocess if the sub process takes more the than the timeout.\n\n    :param sub_process: The sub process to run.\n    :param seconds:     The number of seconds to allow the test to run for. If\n                        set to 0 or a negative value, it waits indefinitely.\n                        Floats can be used to specify units smaller than\n                        seconds.\n    :param kill_pg:     Boolean whether to kill the process group or only this\n                        process. (not applicable for windows)\n    \"\"\"\n    timedout = MutableValue(False)\n\n    if seconds <= 0:\n        yield timedout\n        return\n\n    finished = threading.Event()\n\n    if platform.system() == \"Windows\":  # pragma: no cover\n        kill_pg = False\n\n    def kill_it():\n        finished.wait(seconds)\n        if not finished.is_set():\n            timedout.value = True\n            if kill_pg:\n                pgid = os.getpgid(sub_process.pid)\n            os.kill(sub_process.pid, signal.SIGINT)\n            if kill_pg:\n                os.killpg(pgid, signal.SIGINT)\n\n    thread = threading.Thread(name='timeout-killer', target=kill_it)\n    try:\n        thread.start()\n        yield timedout\n    finally:\n        finished.set()\n        thread.join()\n\n\n@contextmanager\ndef replace_stdout(replacement):\n    \"\"\"\n    Replaces stdout with the replacement, yields back to the caller and then\n    reverts everything back.\n    \"\"\"\n    _stdout = sys.stdout\n    sys.stdout = replacement\n    try:\n        yield\n    finally:\n        sys.stdout = _stdout\n\n\n@contextmanager\ndef suppress_stdout():\n    \"\"\"\n    Suppresses everything going to stdout.\n    \"\"\"\n    with open(os.devnull, \"w\") as devnull, replace_stdout(devnull):\n        yield\n\n\n@contextmanager\ndef retrieve_stdout():\n    \"\"\"\n    Yields a StringIO object from which one can read everything that was\n    printed to stdout. (It won't be printed to the real stdout!)\n\n    Example usage:\n\n    with retrieve_stdout() as stdout:\n        print(\"something\")  # Won't print to the console\n        what_was_printed = stdout.getvalue()  # Save the value\n    \"\"\"\n    with closing(StringIO()) as sio, replace_stdout(sio):\n        oldprint = builtins.print\n        try:\n            # Overriding stdout doesn't work with libraries, this ensures even\n            # cached variables take this up. Well... it works.\n            def newprint(*args, **kwargs):\n                kwargs['file'] = sio\n                oldprint(*args, **kwargs)\n\n            builtins.print = newprint\n            yield sio\n        finally:\n            builtins.print = oldprint\n\n\n@contextmanager\ndef simulate_console_inputs(*inputs):\n    \"\"\"\n    Does some magic to simulate the given inputs to any calls to the `input`\n    builtin. This yields back an InputGenerator object so you can check\n    which input was already used and append any additional inputs you want.\n    Example:\n\n        with simulate_console_inputs(0, 1, 2) as generator:\n            assert(input() == 0)\n            assert(generator.last_input == 0)\n            generator.inputs.append(3)\n            assert(input() == 1)\n            assert(input() == 2)\n            assert(input() == 3)\n            assert(generator.last_input == 3)\n\n    :param inputs:      Any inputs to simulate.\n    :raises ValueError: Raised when was asked for more input but there's no\n                        more provided.\n    \"\"\"\n    class InputGenerator:\n\n        def __init__(self, inputs):\n            self.last_input = -1\n            self.inputs = inputs\n\n        def generate_input(self, prompt=''):\n            print(prompt, end=\"\")\n            self.last_input += 1\n            try:\n                return self.inputs[self.last_input]\n            except IndexError:\n                raise ValueError(\"Asked for more input, but no more was \"\n                                 \"provided from `simulate_console_inputs`.\")\n\n    input_generator = InputGenerator(list(inputs))\n    _input = builtins.input\n    builtins.input = input_generator.generate_input\n    try:\n        yield input_generator\n    finally:\n        builtins.input = _input\n\n\n@contextmanager\ndef make_temp(suffix=\"\", prefix=\"tmp\", dir=None):\n    \"\"\"\n    Creates a temporary file with a closed stream and deletes it when done.\n\n    :return: A contextmanager retrieving the file path.\n    \"\"\"\n    temporary = tempfile.mkstemp(suffix=suffix, prefix=prefix, dir=dir)\n    os.close(temporary[0])\n    try:\n        yield temporary[1]\n    finally:\n        os.remove(temporary[1])\n\n\n@contextmanager\ndef prepare_file(lines,\n                 filename,\n                 force_linebreaks=True,\n                 create_tempfile=True,\n                 tempfile_kwargs={}):\n    \"\"\"\n    Can creates a temporary file (if filename is None) with the lines.\n    Can also add a trailing newline to each line specified if needed.\n\n    :param lines:            The lines from the file. (list of strings)\n    :param filename:         The filename to be prepared.\n    :param force_linebreaks: Whether to append newlines at each line if needed.\n    :param create_tempfile:  Whether to save lines in tempfile if needed.\n    :param tempfile_kwargs:  Kwargs passed to tempfile.mkstemp().\n    \"\"\"\n    if force_linebreaks:\n        for i, line in enumerate(lines):\n            lines[i] = line if line.endswith(\"\\n\") else line + \"\\n\"\n\n    if not create_tempfile and filename is None:\n        filename = \"dummy_file_name\"\n\n    if not isinstance(filename, str) and create_tempfile:\n        with make_temp(**tempfile_kwargs) as filename:\n            with open(filename, 'w') as file:\n                file.writelines(lines)\n            yield lines, filename\n    else:\n        yield lines, filename\n", "path": "coalib/misc/ContextManagers.py"}], "after_files": [{"content": "from contextlib import contextmanager, closing\nimport sys\nimport os\nfrom io import StringIO\nimport builtins\nimport signal\nimport threading\nimport platform\nimport tempfile\n\nfrom coalib.misc.MutableValue import MutableValue\n\n\n@contextmanager\ndef subprocess_timeout(sub_process, seconds, kill_pg=False):\n    \"\"\"\n    Kill subprocess if the sub process takes more the than the timeout.\n\n    :param sub_process: The sub process to run.\n    :param seconds:     The number of seconds to allow the test to run for. If\n                        set to 0 or a negative value, it waits indefinitely.\n                        Floats can be used to specify units smaller than\n                        seconds.\n    :param kill_pg:     Boolean whether to kill the process group or only this\n                        process. (not applicable for windows)\n    \"\"\"\n    timedout = MutableValue(False)\n\n    if seconds <= 0:\n        yield timedout\n        return\n\n    finished = threading.Event()\n\n    if platform.system() == \"Windows\":  # pragma: no cover\n        kill_pg = False\n\n    def kill_it():\n        finished.wait(seconds)\n        if not finished.is_set():\n            timedout.value = True\n            if kill_pg:\n                pgid = os.getpgid(sub_process.pid)\n            os.kill(sub_process.pid, signal.SIGINT)\n            if kill_pg:\n                os.killpg(pgid, signal.SIGINT)\n\n    thread = threading.Thread(name='timeout-killer', target=kill_it)\n    try:\n        thread.start()\n        yield timedout\n    finally:\n        finished.set()\n        thread.join()\n\n\n@contextmanager\ndef replace_stdout(replacement):\n    \"\"\"\n    Replaces stdout with the replacement, yields back to the caller and then\n    reverts everything back.\n    \"\"\"\n    _stdout = sys.stdout\n    sys.stdout = replacement\n    try:\n        yield\n    finally:\n        sys.stdout = _stdout\n\n\n@contextmanager\ndef suppress_stdout():\n    \"\"\"\n    Suppresses everything going to stdout.\n    \"\"\"\n    with open(os.devnull, \"w\") as devnull, replace_stdout(devnull):\n        yield\n\n\n@contextmanager\ndef retrieve_stdout():\n    \"\"\"\n    Yields a StringIO object from which one can read everything that was\n    printed to stdout. (It won't be printed to the real stdout!)\n\n    Example usage:\n\n    with retrieve_stdout() as stdout:\n        print(\"something\")  # Won't print to the console\n        what_was_printed = stdout.getvalue()  # Save the value\n    \"\"\"\n    with closing(StringIO()) as sio, replace_stdout(sio):\n        oldprint = builtins.print\n        try:\n            # Overriding stdout doesn't work with libraries, this ensures even\n            # cached variables take this up. Well... it works.\n            def newprint(*args, **kwargs):\n                kwargs['file'] = sio\n                oldprint(*args, **kwargs)\n\n            builtins.print = newprint\n            yield sio\n        finally:\n            builtins.print = oldprint\n\n\n@contextmanager\ndef simulate_console_inputs(*inputs):\n    \"\"\"\n    Does some magic to simulate the given inputs to any calls to the `input`\n    builtin. This yields back an InputGenerator object so you can check\n    which input was already used and append any additional inputs you want.\n    Example:\n\n        with simulate_console_inputs(0, 1, 2) as generator:\n            assert(input() == 0)\n            assert(generator.last_input == 0)\n            generator.inputs.append(3)\n            assert(input() == 1)\n            assert(input() == 2)\n            assert(input() == 3)\n            assert(generator.last_input == 3)\n\n    :param inputs:      Any inputs to simulate.\n    :raises ValueError: Raised when was asked for more input but there's no\n                        more provided.\n    \"\"\"\n    class InputGenerator:\n\n        def __init__(self, inputs):\n            self.last_input = -1\n            self.inputs = inputs\n\n        def generate_input(self, prompt=''):\n            print(prompt, end=\"\")\n            self.last_input += 1\n            try:\n                return self.inputs[self.last_input]\n            except IndexError:\n                raise ValueError(\"Asked for more input, but no more was \"\n                                 \"provided from `simulate_console_inputs`.\")\n\n    input_generator = InputGenerator(list(inputs))\n    _input = builtins.input\n    builtins.input = input_generator.generate_input\n    try:\n        yield input_generator\n    finally:\n        builtins.input = _input\n\n\n@contextmanager\ndef make_temp(suffix=\"\", prefix=\"tmp\", dir=None):\n    \"\"\"\n    Creates a temporary file with a closed stream and deletes it when done.\n\n    :return: A contextmanager retrieving the file path.\n    \"\"\"\n    temporary = tempfile.mkstemp(suffix=suffix, prefix=prefix, dir=dir)\n    os.close(temporary[0])\n    try:\n        yield temporary[1]\n    finally:\n        os.remove(temporary[1])\n\n\n@contextmanager\ndef prepare_file(lines,\n                 filename,\n                 force_linebreaks=True,\n                 create_tempfile=True,\n                 tempfile_kwargs={}):\n    \"\"\"\n    Can create a temporary file (if filename is None) with the lines.\n    Can also add a trailing newline to each line specified if needed.\n\n    :param lines:            The lines from the file. (list of strings)\n    :param filename:         The filename to be prepared.\n    :param force_linebreaks: Whether to append newlines at each line if needed.\n    :param create_tempfile:  Whether to save lines in tempfile if needed.\n    :param tempfile_kwargs:  Kwargs passed to tempfile.mkstemp().\n    \"\"\"\n    if force_linebreaks:\n        for i, line in enumerate(lines):\n            lines[i] = line if line.endswith(\"\\n\") else line + \"\\n\"\n\n    if not create_tempfile and filename is None:\n        filename = \"dummy_file_name\"\n\n    if not isinstance(filename, str) and create_tempfile:\n        with make_temp(**tempfile_kwargs) as filename:\n            with open(filename, 'w') as file:\n                file.writelines(lines)\n            yield lines, filename\n    else:\n        yield lines, filename\n", "path": "coalib/misc/ContextManagers.py"}]}