prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Add Python type hints and doctests to other/two_sum.py
  @tonydelanuez Would you be willing to add Python type hints and doctests to [`other/two_sum.py`](../blob/master/other/two_sum.py)?  The function comments say that it will return a `list[int]` but instead it either returns a `list[list[int]]` or `False`.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `other/two_sum.py`
  Content:
  ```
  1 """
  2 Given an array of integers, return indices of the two numbers such that they add up to
  3 a specific target.
  4 
  5 You may assume that each input would have exactly one solution, and you may not use the
  6 same element twice.
  7 
  8 Example:
  9 Given nums = [2, 7, 11, 15], target = 9,
  10 
  11 Because nums[0] + nums[1] = 2 + 7 = 9,
  12 return [0, 1].
  13 """
  14 
  15 
  16 def twoSum(nums, target):
  17     """
  18     :type nums: List[int]
  19     :type target: int
  20     :rtype: List[int]
  21     """
  22     chk_map = {}
  23     for index, val in enumerate(nums):
  24         compl = target - val
  25         if compl in chk_map:
  26             indices = [chk_map[compl], index]
  27             print(indices)
  28             return [indices]
  29         else:
  30             chk_map[val] = index
  31     return False
  32
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/other/two_sum.py b/other/two_sum.py
  --- a/other/two_sum.py
  +++ b/other/two_sum.py
  @@ -11,21 +11,37 @@
   Because nums[0] + nums[1] = 2 + 7 = 9,
   return [0, 1].
   """
  +from __future__ import annotations
   
   
  -def twoSum(nums, target):
  +def two_sum(nums: list[int], target: int) -> list[int]:
       """
  -    :type nums: List[int]
  -    :type target: int
  -    :rtype: List[int]
  +    >>> two_sum([2, 7, 11, 15], 9)
  +    [0, 1]
  +    >>> two_sum([15, 2, 11, 7], 13)
  +    [1, 2]
  +    >>> two_sum([2, 7, 11, 15], 17)
  +    [0, 3]
  +    >>> two_sum([7, 15, 11, 2], 18)
  +    [0, 2]
  +    >>> two_sum([2, 7, 11, 15], 26)
  +    [2, 3]
  +    >>> two_sum([2, 7, 11, 15], 8)
  +    []
  +    >>> two_sum([3 * i for i in range(10)], 19)
  +    []
       """
       chk_map = {}
       for index, val in enumerate(nums):
           compl = target - val
           if compl in chk_map:
  -            indices = [chk_map[compl], index]
  -            print(indices)
  -            return [indices]
  -        else:
  -            chk_map[val] = index
  -    return False
  +            return [chk_map[compl], index]
  +        chk_map[val] = index
  +    return []
  +
  +
  +if __name__ == "__main__":
  +    import doctest
  +
  +    doctest.testmod()
  +    print(f"{two_sum([2, 7, 11, 15], 9) = }")
  
verification_info: {"golden_diff": "diff --git a/other/two_sum.py b/other/two_sum.py\n--- a/other/two_sum.py\n+++ b/other/two_sum.py\n@@ -11,21 +11,37 @@\n Because nums[0] + nums[1] = 2 + 7 = 9,\n return [0, 1].\n \"\"\"\n+from __future__ import annotations\n \n \n-def twoSum(nums, target):\n+def two_sum(nums: list[int], target: int) -> list[int]:\n     \"\"\"\n-    :type nums: List[int]\n-    :type target: int\n-    :rtype: List[int]\n+    >>> two_sum([2, 7, 11, 15], 9)\n+    [0, 1]\n+    >>> two_sum([15, 2, 11, 7], 13)\n+    [1, 2]\n+    >>> two_sum([2, 7, 11, 15], 17)\n+    [0, 3]\n+    >>> two_sum([7, 15, 11, 2], 18)\n+    [0, 2]\n+    >>> two_sum([2, 7, 11, 15], 26)\n+    [2, 3]\n+    >>> two_sum([2, 7, 11, 15], 8)\n+    []\n+    >>> two_sum([3 * i for i in range(10)], 19)\n+    []\n     \"\"\"\n     chk_map = {}\n     for index, val in enumerate(nums):\n         compl = target - val\n         if compl in chk_map:\n-            indices = [chk_map[compl], index]\n-            print(indices)\n-            return [indices]\n-        else:\n-            chk_map[val] = index\n-    return False\n+            return [chk_map[compl], index]\n+        chk_map[val] = index\n+    return []\n+\n+\n+if __name__ == \"__main__\":\n+    import doctest\n+\n+    doctest.testmod()\n+    print(f\"{two_sum([2, 7, 11, 15], 9) = }\")\n", "issue": "Add Python type hints and doctests to other/two_sum.py\n@tonydelanuez Would you be willing to add Python type hints and doctests to [`other/two_sum.py`](../blob/master/other/two_sum.py)?  The function comments say that it will return a `list[int]` but instead it either returns a `list[list[int]]` or `False`.\n", "before_files": [{"content": "\"\"\"\nGiven an array of integers, return indices of the two numbers such that they add up to\na specific target.\n\nYou may assume that each input would have exactly one solution, and you may not use the\nsame element twice.\n\nExample:\nGiven nums = [2, 7, 11, 15], target = 9,\n\nBecause nums[0] + nums[1] = 2 + 7 = 9,\nreturn [0, 1].\n\"\"\"\n\n\ndef twoSum(nums, target):\n    \"\"\"\n    :type nums: List[int]\n    :type target: int\n    :rtype: List[int]\n    \"\"\"\n    chk_map = {}\n    for index, val in enumerate(nums):\n        compl = target - val\n        if compl in chk_map:\n            indices = [chk_map[compl], index]\n            print(indices)\n            return [indices]\n        else:\n            chk_map[val] = index\n    return False\n", "path": "other/two_sum.py"}], "after_files": [{"content": "\"\"\"\nGiven an array of integers, return indices of the two numbers such that they add up to\na specific target.\n\nYou may assume that each input would have exactly one solution, and you may not use the\nsame element twice.\n\nExample:\nGiven nums = [2, 7, 11, 15], target = 9,\n\nBecause nums[0] + nums[1] = 2 + 7 = 9,\nreturn [0, 1].\n\"\"\"\nfrom __future__ import annotations\n\n\ndef two_sum(nums: list[int], target: int) -> list[int]:\n    \"\"\"\n    >>> two_sum([2, 7, 11, 15], 9)\n    [0, 1]\n    >>> two_sum([15, 2, 11, 7], 13)\n    [1, 2]\n    >>> two_sum([2, 7, 11, 15], 17)\n    [0, 3]\n    >>> two_sum([7, 15, 11, 2], 18)\n    [0, 2]\n    >>> two_sum([2, 7, 11, 15], 26)\n    [2, 3]\n    >>> two_sum([2, 7, 11, 15], 8)\n    []\n    >>> two_sum([3 * i for i in range(10)], 19)\n    []\n    \"\"\"\n    chk_map = {}\n    for index, val in enumerate(nums):\n        compl = target - val\n        if compl in chk_map:\n            return [chk_map[compl], index]\n        chk_map[val] = index\n    return []\n\n\nif __name__ == \"__main__\":\n    import doctest\n\n    doctest.testmod()\n    print(f\"{two_sum([2, 7, 11, 15], 9) = }\")\n", "path": "other/two_sum.py"}]}