We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
replace `builtins` with `future.builtins`, see Valloric/YouCompleteMe/issues/2024
Basically, I just run:
`find . -type f -iname '*.py' -print0 | xargs -0 -P 2 -n 1 sed -i '' -e 's/from builtins/from future.builtins/g'`
This patch fixed YouCompleteMe on my machine (Mac OS 10.11.3).

> VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Mar 30 2016 11:47:02)
> MacOS X (unix) version
> Included patches: 1-1655
> Compiled by Homebrew
> Huge version without GUI.  Features included (+) or not (-):
> +acl             +farsi           +mouse_netterm   +tag_binary
> +arabic          +file_in_path    +mouse_sgr       +tag_old_static
> +autocmd         +find_in_path    -mouse_sysmouse  -tag_any_white
> -balloon_eval    +float           +mouse_urxvt     -tcl
> -browse          +folding         +mouse_xterm     +terminfo
> ++builtin_terms  -footer          +multi_byte      +termresponse
> +byte_offset     +fork()          +multi_lang      +textobjects
> +channel         -gettext         -mzscheme        +timers
> +cindent         -hangul_input    +netbeans_intg   +title
> -clientserver    +iconv           +packages        -toolbar
> +clipboard       +insert_expand   +path_extra      +user_commands
> +cmdline_compl   +job             +perl            +vertsplit
> +cmdline_hist    +jumplist        +persistent_undo +virtualedit
> +cmdline_info    +keymap          +postscript      +visual
> +comments        +langmap         +printer         +visualextra
> +conceal         +libcall         +profile         +viminfo
> +cryptv          +linebreak       +python          +vreplace
> +cscope          +lispindent      -python3         +wildignore
> +cursorbind      +listcmds        +quickfix        +wildmenu
> +cursorshape     +localmap        +reltime         +windows
> +dialog_con      -lua             +rightleft       +writebackup
> +diff            +menu            +ruby            -X11
> +digraphs        +mksession       +scrollbind      -xfontset
> -dnd             +modify_fname    +signs           -xim
> -ebcdic          +mouse           +smartindent     -xsmp
> +emacs_tags      -mouseshape      +startuptime     -xterm_clipboard
> +eval            +mouse_dec       +statusline      -xterm_save
> +ex_extra        -mouse_gpm       -sun_workshop    -xpm
> +extra_search    -mouse_jsbterm   +syntax  
>    system vimrc file: "$VIM/vimrc"
>      user vimrc file: "$HOME/.vimrc"
>  2nd user vimrc file: "~/.vim/vimrc"
>       user exrc file: "$HOME/.exrc"
>   fall-back for $VIM: "/usr/local/share/vim"
> Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H   -F/usr/local/Frameworks -DMACOS_X_UNIX  -Os -w -pipe -march=native -mmacosx-version-min=10.11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1  
> Linking: /usr/bin/clang   -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L/usr/local/lib -F/usr/local/Frameworks -Wl,-headerpad_max_install_names -o vim        -lm  -lncurses -liconv -framework Cocoa   -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl -F/usr/local/Cellar/python/2.7.11/Frameworks -framework Python   -lruby.2.3.0 -lobjc -L/usr/local/Cellar/ruby/2.3.0/lib

<!-- Reviewable:start -->

---

This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/ycmd/446)

<!-- Reviewable:end -->


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `ycmd/server_utils.py`
Content:
```
1 # Copyright (C) 2013 Google Inc.
2 #
3 # This file is part of ycmd.
4 #
5 # ycmd is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # ycmd is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with ycmd.  If not, see <http://www.gnu.org/licenses/>.
17 
18 from __future__ import unicode_literals
19 from __future__ import print_function
20 from __future__ import division
21 from __future__ import absolute_import
22 # No other imports from `future` because this module is loaded before we have
23 # put our submodules in sys.path
24 
25 import sys
26 import os
27 import io
28 
29 VERSION_FILENAME = 'CORE_VERSION'
30 CORE_NOT_COMPATIBLE_MESSAGE = (
31   'ycmd can\'t run: ycm_core lib too old, PLEASE RECOMPILE'
32 )
33 
34 DIR_OF_CURRENT_SCRIPT = os.path.dirname( os.path.abspath( __file__ ) )
35 
36 
37 def SetUpPythonPath():
38   sys.path.insert( 0, os.path.join( DIR_OF_CURRENT_SCRIPT, '..' ) )
39 
40   AddNearestThirdPartyFoldersToSysPath( __file__ )
41 
42 
43 def ExpectedCoreVersion():
44   filepath = os.path.join( DIR_OF_CURRENT_SCRIPT, '..', VERSION_FILENAME )
45   with io.open( filepath, encoding = 'utf8' ) as f:
46     return int( f.read() )
47 
48 
49 def CompatibleWithCurrentCoreVersion():
50   import ycm_core
51   try:
52     current_core_version = ycm_core.YcmCoreVersion()
53   except AttributeError:
54     return False
55   return ExpectedCoreVersion() == current_core_version
56 
57 
58 def AncestorFolders( path ):
59   folder = os.path.normpath( path )
60   while True:
61     parent = os.path.dirname( folder )
62     if parent == folder:
63       break
64     folder = parent
65     yield folder
66 
67 
68 def PathToNearestThirdPartyFolder( path ):
69   for folder in AncestorFolders( path ):
70     path_to_third_party = os.path.join( folder, 'third_party' )
71     if os.path.isdir( path_to_third_party ):
72       return path_to_third_party
73   return None
74 
75 
76 def AddNearestThirdPartyFoldersToSysPath( filepath ):
77   path_to_third_party = PathToNearestThirdPartyFolder( filepath )
78   if not path_to_third_party:
79     raise RuntimeError(
80         'No third_party folder found for: {0}'.format( filepath ) )
81 
82   # NOTE: Any hacks for loading modules that can't be imported without custom
83   # logic need to be reproduced in run_tests.py as well.
84   for folder in os.listdir( path_to_third_party ):
85     # python-future needs special handling. Not only does it store the modules
86     # under its 'src' folder, but SOME of its modules are only meant to be
87     # accessible under py2, not py3. This is because these modules (like
88     # `queue`) are implementations of modules present in the py3 standard
89     # library. So to work around issues, we place the python-future last on
90     # sys.path so that they can be overriden by the standard library.
91     if folder == 'python-future':
92       folder = os.path.join( folder, 'src' )
93       sys.path.append( os.path.realpath( os.path.join( path_to_third_party,
94                                                        folder ) ) )
95       continue
96     sys.path.insert( 0, os.path.realpath( os.path.join( path_to_third_party,
97                                                         folder ) ) )
98
```
--- 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/ycmd/server_utils.py b/ycmd/server_utils.py
--- a/ycmd/server_utils.py
+++ b/ycmd/server_utils.py
@@ -25,6 +25,7 @@
 import sys
 import os
 import io
+import re
 
 VERSION_FILENAME = 'CORE_VERSION'
 CORE_NOT_COMPATIBLE_MESSAGE = (
@@ -32,6 +33,7 @@
 )
 
 DIR_OF_CURRENT_SCRIPT = os.path.dirname( os.path.abspath( __file__ ) )
+DIR_PACKAGES_REGEX = re.compile( '(site|dist)-packages$' )
 
 
 def SetUpPythonPath():
@@ -86,11 +88,19 @@
     # under its 'src' folder, but SOME of its modules are only meant to be
     # accessible under py2, not py3. This is because these modules (like
     # `queue`) are implementations of modules present in the py3 standard
-    # library. So to work around issues, we place the python-future last on
-    # sys.path so that they can be overriden by the standard library.
+    # library. Furthermore, we need to be sure that they are not overriden by
+    # already installed packages (for example, the 'builtins' module from
+    # 'pies2overrides' or a different version of 'python-future'). To work
+    # around these issues, we place the python-future just before the first
+    # path ending with 'site-packages' (or 'dist-packages' for Debian-like
+    # distributions) so that its modules can be overridden by the standard
+    # library but not by installed packages.
     if folder == 'python-future':
       folder = os.path.join( folder, 'src' )
-      sys.path.append( os.path.realpath( os.path.join( path_to_third_party,
+      packages_indices = ( sys.path.index( path ) for path in sys.path
+                           if DIR_PACKAGES_REGEX.search( path ) )
+      sys.path.insert( next( packages_indices, len( sys.path ) ),
+                       os.path.realpath( os.path.join( path_to_third_party,
                                                        folder ) ) )
       continue
     sys.path.insert( 0, os.path.realpath( os.path.join( path_to_third_party,

{"golden_diff": "diff --git a/ycmd/server_utils.py b/ycmd/server_utils.py\n--- a/ycmd/server_utils.py\n+++ b/ycmd/server_utils.py\n@@ -25,6 +25,7 @@\n import sys\n import os\n import io\n+import re\n \n VERSION_FILENAME = 'CORE_VERSION'\n CORE_NOT_COMPATIBLE_MESSAGE = (\n@@ -32,6 +33,7 @@\n )\n \n DIR_OF_CURRENT_SCRIPT = os.path.dirname( os.path.abspath( __file__ ) )\n+DIR_PACKAGES_REGEX = re.compile( '(site|dist)-packages$' )\n \n \n def SetUpPythonPath():\n@@ -86,11 +88,19 @@\n     # under its 'src' folder, but SOME of its modules are only meant to be\n     # accessible under py2, not py3. This is because these modules (like\n     # `queue`) are implementations of modules present in the py3 standard\n-    # library. So to work around issues, we place the python-future last on\n-    # sys.path so that they can be overriden by the standard library.\n+    # library. Furthermore, we need to be sure that they are not overriden by\n+    # already installed packages (for example, the 'builtins' module from\n+    # 'pies2overrides' or a different version of 'python-future'). To work\n+    # around these issues, we place the python-future just before the first\n+    # path ending with 'site-packages' (or 'dist-packages' for Debian-like\n+    # distributions) so that its modules can be overridden by the standard\n+    # library but not by installed packages.\n     if folder == 'python-future':\n       folder = os.path.join( folder, 'src' )\n-      sys.path.append( os.path.realpath( os.path.join( path_to_third_party,\n+      packages_indices = ( sys.path.index( path ) for path in sys.path\n+                           if DIR_PACKAGES_REGEX.search( path ) )\n+      sys.path.insert( next( packages_indices, len( sys.path ) ),\n+                       os.path.realpath( os.path.join( path_to_third_party,\n                                                        folder ) ) )\n       continue\n     sys.path.insert( 0, os.path.realpath( os.path.join( path_to_third_party,\n", "issue": "replace `builtins` with `future.builtins`, see Valloric/YouCompleteMe/issues/2024\nBasically, I just run:\n`find . -type f -iname '*.py' -print0 | xargs -0 -P 2 -n 1 sed -i '' -e 's/from builtins/from future.builtins/g'`\nThis patch fixed YouCompleteMe on my machine (Mac OS 10.11.3).\n\n> VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Mar 30 2016 11:47:02)\n> MacOS X (unix) version\n> Included patches: 1-1655\n> Compiled by Homebrew\n> Huge version without GUI.  Features included (+) or not (-):\n> +acl             +farsi           +mouse_netterm   +tag_binary\n> +arabic          +file_in_path    +mouse_sgr       +tag_old_static\n> +autocmd         +find_in_path    -mouse_sysmouse  -tag_any_white\n> -balloon_eval    +float           +mouse_urxvt     -tcl\n> -browse          +folding         +mouse_xterm     +terminfo\n> ++builtin_terms  -footer          +multi_byte      +termresponse\n> +byte_offset     +fork()          +multi_lang      +textobjects\n> +channel         -gettext         -mzscheme        +timers\n> +cindent         -hangul_input    +netbeans_intg   +title\n> -clientserver    +iconv           +packages        -toolbar\n> +clipboard       +insert_expand   +path_extra      +user_commands\n> +cmdline_compl   +job             +perl            +vertsplit\n> +cmdline_hist    +jumplist        +persistent_undo +virtualedit\n> +cmdline_info    +keymap          +postscript      +visual\n> +comments        +langmap         +printer         +visualextra\n> +conceal         +libcall         +profile         +viminfo\n> +cryptv          +linebreak       +python          +vreplace\n> +cscope          +lispindent      -python3         +wildignore\n> +cursorbind      +listcmds        +quickfix        +wildmenu\n> +cursorshape     +localmap        +reltime         +windows\n> +dialog_con      -lua             +rightleft       +writebackup\n> +diff            +menu            +ruby            -X11\n> +digraphs        +mksession       +scrollbind      -xfontset\n> -dnd             +modify_fname    +signs           -xim\n> -ebcdic          +mouse           +smartindent     -xsmp\n> +emacs_tags      -mouseshape      +startuptime     -xterm_clipboard\n> +eval            +mouse_dec       +statusline      -xterm_save\n> +ex_extra        -mouse_gpm       -sun_workshop    -xpm\n> +extra_search    -mouse_jsbterm   +syntax  \n>    system vimrc file: \"$VIM/vimrc\"\n>      user vimrc file: \"$HOME/.vimrc\"\n>  2nd user vimrc file: \"~/.vim/vimrc\"\n>       user exrc file: \"$HOME/.exrc\"\n>   fall-back for $VIM: \"/usr/local/share/vim\"\n> Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H   -F/usr/local/Frameworks -DMACOS_X_UNIX  -Os -w -pipe -march=native -mmacosx-version-min=10.11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1  \n> Linking: /usr/bin/clang   -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L/usr/local/lib -F/usr/local/Frameworks -Wl,-headerpad_max_install_names -o vim        -lm  -lncurses -liconv -framework Cocoa   -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl -F/usr/local/Cellar/python/2.7.11/Frameworks -framework Python   -lruby.2.3.0 -lobjc -L/usr/local/Cellar/ruby/2.3.0/lib\n\n<!-- Reviewable:start -->\n\n---\n\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"35\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/valloric/ycmd/446)\n\n<!-- Reviewable:end -->\n\n", "before_files": [{"content": "# Copyright (C) 2013 Google Inc.\n#\n# This file is part of ycmd.\n#\n# ycmd is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# ycmd is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with ycmd.  If not, see <http://www.gnu.org/licenses/>.\n\nfrom __future__ import unicode_literals\nfrom __future__ import print_function\nfrom __future__ import division\nfrom __future__ import absolute_import\n# No other imports from `future` because this module is loaded before we have\n# put our submodules in sys.path\n\nimport sys\nimport os\nimport io\n\nVERSION_FILENAME = 'CORE_VERSION'\nCORE_NOT_COMPATIBLE_MESSAGE = (\n  'ycmd can\\'t run: ycm_core lib too old, PLEASE RECOMPILE'\n)\n\nDIR_OF_CURRENT_SCRIPT = os.path.dirname( os.path.abspath( __file__ ) )\n\n\ndef SetUpPythonPath():\n  sys.path.insert( 0, os.path.join( DIR_OF_CURRENT_SCRIPT, '..' ) )\n\n  AddNearestThirdPartyFoldersToSysPath( __file__ )\n\n\ndef ExpectedCoreVersion():\n  filepath = os.path.join( DIR_OF_CURRENT_SCRIPT, '..', VERSION_FILENAME )\n  with io.open( filepath, encoding = 'utf8' ) as f:\n    return int( f.read() )\n\n\ndef CompatibleWithCurrentCoreVersion():\n  import ycm_core\n  try:\n    current_core_version = ycm_core.YcmCoreVersion()\n  except AttributeError:\n    return False\n  return ExpectedCoreVersion() == current_core_version\n\n\ndef AncestorFolders( path ):\n  folder = os.path.normpath( path )\n  while True:\n    parent = os.path.dirname( folder )\n    if parent == folder:\n      break\n    folder = parent\n    yield folder\n\n\ndef PathToNearestThirdPartyFolder( path ):\n  for folder in AncestorFolders( path ):\n    path_to_third_party = os.path.join( folder, 'third_party' )\n    if os.path.isdir( path_to_third_party ):\n      return path_to_third_party\n  return None\n\n\ndef AddNearestThirdPartyFoldersToSysPath( filepath ):\n  path_to_third_party = PathToNearestThirdPartyFolder( filepath )\n  if not path_to_third_party:\n    raise RuntimeError(\n        'No third_party folder found for: {0}'.format( filepath ) )\n\n  # NOTE: Any hacks for loading modules that can't be imported without custom\n  # logic need to be reproduced in run_tests.py as well.\n  for folder in os.listdir( path_to_third_party ):\n    # python-future needs special handling. Not only does it store the modules\n    # under its 'src' folder, but SOME of its modules are only meant to be\n    # accessible under py2, not py3. This is because these modules (like\n    # `queue`) are implementations of modules present in the py3 standard\n    # library. So to work around issues, we place the python-future last on\n    # sys.path so that they can be overriden by the standard library.\n    if folder == 'python-future':\n      folder = os.path.join( folder, 'src' )\n      sys.path.append( os.path.realpath( os.path.join( path_to_third_party,\n                                                       folder ) ) )\n      continue\n    sys.path.insert( 0, os.path.realpath( os.path.join( path_to_third_party,\n                                                        folder ) ) )\n", "path": "ycmd/server_utils.py"}], "after_files": [{"content": "# Copyright (C) 2013 Google Inc.\n#\n# This file is part of ycmd.\n#\n# ycmd is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# ycmd is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with ycmd.  If not, see <http://www.gnu.org/licenses/>.\n\nfrom __future__ import unicode_literals\nfrom __future__ import print_function\nfrom __future__ import division\nfrom __future__ import absolute_import\n# No other imports from `future` because this module is loaded before we have\n# put our submodules in sys.path\n\nimport sys\nimport os\nimport io\nimport re\n\nVERSION_FILENAME = 'CORE_VERSION'\nCORE_NOT_COMPATIBLE_MESSAGE = (\n  'ycmd can\\'t run: ycm_core lib too old, PLEASE RECOMPILE'\n)\n\nDIR_OF_CURRENT_SCRIPT = os.path.dirname( os.path.abspath( __file__ ) )\nDIR_PACKAGES_REGEX = re.compile( '(site|dist)-packages$' )\n\n\ndef SetUpPythonPath():\n  sys.path.insert( 0, os.path.join( DIR_OF_CURRENT_SCRIPT, '..' ) )\n\n  AddNearestThirdPartyFoldersToSysPath( __file__ )\n\n\ndef ExpectedCoreVersion():\n  filepath = os.path.join( DIR_OF_CURRENT_SCRIPT, '..', VERSION_FILENAME )\n  with io.open( filepath, encoding = 'utf8' ) as f:\n    return int( f.read() )\n\n\ndef CompatibleWithCurrentCoreVersion():\n  import ycm_core\n  try:\n    current_core_version = ycm_core.YcmCoreVersion()\n  except AttributeError:\n    return False\n  return ExpectedCoreVersion() == current_core_version\n\n\ndef AncestorFolders( path ):\n  folder = os.path.normpath( path )\n  while True:\n    parent = os.path.dirname( folder )\n    if parent == folder:\n      break\n    folder = parent\n    yield folder\n\n\ndef PathToNearestThirdPartyFolder( path ):\n  for folder in AncestorFolders( path ):\n    path_to_third_party = os.path.join( folder, 'third_party' )\n    if os.path.isdir( path_to_third_party ):\n      return path_to_third_party\n  return None\n\n\ndef AddNearestThirdPartyFoldersToSysPath( filepath ):\n  path_to_third_party = PathToNearestThirdPartyFolder( filepath )\n  if not path_to_third_party:\n    raise RuntimeError(\n        'No third_party folder found for: {0}'.format( filepath ) )\n\n  # NOTE: Any hacks for loading modules that can't be imported without custom\n  # logic need to be reproduced in run_tests.py as well.\n  for folder in os.listdir( path_to_third_party ):\n    # python-future needs special handling. Not only does it store the modules\n    # under its 'src' folder, but SOME of its modules are only meant to be\n    # accessible under py2, not py3. This is because these modules (like\n    # `queue`) are implementations of modules present in the py3 standard\n    # library. Furthermore, we need to be sure that they are not overriden by\n    # already installed packages (for example, the 'builtins' module from\n    # 'pies2overrides' or a different version of 'python-future'). To work\n    # around these issues, we place the python-future just before the first\n    # path ending with 'site-packages' (or 'dist-packages' for Debian-like\n    # distributions) so that its modules can be overridden by the standard\n    # library but not by installed packages.\n    if folder == 'python-future':\n      folder = os.path.join( folder, 'src' )\n      packages_indices = ( sys.path.index( path ) for path in sys.path\n                           if DIR_PACKAGES_REGEX.search( path ) )\n      sys.path.insert( next( packages_indices, len( sys.path ) ),\n                       os.path.realpath( os.path.join( path_to_third_party,\n                                                       folder ) ) )\n      continue\n    sys.path.insert( 0, os.path.realpath( os.path.join( path_to_third_party,\n                                                        folder ) ) )\n", "path": "ycmd/server_utils.py"}]}