prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  test_path_names_uppercase_enabled fails
  ```
  2018-09-18T18:50:20.6706273Z ======================================================================
  2018-09-18T18:50:20.6706627Z FAIL [0.001s]: test_path_names_uppercase_enabled (tests.ptvsd.test_pathutils.PathUtilTests)
  2018-09-18T18:50:20.6706979Z ----------------------------------------------------------------------
  2018-09-18T18:50:20.6707253Z Traceback (most recent call last):
  2018-09-18T18:50:20.6707620Z   File "D:\a\1\s\tests\ptvsd\test_pathutils.py", line 78, in test_path_names_uppercase_enabled
  2018-09-18T18:50:20.6708077Z     self.assertEqual(result, ACTUAL)
  2018-09-18T18:50:20.6708307Z AssertionError: 'D:\\A\\1\\S\\TESTS\\PTVSD\\test_pathutils.py' != 'D:\\a\\1\\s\\tests\\ptvsd\\test_pathutils.py'
  2018-09-18T18:50:20.6708746Z - D:\A\1\S\TESTS\PTVSD\test_pathutils.py
  2018-09-18T18:50:20.6708945Z + D:\a\1\s\tests\ptvsd\test_pathutils.py
  ```
  
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `ptvsd/pathutils.py`
  Content:
  ```
  1 # Copyright (c) Microsoft Corporation. All rights reserved.
  2 # Licensed under the MIT License. See LICENSE in the project root
  3 # for license information.
  4 
  5 from __future__ import print_function, with_statement, absolute_import
  6 
  7 from glob import glob
  8 import os.path
  9 import platform
  10 
  11 
  12 MAX_FILES_TO_CACHE = 1000
  13 
  14 
  15 class PathUnNormcase(object):
  16     """Ensures path names of files are returned as they exist on the fs."""
  17 
  18     def __init__(self):
  19         self._dict = {}
  20         self._enabled = False
  21 
  22     def enable(self):
  23         self._enabled = platform.system() == 'Windows'
  24 
  25     def un_normcase(self, file_path):
  26         if not self._enabled or len(file_path) == 0:
  27             return file_path
  28         if file_path in self._dict:
  29             return self._dict[file_path]
  30         file_path_to_return = self._get_actual_filename(file_path)
  31         self.track_file_path_case(file_path_to_return)
  32         return file_path_to_return
  33 
  34     def track_file_path_case(self, file_path):
  35         if not self._enabled:
  36             return
  37         if len(self._dict) > MAX_FILES_TO_CACHE:
  38             self._dict.clear()
  39         self._dict[file_path] = file_path
  40 
  41     def _get_actual_filename(self, name):
  42         """
  43         Use glob to search for a file by building a regex.
  44         Original source from https://stackoverflow.com/a/30374360/4443457
  45         (Modified to match file name as well).
  46         """
  47 
  48         sep = os.path.sep
  49         parts = os.path.normpath(name).split(sep)
  50         dirs = parts[0:-1]
  51         filename = '{}[{}]'.format(parts[-1][:-1], parts[-1][-1:])
  52         path_fragment1 = dirs[0].upper()
  53         if dirs[0] == os.path.splitdrive(name)[0]:
  54             fragments = [path_fragment1]
  55         else:
  56             dir_names = os.listdir(os.getcwd())
  57             fragments = list(filter(
  58                             lambda x: x.upper() == path_fragment1, dir_names))
  59         fragments += list(d for d in dirs[1:] if d)
  60         path = glob(sep.join(fragments))
  61         if not path:
  62             return name
  63         res = glob(sep.join((path[0], filename)))
  64         if not res:
  65             return name
  66         return res[0]
  67
  ```
  --- 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/ptvsd/pathutils.py b/ptvsd/pathutils.py
  --- a/ptvsd/pathutils.py
  +++ b/ptvsd/pathutils.py
  @@ -56,7 +56,8 @@
               dir_names = os.listdir(os.getcwd())
               fragments = list(filter(
                               lambda x: x.upper() == path_fragment1, dir_names))
  -        fragments += list(d for d in dirs[1:] if d)
  +        fragments += list('{}[{}]'.format(d[:-1], d[-1])
  +                          for d in dirs[1:] if d)
           path = glob(sep.join(fragments))
           if not path:
               return name
  
verification_info: {"golden_diff": "diff --git a/ptvsd/pathutils.py b/ptvsd/pathutils.py\n--- a/ptvsd/pathutils.py\n+++ b/ptvsd/pathutils.py\n@@ -56,7 +56,8 @@\n             dir_names = os.listdir(os.getcwd())\n             fragments = list(filter(\n                             lambda x: x.upper() == path_fragment1, dir_names))\n-        fragments += list(d for d in dirs[1:] if d)\n+        fragments += list('{}[{}]'.format(d[:-1], d[-1])\n+                          for d in dirs[1:] if d)\n         path = glob(sep.join(fragments))\n         if not path:\n             return name\n", "issue": "test_path_names_uppercase_enabled fails\n```\r\n2018-09-18T18:50:20.6706273Z ======================================================================\r\n2018-09-18T18:50:20.6706627Z FAIL [0.001s]: test_path_names_uppercase_enabled (tests.ptvsd.test_pathutils.PathUtilTests)\r\n2018-09-18T18:50:20.6706979Z ----------------------------------------------------------------------\r\n2018-09-18T18:50:20.6707253Z Traceback (most recent call last):\r\n2018-09-18T18:50:20.6707620Z   File \"D:\\a\\1\\s\\tests\\ptvsd\\test_pathutils.py\", line 78, in test_path_names_uppercase_enabled\r\n2018-09-18T18:50:20.6708077Z     self.assertEqual(result, ACTUAL)\r\n2018-09-18T18:50:20.6708307Z AssertionError: 'D:\\\\A\\\\1\\\\S\\\\TESTS\\\\PTVSD\\\\test_pathutils.py' != 'D:\\\\a\\\\1\\\\s\\\\tests\\\\ptvsd\\\\test_pathutils.py'\r\n2018-09-18T18:50:20.6708746Z - D:\\A\\1\\S\\TESTS\\PTVSD\\test_pathutils.py\r\n2018-09-18T18:50:20.6708945Z + D:\\a\\1\\s\\tests\\ptvsd\\test_pathutils.py\r\n```\r\n\r\n\n", "before_files": [{"content": "# Copyright (c) Microsoft Corporation. All rights reserved.\n# Licensed under the MIT License. See LICENSE in the project root\n# for license information.\n\nfrom __future__ import print_function, with_statement, absolute_import\n\nfrom glob import glob\nimport os.path\nimport platform\n\n\nMAX_FILES_TO_CACHE = 1000\n\n\nclass PathUnNormcase(object):\n    \"\"\"Ensures path names of files are returned as they exist on the fs.\"\"\"\n\n    def __init__(self):\n        self._dict = {}\n        self._enabled = False\n\n    def enable(self):\n        self._enabled = platform.system() == 'Windows'\n\n    def un_normcase(self, file_path):\n        if not self._enabled or len(file_path) == 0:\n            return file_path\n        if file_path in self._dict:\n            return self._dict[file_path]\n        file_path_to_return = self._get_actual_filename(file_path)\n        self.track_file_path_case(file_path_to_return)\n        return file_path_to_return\n\n    def track_file_path_case(self, file_path):\n        if not self._enabled:\n            return\n        if len(self._dict) > MAX_FILES_TO_CACHE:\n            self._dict.clear()\n        self._dict[file_path] = file_path\n\n    def _get_actual_filename(self, name):\n        \"\"\"\n        Use glob to search for a file by building a regex.\n        Original source from https://stackoverflow.com/a/30374360/4443457\n        (Modified to match file name as well).\n        \"\"\"\n\n        sep = os.path.sep\n        parts = os.path.normpath(name).split(sep)\n        dirs = parts[0:-1]\n        filename = '{}[{}]'.format(parts[-1][:-1], parts[-1][-1:])\n        path_fragment1 = dirs[0].upper()\n        if dirs[0] == os.path.splitdrive(name)[0]:\n            fragments = [path_fragment1]\n        else:\n            dir_names = os.listdir(os.getcwd())\n            fragments = list(filter(\n                            lambda x: x.upper() == path_fragment1, dir_names))\n        fragments += list(d for d in dirs[1:] if d)\n        path = glob(sep.join(fragments))\n        if not path:\n            return name\n        res = glob(sep.join((path[0], filename)))\n        if not res:\n            return name\n        return res[0]\n", "path": "ptvsd/pathutils.py"}], "after_files": [{"content": "# Copyright (c) Microsoft Corporation. All rights reserved.\n# Licensed under the MIT License. See LICENSE in the project root\n# for license information.\n\nfrom __future__ import print_function, with_statement, absolute_import\n\nfrom glob import glob\nimport os.path\nimport platform\n\n\nMAX_FILES_TO_CACHE = 1000\n\n\nclass PathUnNormcase(object):\n    \"\"\"Ensures path names of files are returned as they exist on the fs.\"\"\"\n\n    def __init__(self):\n        self._dict = {}\n        self._enabled = False\n\n    def enable(self):\n        self._enabled = platform.system() == 'Windows'\n\n    def un_normcase(self, file_path):\n        if not self._enabled or len(file_path) == 0:\n            return file_path\n        if file_path in self._dict:\n            return self._dict[file_path]\n        file_path_to_return = self._get_actual_filename(file_path)\n        self.track_file_path_case(file_path_to_return)\n        return file_path_to_return\n\n    def track_file_path_case(self, file_path):\n        if not self._enabled:\n            return\n        if len(self._dict) > MAX_FILES_TO_CACHE:\n            self._dict.clear()\n        self._dict[file_path] = file_path\n\n    def _get_actual_filename(self, name):\n        \"\"\"\n        Use glob to search for a file by building a regex.\n        Original source from https://stackoverflow.com/a/30374360/4443457\n        (Modified to match file name as well).\n        \"\"\"\n\n        sep = os.path.sep\n        parts = os.path.normpath(name).split(sep)\n        dirs = parts[0:-1]\n        filename = '{}[{}]'.format(parts[-1][:-1], parts[-1][-1:])\n        path_fragment1 = dirs[0].upper()\n        if dirs[0] == os.path.splitdrive(name)[0]:\n            fragments = [path_fragment1]\n        else:\n            dir_names = os.listdir(os.getcwd())\n            fragments = list(filter(\n                            lambda x: x.upper() == path_fragment1, dir_names))\n        fragments += list('{}[{}]'.format(d[:-1], d[-1])\n                          for d in dirs[1:] if d)\n        path = glob(sep.join(fragments))\n        if not path:\n            return name\n        res = glob(sep.join((path[0], filename)))\n        if not res:\n            return name\n        return res[0]\n", "path": "ptvsd/pathutils.py"}]}